1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
/*
* spinner_events.js
*/
(function($) {
module("spinner: events");
test("start", function() {
var start = 0;
var el = $("#spin").spinner({
start: function(){
start++;
}
});
spinner_simulateKeyDownUp(el, $.ui.keyCode.UP);
equals(start, 1, "Start triggered");
});
test("spin", function() {
var spin = 0;
var el = $("#spin").spinner({
spin: function(){
spin++;
}
});
spinner_simulateKeyDownUp(el, $.ui.keyCode.UP);
equals(spin, 1, "Spin triggered");
});
test("stop", function() {
var stop = 0;
var el = $("#spin").spinner({
stop: function(){
stop++;
}
});
spinner_simulateKeyDownUp(el, $.ui.keyCode.DOWN);
equals(stop, 1, "Stop triggered");
});
test("change", function() {
var change = 0;
var el = $("#spin").spinner({
change: function(){
change++;
}
});
spinner_simulateKeyDownUp(el, $.ui.keyCode.UP);
el.blur();
equals(change, 1, "Change triggered");
});
})(jQuery);
|