diff options
author | Richard Worth <rdworth@gmail.com> | 2008-06-07 03:12:00 +0000 |
---|---|---|
committer | Richard Worth <rdworth@gmail.com> | 2008-06-07 03:12:00 +0000 |
commit | f94730b2b821dc1de5bb69a0c4a2fe00ca8974c2 (patch) | |
tree | a216e99b5cea480765b44f9db509dd4cc1e39877 /ui | |
parent | 1d5529afdea9225076b5e99a62dff8fb3c64c229 (diff) | |
download | jquery-ui-f94730b2b821dc1de5bb69a0c4a2fe00ca8974c2.tar.gz jquery-ui-f94730b2b821dc1de5bb69a0c4a2fe00ca8974c2.zip |
tests - switched slider to use jquery.simulate
Diffstat (limited to 'ui')
-rw-r--r-- | ui/tests/slider.html | 1 | ||||
-rw-r--r-- | ui/tests/slider.js | 22 |
2 files changed, 17 insertions, 6 deletions
diff --git a/ui/tests/slider.html b/ui/tests/slider.html index f77ec68e6..090cfd2bf 100644 --- a/ui/tests/slider.html +++ b/ui/tests/slider.html @@ -12,6 +12,7 @@ <script type="text/javascript" src="../../qunit/testrunner.js"></script> <script type="text/javascript" src="slider.js"></script> +<script type="text/javascript" src="jquery.simulate.js"></script> </head> <body> diff --git a/ui/tests/slider.js b/ui/tests/slider.js index 0dc020642..7b6d095a5 100644 --- a/ui/tests/slider.js +++ b/ui/tests/slider.js @@ -1,6 +1,16 @@ -$.fn.triggerKeydown = function(keyCode) { - return this.trigger("keydown", [$.event.fix({event:"keydown", keyCode: keyCode, target: this[0]})]); -} + +var keyCodes = { + leftArrow: 37, + upArrow: 38, + rightArrow: 39, + downArrow: 40 +}; + +$.each(keyCodes, function(key, val) { + $.fn[key] = function() { + return this.simulate("keydown", { keyCode: val }); + } +}); function assertChange(stepping, start, result, action) { return function() { @@ -21,13 +31,13 @@ function assertChange(stepping, start, result, action) { module("slider: single handle") test("change one step via keydown", assertChange(1, undefined, 1, function() { - this.find("a").triggerKeydown("39"); + this.find("a").rightArrow(); })) test("change - 10 steps via keydown", assertChange(10, 20, 10, function() { - this.find("a").triggerKeydown("37"); + this.find("a").leftArrow(); })) test("change +10 steps via keydown", assertChange(10, 20, 30, function() { - this.find("a").triggerKeydown("39"); + this.find("a").rightArrow(); })) test("moveTo, absolute value", assertChange(1, 1, 10, function() { |