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);
|
|
|
|
let ship = testgame.view.battle.play_order[2];
|
2017-06-13 22:01:39 +00:00
|
|
|
ship.name = "Fury";
|
|
|
|
ship.model = new ShipModel("fake", "Fury");
|
2017-11-14 18:47:40 +00:00
|
|
|
ship.listEquipment().forEach(equ => equ.detach());
|
2017-06-13 22:01:39 +00:00
|
|
|
TestTools.setShipHP(ship, 58, 140);
|
|
|
|
TestTools.setShipAP(ship, 12);
|
|
|
|
TestTools.addWeapon(ship, 50);
|
2017-12-11 00:31:16 +00:00
|
|
|
TestTools.setAttribute(ship, "precision", 7);
|
|
|
|
TestTools.setAttribute(ship, "maneuvrability", 3);
|
|
|
|
ship.setValue("hull", 57);
|
|
|
|
ship.setValue("shield", 100);
|
|
|
|
ship.setValue("power", 9);
|
2017-11-14 00:07:06 +00:00
|
|
|
ship.active_effects.add(new AttributeEffect("hull_capacity", 50));
|
|
|
|
ship.active_effects.add(new StickyEffect(new DamageModifierEffect(-15), 3));
|
|
|
|
ship.active_effects.add(new AttributeLimitEffect("precision", 10));
|
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");
|
|
|
|
check.contains(images, "equipment-equipment");
|
|
|
|
check.equals(texts, [
|
2017-12-12 22:17:25 +00:00
|
|
|
"Level 1 Fury", "Plays in 2 turns",
|
2017-12-11 00:31:16 +00:00
|
|
|
"7", "3", "9", "max", "12", "57", "max", "58", "100", "max", "140",
|
|
|
|
"Active effects", "• hull capacity +50", "• damage -15% for 3 turns", "• limit precision to 10",
|
|
|
|
"Weapons", "equipment Mk1"
|
|
|
|
]);
|
2017-06-13 22:01:39 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|