From 1f6a9c9eda1cf26838cf3e7edf14830c7311ad1e Mon Sep 17 00:00:00 2001 From: Chi Cheng Date: Tue, 19 Aug 2008 05:54:49 +0000 Subject: [PATCH] Spinner test: spin with auto-incremental stepping --- tests/all.html | 14 ++++++++++++++ tests/spinner.js | 23 +++++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/tests/all.html b/tests/all.html index e5f85a27c..0080e86f9 100644 --- a/tests/all.html +++ b/tests/all.html @@ -7,6 +7,7 @@ + @@ -15,12 +16,14 @@ + + @@ -28,8 +31,10 @@ + @@ -42,12 +47,15 @@

Run individual testsuites or doubleclick a test below

    @@ -186,6 +194,12 @@
  1. Item 5
  2. +

    + + + + + \ No newline at end of file diff --git a/tests/spinner.js b/tests/spinner.js index ca664b2e2..4c0bf2b14 100644 --- a/tests/spinner.js +++ b/tests/spinner.js @@ -104,6 +104,29 @@ test("keydown on input with options", function() { }); +test("spin with auto-incremental stepping", function() { + expect(2); + + el = $("#spin").spinner(); + + for ( var i = 1 ; i<=120 ; i++ ) { + el.simulate("keydown",{keyCode:$.simulate.VK_UP}); + } + + el.simulate("keyup",{keyCode:$.simulate.VK_UP}); + + equals(el.val(), 300, "keydown 120 times"); + + for ( var i = 1 ; i<=130 ; i++ ) { + el.simulate("keydown",{keyCode:$.simulate.VK_DOWN}); + } + + el.simulate("keyup",{keyCode:$.simulate.VK_DOWN}); + + equals(el.val(), -100, "keydown 130 times"); + +}); + test("mouse click on buttons", function() { expect(4); el = $("#spin").spinner();