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-02-21 22:38:31 +00:00
|
|
|
describe("ActionTooltip", function () {
|
2017-05-16 23:12:05 +00:00
|
|
|
let testgame = setupEmptyView();
|
2017-02-21 22:38:31 +00:00
|
|
|
|
|
|
|
it("displays action information", () => {
|
2017-05-16 23:12:05 +00:00
|
|
|
let tooltip = new Tooltip(testgame.baseview);
|
|
|
|
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";
|
|
|
|
let action2 = new FireWeaponAction(new Equipment(), 2, 50, 0, [new DamageEffect(12)]);
|
|
|
|
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);
|
|
|
|
checkText((<any>tooltip).container.content.children[1], "Engine");
|
|
|
|
checkText((<any>tooltip).container.content.children[2], "Cost: 1 power per 0km");
|
2017-07-31 22:49:00 +00:00
|
|
|
checkText((<any>tooltip).container.content.children[3], "Move: 0km per power point (safety: 120km)");
|
2017-05-16 23:12:05 +00:00
|
|
|
checkText((<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);
|
|
|
|
checkText((<any>tooltip).container.content.children[1], "Weapon");
|
|
|
|
checkText((<any>tooltip).container.content.children[2], "Cost: 2 power");
|
|
|
|
checkText((<any>tooltip).container.content.children[3], "Fire (power usage 2, max range 50km):\n• do 12 damage on target");
|
|
|
|
checkText((<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);
|
|
|
|
checkText((<any>tooltip).container.content.children[1], "End turn");
|
2017-05-22 16:29:04 +00:00
|
|
|
checkText((<any>tooltip).container.content.children[2], "End the current ship's turn.\nWill also generate power and cool down equipments.");
|
|
|
|
checkText((<any>tooltip).container.content.children[3], "[ space ]");
|
2017-02-12 18:54:09 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|