1
0
Fork 0
spacetac/src/ui/battle/ShipTooltip.spec.ts

36 lines
1.6 KiB
TypeScript
Raw Normal View History

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-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);
let ship = testgame.view.battle.play_order[2];
TestTools.setShipModel(ship, 58, 140, 12);
ship.name = "Fury";
2018-03-06 14:39:48 +00:00
ship.model = new ShipModel("fake", "Fury");
check.patch(ship.model, "getDescription", () => "Super ship model !");
TestTools.addWeapon(ship, 50);
2018-03-26 15:30:43 +00:00
TestTools.setAttribute(ship, "evasion", 7);
ship.setValue("hull", 57);
ship.setValue("shield", 100);
ship.setValue("power", 9);
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));
tooltip.setShip(ship);
let images = collectImages((<any>tooltip).container);
let texts = collectTexts((<any>tooltip).container);
check.contains(images, "ship-fake-portrait");
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");
check.equals(texts, [
"Level 1 Fury", "Plays in 2 turns",
2018-03-26 15:30:43 +00:00
"57", "max", "58", "100", "max", "140", "7", "9", "max", "12",
2019-05-09 17:21:29 +00:00
"Weapon", "hull capacity +50", "limit shield capacity to 2 for 3 turns",
"Super ship model !"
]);
});
});
}