aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/slider/slider_options.js
diff options
context:
space:
mode:
authorRichard D. Worth <rdworth@gmail.com>2010-04-01 15:00:45 -0400
committerRichard D. Worth <rdworth@gmail.com>2010-04-01 15:00:45 -0400
commit5ffd3ab36a6c7d6c0aaad7d84c20b8d78c149a1f (patch)
tree2fa3e2a789298111e9bbfed778a58724dd3a56f9 /tests/unit/slider/slider_options.js
parentab1f806293d3e5ba5f9660d64ae33ca15168c591 (diff)
downloadjquery-ui-5ffd3ab36a6c7d6c0aaad7d84c20b8d78c149a1f.tar.gz
jquery-ui-5ffd3ab36a6c7d6c0aaad7d84c20b8d78c149a1f.zip
Align slider value to step. Fixes #5471 - value not aligned to step when set programatically
Diffstat (limited to 'tests/unit/slider/slider_options.js')
-rw-r--r--tests/unit/slider/slider_options.js41
1 files changed, 37 insertions, 4 deletions
diff --git a/tests/unit/slider/slider_options.js b/tests/unit/slider/slider_options.js
index cc36923b3..b9a766539 100644
--- a/tests/unit/slider/slider_options.js
+++ b/tests/unit/slider/slider_options.js
@@ -88,17 +88,50 @@ test("range", function() {
ok(false, "missing test - untested code is broken code.");
});
+//spec: http://wiki.jqueryui.com/Slider#specs
+// value option/method: the value option is not restricted by min/max/step.
+// What is returned by the value method is restricted by min (>=), max (<=), and step (even multiple)
test("step", function() {
var el = $('<div></div>').slider({
- step: 10
+ min: 0,
+ value: 0,
+ step: 10,
+ max: 100,
});
- equals( el.slider("value"), 0 )
+ equals( el.slider("value"), 0 );
+
el.slider("value", 1);
+ equals( el.slider("value"), 0 );
+
+ el.slider("value", 9);
equals( el.slider("value"), 10 );
- el.slider("value", 10);
- equals( el.slider("value"), 10 );
+
el.slider("value", 11);
+ equals( el.slider("value"), 10 );
+
+ el.slider("value", 19);
equals( el.slider("value"), 20 );
+
+el = $('<div></div>').slider({
+ min: 0,
+ value: 0,
+ step: 20,
+ max: 100,
+ });
+ el.slider("value", 0);
+
+ el.slider("option", "value", 1);
+ equals( el.slider("value"), 0 );
+
+ el.slider("option", "value", 9);
+ equals( el.slider("value"), 0 );
+
+ el.slider("option", "value", 11);
+ equals( el.slider("value"), 20 );
+
+ el.slider("option", "value", 19);
+ equals( el.slider("value"), 20 );
+
el.slider('destroy');
});