diff options
author | Richard Worth <rdworth@gmail.com> | 2009-09-19 15:34:20 +0000 |
---|---|---|
committer | Richard Worth <rdworth@gmail.com> | 2009-09-19 15:34:20 +0000 |
commit | c6990895bed334f87133c433bd364585d3fd2d89 (patch) | |
tree | 5e56ea1484526dd1c592c6047b3f1cb04b204155 /tests/unit | |
parent | f164edbdd97fb0c4e1dd1012d79225b8a66205e5 (diff) | |
download | jquery-ui-c6990895bed334f87133c433bd364585d3fd2d89.tar.gz jquery-ui-c6990895bed334f87133c433bd364585d3fd2d89.zip |
slider unit tests: method value
Diffstat (limited to 'tests/unit')
-rw-r--r-- | tests/unit/slider/slider_methods.js | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/tests/unit/slider/slider_methods.js b/tests/unit/slider/slider_methods.js index 37977efb9..428ca73f7 100644 --- a/tests/unit/slider/slider_methods.js +++ b/tests/unit/slider/slider_methods.js @@ -92,7 +92,31 @@ test("disable", function() { }); test("value", function() { - ok(false, "missing test - untested code is broken code."); + $([false, 'min', 'max']).each(function() { + var el = $('<div></div>').slider({ + range: this, + value: 5 + }); + equals(el.slider('value'), 5, 'range: ' + this + ' slider method get'); + el.slider('value', 10); + equals(el.slider('value'), 10, 'range: ' + this + ' slider method set'); + el.remove(); + }); + var el = $('<div></div>').slider({ + min: -1, value: 0, max: 1 + }); + // min with value option vs value method + el.slider('option', 'value', -2); + equals(el.slider('option', 'value'), -2, 'value option does not respect min'); + equals(el.slider('value'), -1, 'value method get respects min'); + el.slider('value', -2); + equals(el.slider('option', 'value'), -1, 'value method set respects min'); + // max with value option vs value method + el.slider('option', 'value', 2); + equals(el.slider('option', 'value'), 2, 'value option does not respect max'); + equals(el.slider('value'), 1, 'value method get respects max'); + el.slider('value', 2); + equals(el.slider('option', 'value'), 1, 'value method set respects max'); }); test("values", function() { |