diff options
author | Scott González <scott.gonzalez@gmail.com> | 2009-11-09 03:10:57 +0000 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2009-11-09 03:10:57 +0000 |
commit | 56c6def9266f24f97857cc7068fe2d65a7b285b0 (patch) | |
tree | 7f6d331f24befa20e8dd6d9215faf1615627d460 /tests | |
parent | bff49fac188b0fa8ad85d9ce003666cd01c4dc38 (diff) | |
download | jquery-ui-56c6def9266f24f97857cc7068fe2d65a7b285b0.tar.gz jquery-ui-56c6def9266f24f97857cc7068fe2d65a7b285b0.zip |
Slider: Added paging - page up/down jumps by 1/5 the size of the range.
Fixes #3096 - Add a paging option for slider
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unit/slider/slider_core.js | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/unit/slider/slider_core.js b/tests/unit/slider/slider_core.js index 0aadc913d..38d4f4669 100644 --- a/tests/unit/slider/slider_core.js +++ b/tests/unit/slider/slider_core.js @@ -83,6 +83,52 @@ test("keydown END on handle sets value to max", function() { el.slider('destroy'); }); +test("keydown PAGE_UP on handle increases value by 1/5 range, not greater than max", function() { + $.each(['horizontal', 'vertical'], function(i, orientation) { + el = $('<div></div>'); + options = { + max: 100, + min: 0, + orientation: orientation, + step: 1 + }; + el.slider(options); + + el.slider("value", 70); + + handle().simulate("keydown", { keyCode: $.ui.keyCode.PAGE_UP }); + equals(el.slider("value"), 90); + + handle().simulate("keydown", { keyCode: $.ui.keyCode.PAGE_UP }); + equals(el.slider("value"), 100); + + el.slider("destroy"); + }); +}); + +test("keydown PAGE_DOWN on handle decreases value by 1/5 range, not less than min", function() { + $.each(['horizontal', 'vertical'], function(i, orientation) { + el = $('<div></div>'); + options = { + max: 100, + min: 0, + orientation: orientation, + step: 1 + }; + el.slider(options); + + el.slider("value", 30); + + handle().simulate("keydown", { keyCode: $.ui.keyCode.PAGE_DOWN }); + equals(el.slider("value"), 10); + + handle().simulate("keydown", { keyCode: $.ui.keyCode.PAGE_DOWN }); + equals(el.slider("value"), 0); + + el.slider("destroy"); + }); +}); + test("keydown UP on handle increases value by step, not greater than max", function() { el = $('<div></div>'); options = { |