1
0
Fork 0
spacetac/src/view/specs/ValueBar.spec.ts

24 lines
599 B
TypeScript
Raw Normal View History

2015-01-08 00:00:00 +00:00
module SpaceTac.View.Specs {
"use strict";
describe("ValueBar", () => {
ingame_it("computes proportional value", (game: Phaser.Game) => {
var bar = ValueBar.newStandard(game, 0, 0);
expect(bar.getProportionalValue()).toBe(0);
bar.setValue(20, 100);
expect(bar.getProportionalValue()).toBeCloseTo(0.2, 0.000001);
bar.setValue(40);
expect(bar.getProportionalValue()).toBeCloseTo(0.4, 0.000001);
bar.setValue(0, 0);
expect(bar.getProportionalValue()).toBe(0);
});
});
}