aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/spinner/spinner_events.js
diff options
context:
space:
mode:
authorjzaefferer <joern.zaefferer@gmail.com>2010-10-22 06:23:52 +0200
committerjzaefferer <joern.zaefferer@gmail.com>2010-10-22 06:23:52 +0200
commitaf8ca4ed0e5063c5a84cd7ab77f525b98c6c62b7 (patch)
treed86e8967e256bb29457f02be7833f252d93875bc /tests/unit/spinner/spinner_events.js
parentf7d8a1ba570fd620d65b377ebe806eac0b578328 (diff)
downloadjquery-ui-af8ca4ed0e5063c5a84cd7ab77f525b98c6c62b7.tar.gz
jquery-ui-af8ca4ed0e5063c5a84cd7ab77f525b98c6c62b7.zip
Importing spinner unit tests
Diffstat (limited to 'tests/unit/spinner/spinner_events.js')
-rw-r--r--tests/unit/spinner/spinner_events.js72
1 files changed, 72 insertions, 0 deletions
diff --git a/tests/unit/spinner/spinner_events.js b/tests/unit/spinner/spinner_events.js
new file mode 100644
index 000000000..ae80801e6
--- /dev/null
+++ b/tests/unit/spinner/spinner_events.js
@@ -0,0 +1,72 @@
+/*
+ * spinner_events.js
+ */
+(function($) {
+
+module("spinner: events");
+
+test("start", function() {
+ expect(1);
+
+ var start = 0;
+
+ el = $("#spin").spinner({
+ start: function(){
+ start++;
+ }
+ });
+
+ simulateKeyDownUp(el, $.ui.keyCode.UP);
+
+ equals(start, 1, "Start triggered");
+});
+
+test("spin", function() {
+ expect(1);
+
+ var spin = 0;
+
+ el = $("#spin").spinner({
+ spin: function(){
+ spin++;
+ }
+ });
+
+ simulateKeyDownUp(el, $.ui.keyCode.UP);
+
+ equals(spin, 1, "Spin triggered");
+});
+
+test("stop", function() {
+ expect(1);
+
+ var stop = 0;
+
+ el = $("#spin").spinner({
+ stop: function(){
+ stop++;
+ }
+ });
+
+ simulateKeyDownUp(el, $.ui.keyCode.DOWN);
+
+ equals(stop, 1, "Stop triggered");
+});
+
+test("change", function() {
+ expect(1);
+
+ var start = spin = stop = change = 0;
+
+ el = $("#spin").spinner({
+ change: function(){
+ change++;
+ }
+ });
+
+ simulateKeyDownUp(el, $.ui.keyCode.UP);
+
+ equals(change, 1, "Change triggered");
+});
+
+})(jQuery);