1
0
Fork 0
spacetac/src/ui/common/ValueBar.spec.ts

20 lines
610 B
TypeScript
Raw Normal View History

2017-09-24 22:23:22 +00:00
module TK.SpaceTac.UI.Specs {
2017-10-26 21:47:13 +00:00
testing("ValueBar", test => {
2017-10-29 21:08:55 +00:00
let testgame = setupEmptyView(test);
2017-02-21 22:38:31 +00:00
2017-10-26 21:47:13 +00:00
test.case("computes proportional value", check => {
2017-10-09 21:13:56 +00:00
var bar = new ValueBar(testgame.view, "default", ValueBarOrientation.EAST);
2017-10-26 21:47:13 +00:00
check.equals(bar.getProportionalValue(), 0);
2015-01-08 00:00:00 +00:00
bar.setValue(20, 100);
2017-10-26 21:47:13 +00:00
check.nears(bar.getProportionalValue(), 0.2);
2015-01-08 00:00:00 +00:00
bar.setValue(40);
2017-10-26 21:47:13 +00:00
check.nears(bar.getProportionalValue(), 0.4);
2015-01-08 00:00:00 +00:00
bar.setValue(0, 0);
2017-10-26 21:47:13 +00:00
check.equals(bar.getProportionalValue(), 0);
2015-01-08 00:00:00 +00:00
});
});
}