2017-09-24 22:23:22 +00:00
|
|
|
module TK.SpaceTac.UI.Specs {
|
2017-10-26 21:47:13 +00:00
|
|
|
testing("ActionTooltip", test => {
|
2017-10-29 21:08:55 +00:00
|
|
|
let testgame = setupEmptyView(test);
|
2017-02-21 22:38:31 +00:00
|
|
|
|
2017-10-26 21:47:13 +00:00
|
|
|
test.case("displays action information", check => {
|
2017-10-09 21:13:56 +00:00
|
|
|
let tooltip = new Tooltip(testgame.view);
|
2017-05-16 23:12:05 +00:00
|
|
|
let ship = new Ship();
|
2018-02-08 15:16:03 +00:00
|
|
|
TestTools.setShipModel(ship, 100, 0, 10);
|
2017-02-12 18:54:09 +00:00
|
|
|
|
2018-04-04 16:17:10 +00:00
|
|
|
let action1 = ship.actions.addCustom(new MoveAction("Thruster"));
|
|
|
|
let action2 = ship.actions.addCustom(new TriggerAction("Superweapon", { effects: [new DamageEffect(12)], power: 2, range: 50 }));
|
|
|
|
let action3 = ship.actions.addCustom(new EndTurnAction());
|
2017-02-12 18:54:09 +00:00
|
|
|
|
2017-12-11 00:31:16 +00:00
|
|
|
ActionTooltip.fill(tooltip.getBuilder(), ship, action1, 0);
|
2018-05-15 14:57:45 +00:00
|
|
|
checkText(check, tooltip.container.content.list[1], "Use Thruster");
|
|
|
|
checkText(check, tooltip.container.content.list[2], "Cost: 1 power per 0km");
|
|
|
|
checkText(check, tooltip.container.content.list[3], "Move: 0km per power point (safety: 120km)");
|
|
|
|
checkText(check, tooltip.container.content.list[4], "[ 1 ]");
|
2017-02-12 18:54:09 +00:00
|
|
|
|
2017-05-16 23:12:05 +00:00
|
|
|
tooltip.hide();
|
2017-12-11 00:31:16 +00:00
|
|
|
ActionTooltip.fill(tooltip.getBuilder(), ship, action2, 1);
|
2018-05-15 14:57:45 +00:00
|
|
|
checkText(check, tooltip.container.content.list[1], "Fire Superweapon");
|
|
|
|
checkText(check, tooltip.container.content.list[2], "Cost: 2 power");
|
|
|
|
checkText(check, tooltip.container.content.list[3], "Fire (power 2, range 50km):\n• do 12 damage on target");
|
|
|
|
checkText(check, tooltip.container.content.list[4], "[ 2 ]");
|
2017-02-12 18:54:09 +00:00
|
|
|
|
2017-05-16 23:12:05 +00:00
|
|
|
tooltip.hide();
|
2017-12-11 00:31:16 +00:00
|
|
|
ActionTooltip.fill(tooltip.getBuilder(), ship, action3, 2);
|
2018-05-15 14:57:45 +00:00
|
|
|
checkText(check, tooltip.container.content.list[1], "End turn");
|
|
|
|
checkText(check, tooltip.container.content.list[2], "End the current ship's turn.\nWill also generate power and cool down equipments.");
|
|
|
|
checkText(check, tooltip.container.content.list[3], "[ space ]");
|
2017-02-12 18:54:09 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|