1
0
Fork 0
spacetac/src/scripts/view/specs/ValueBar.spec.ts
2015-01-08 01:00:00 +01:00

26 lines
655 B
TypeScript

/// <reference path="../../definitions/jasmine.d.ts"/>
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);
});
});
}