2017-09-24 22:23:22 +00:00
|
|
|
module TK.SpaceTac.UI.Specs {
|
2017-02-21 22:38:31 +00:00
|
|
|
describe("ValueBar", function () {
|
|
|
|
let testgame = setupEmptyView();
|
|
|
|
|
|
|
|
it("computes proportional value", function () {
|
2017-08-24 22:47:34 +00:00
|
|
|
var bar = new ValueBar(testgame.baseview, "default", ValueBarOrientation.EAST);
|
2015-01-08 00:00:00 +00:00
|
|
|
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);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|