jquery-ui/tests/unit/spinner/spinner_events.js

65 lines
963 B
JavaScript
Raw Normal View History

2010-10-22 04:23:52 +00:00
/*
* spinner_events.js
*/
(function($) {
module("spinner: events");
test("start", function() {
var start = 0;
var el = $("#spin").spinner({
2010-10-22 04:23:52 +00:00
start: function(){
start++;
}
});
simulateKeyDownUp(el, $.ui.keyCode.UP);
equals(start, 1, "Start triggered");
});
test("spin", function() {
var spin = 0;
var el = $("#spin").spinner({
2010-10-22 04:23:52 +00:00
spin: function(){
spin++;
}
});
simulateKeyDownUp(el, $.ui.keyCode.UP);
equals(spin, 1, "Spin triggered");
});
test("stop", function() {
var stop = 0;
var el = $("#spin").spinner({
2010-10-22 04:23:52 +00:00
stop: function(){
stop++;
}
});
simulateKeyDownUp(el, $.ui.keyCode.DOWN);
equals(stop, 1, "Stop triggered");
});
test("change", function() {
var change = 0;
2010-10-22 04:23:52 +00:00
var el = $("#spin").spinner({
2010-10-22 04:23:52 +00:00
change: function(){
change++;
}
});
simulateKeyDownUp(el, $.ui.keyCode.UP);
equals(change, 1, "Change triggered");
});
})(jQuery);