Spinner test: a bug when set stepping:0.3

This commit is contained in:
Chi Cheng 2008-08-19 08:56:48 +00:00
parent 9da87e28e6
commit 1de76c6f77

View File

@ -139,16 +139,16 @@ test("keydown on input with options", function() {
}); });
test("currency and decimal options", function() { test("currency and decimal options", function() {
expect(4); expect(5);
el = $("#spin").spinner({ currency:"$", incremental:false, max:120, min:-50, stepping:0.15 }); el = $("#spin").spinner({ currency:"$", incremental:false, max:120, min:-50, stepping:0.3 });
equals(el.val(), "$0.00", "start number"); equals(el.val(), "$0.00", "start number");
el.simulate("keydown",{keyCode:$.simulate.VK_UP}) el.simulate("keydown",{keyCode:$.simulate.VK_UP})
.simulate("keyup",{keyCode:$.simulate.VK_UP}); .simulate("keyup",{keyCode:$.simulate.VK_UP});
equals(el.val(), "$0.15", "Stepping 0.15"); equals(el.val(), "$0.30", "Stepping 0.30");
el.simulate("keydown",{keyCode:$.simulate.VK_END}) el.simulate("keydown",{keyCode:$.simulate.VK_END})
.simulate("keyup",{keyCode:$.simulate.VK_END}); .simulate("keyup",{keyCode:$.simulate.VK_END});
@ -160,6 +160,14 @@ test("currency and decimal options", function() {
equals(el.val(), "-$50.00", "Home key to min"); equals(el.val(), "-$50.00", "Home key to min");
for ( var i = 1 ; i<=120 ; i++ ) {
el.simulate("keydown",{keyCode:$.simulate.VK_UP});
}
el.simulate("keyup",{keyCode:$.simulate.VK_UP});
equals(el.val(), "-$14.00", "keydown 120 times");
}); });