2017-02-12 18:54:09 +00:00
|
|
|
/// <reference path="../TestGame.ts"/>
|
|
|
|
|
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-05-16 23:12:05 +00:00
|
|
|
let testgame = setupEmptyView();
|
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();
|
|
|
|
TestTools.setShipAP(ship, 10);
|
2017-02-12 18:54:09 +00:00
|
|
|
|
2017-05-16 23:12:05 +00:00
|
|
|
let action1 = new MoveAction(new Equipment());
|
|
|
|
nn(action1.equipment).name = "Engine";
|
|
|
|
action1.name = "Move";
|
2017-10-03 16:11:30 +00:00
|
|
|
let action2 = new TriggerAction(new Equipment(), [new DamageEffect(12)], 2, 50, 0);
|
2017-05-16 23:12:05 +00:00
|
|
|
nn(action2.equipment).name = "Weapon";
|
|
|
|
action2.name = "Fire";
|
|
|
|
let action3 = new EndTurnAction();
|
|
|
|
action3.name = "End turn";
|
2017-02-12 18:54:09 +00:00
|
|
|
|
2017-05-16 23:12:05 +00:00
|
|
|
ActionTooltip.fill(tooltip.getFiller(), ship, action1, 0);
|
2017-10-26 21:47:13 +00:00
|
|
|
checkText(check, (<any>tooltip).container.content.children[1], "Engine");
|
|
|
|
checkText(check, (<any>tooltip).container.content.children[2], "Cost: 1 power per 0km");
|
|
|
|
checkText(check, (<any>tooltip).container.content.children[3], "Move: 0km per power point (safety: 120km)");
|
|
|
|
checkText(check, (<any>tooltip).container.content.children[4], "[ 1 ]");
|
2017-02-12 18:54:09 +00:00
|
|
|
|
2017-05-16 23:12:05 +00:00
|
|
|
tooltip.hide();
|
|
|
|
ActionTooltip.fill(tooltip.getFiller(), ship, action2, 1);
|
2017-10-26 21:47:13 +00:00
|
|
|
checkText(check, (<any>tooltip).container.content.children[1], "Weapon");
|
|
|
|
checkText(check, (<any>tooltip).container.content.children[2], "Cost: 2 power");
|
|
|
|
checkText(check, (<any>tooltip).container.content.children[3], "Fire (power usage 2, max range 50km):\n• do 12 damage on target");
|
|
|
|
checkText(check, (<any>tooltip).container.content.children[4], "[ 2 ]");
|
2017-02-12 18:54:09 +00:00
|
|
|
|
2017-05-16 23:12:05 +00:00
|
|
|
tooltip.hide();
|
|
|
|
ActionTooltip.fill(tooltip.getFiller(), ship, action3, 2);
|
2017-10-26 21:47:13 +00:00
|
|
|
checkText(check, (<any>tooltip).container.content.children[1], "End turn");
|
|
|
|
checkText(check, (<any>tooltip).container.content.children[2], "End the current ship's turn.\nWill also generate power and cool down equipments.");
|
|
|
|
checkText(check, (<any>tooltip).container.content.children[3], "[ space ]");
|
2017-02-12 18:54:09 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|