2017-09-24 22:23:22 +00:00
|
|
|
module TK.SpaceTac.UI.Specs {
|
2017-10-26 21:47:13 +00:00
|
|
|
testing("ShipTooltip", test => {
|
2017-10-29 21:08:55 +00:00
|
|
|
let testgame = setupBattleview(test);
|
2017-06-13 22:01:39 +00:00
|
|
|
|
2017-10-26 21:47:13 +00:00
|
|
|
test.case("fills ship details", check => {
|
2017-10-09 21:13:56 +00:00
|
|
|
let tooltip = new ShipTooltip(testgame.view);
|
2019-05-19 22:32:15 +00:00
|
|
|
let ship = testgame.view.battle.fleets[0].ships[0];
|
2018-02-08 15:16:03 +00:00
|
|
|
TestTools.setShipModel(ship, 58, 140, 12);
|
2017-06-13 22:01:39 +00:00
|
|
|
ship.name = "Fury";
|
2018-03-06 14:39:48 +00:00
|
|
|
ship.model = new ShipModel("fake", "Fury");
|
2018-02-08 15:16:03 +00:00
|
|
|
check.patch(ship.model, "getDescription", () => "Super ship model !");
|
2017-06-13 22:01:39 +00:00
|
|
|
TestTools.addWeapon(ship, 50);
|
2018-03-26 15:30:43 +00:00
|
|
|
TestTools.setAttribute(ship, "evasion", 7);
|
2017-12-11 00:31:16 +00:00
|
|
|
ship.setValue("hull", 57);
|
|
|
|
ship.setValue("shield", 100);
|
2017-11-14 00:07:06 +00:00
|
|
|
ship.active_effects.add(new AttributeEffect("hull_capacity", 50));
|
2018-03-26 15:30:43 +00:00
|
|
|
ship.active_effects.add(new StickyEffect(new AttributeLimitEffect("shield_capacity", 2), 3));
|
2017-06-13 22:01:39 +00:00
|
|
|
tooltip.setShip(ship);
|
|
|
|
|
2017-12-11 00:31:16 +00:00
|
|
|
let images = collectImages((<any>tooltip).container);
|
|
|
|
let texts = collectTexts((<any>tooltip).container);
|
|
|
|
check.contains(images, "ship-fake-portrait");
|
2018-02-08 15:16:03 +00:00
|
|
|
check.contains(images, "action-weapon");
|
2019-05-09 17:21:29 +00:00
|
|
|
check.contains(images, "battle-hud-ship-effect-good");
|
|
|
|
check.contains(images, "battle-hud-ship-effect-bad");
|
2017-12-11 00:31:16 +00:00
|
|
|
check.equals(texts, [
|
2019-05-19 22:32:15 +00:00
|
|
|
"Level 1 Fury",
|
2019-05-21 21:29:47 +00:00
|
|
|
"57", "max", "58", "12",
|
2019-05-09 17:21:29 +00:00
|
|
|
"Weapon", "hull capacity +50", "limit shield capacity to 2 for 3 turns",
|
2018-02-08 15:16:03 +00:00
|
|
|
"Super ship model !"
|
2017-12-11 00:31:16 +00:00
|
|
|
]);
|
2017-06-13 22:01:39 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|