2010-10-22 04:23:52 +00:00
|
|
|
/*
|
|
|
|
* spinner_events.js
|
|
|
|
*/
|
|
|
|
(function($) {
|
|
|
|
|
|
|
|
module("spinner: events");
|
|
|
|
|
|
|
|
test("start", function() {
|
|
|
|
var start = 0;
|
|
|
|
|
2010-10-26 10:14:45 +00:00
|
|
|
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;
|
|
|
|
|
2010-10-26 10:14:45 +00:00
|
|
|
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;
|
|
|
|
|
2010-10-26 10:14:45 +00:00
|
|
|
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() {
|
2010-10-26 10:21:22 +00:00
|
|
|
var change = 0;
|
2010-10-22 04:23:52 +00:00
|
|
|
|
2010-10-26 10:14:45 +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);
|