mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Spinner test: callback
This commit is contained in:
parent
1f6a9c9eda
commit
2ac541d500
@ -115,15 +115,15 @@ test("spin with auto-incremental stepping", function() {
|
|||||||
|
|
||||||
el.simulate("keyup",{keyCode:$.simulate.VK_UP});
|
el.simulate("keyup",{keyCode:$.simulate.VK_UP});
|
||||||
|
|
||||||
equals(el.val(), 300, "keydown 120 times");
|
equals(el.val(), 300, "keydown 120 times (100+20*10)");
|
||||||
|
|
||||||
for ( var i = 1 ; i<=130 ; i++ ) {
|
for ( var i = 1 ; i<=210 ; i++ ) {
|
||||||
el.simulate("keydown",{keyCode:$.simulate.VK_DOWN});
|
el.simulate("keydown",{keyCode:$.simulate.VK_DOWN});
|
||||||
}
|
}
|
||||||
|
|
||||||
el.simulate("keyup",{keyCode:$.simulate.VK_DOWN});
|
el.simulate("keyup",{keyCode:$.simulate.VK_DOWN});
|
||||||
|
|
||||||
equals(el.val(), -100, "keydown 130 times");
|
equals(el.val(), -1800, "keydown 210 times (300-100-100*10-10*100)");
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -150,6 +150,35 @@ test("mouse click on buttons", function() {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("callback", function() {
|
||||||
|
expect(2);
|
||||||
|
|
||||||
|
var s = 0,
|
||||||
|
c = 0;
|
||||||
|
|
||||||
|
el = $("#spin").spinner({
|
||||||
|
spin: function(){
|
||||||
|
s++;
|
||||||
|
},
|
||||||
|
change: function(){
|
||||||
|
c++;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
for ( var i = 1 ; i<=10 ; i++ ) {
|
||||||
|
el.simulate("keydown",{keyCode:$.simulate.VK_UP});
|
||||||
|
}
|
||||||
|
|
||||||
|
el.simulate("keyup",{keyCode:$.simulate.VK_UP});
|
||||||
|
|
||||||
|
equals(s, 10, "Spin 10 times");
|
||||||
|
|
||||||
|
el.simulate("keydown",{keyCode:$.simulate.VK_UP}).simulate("keyup",{keyCode:$.simulate.VK_UP});
|
||||||
|
|
||||||
|
equals(c, 2, "Change 2 times");
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
test("mouse wheel on input", function() {
|
test("mouse wheel on input", function() {
|
||||||
expect(0);
|
expect(0);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user