aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/slider/slider_options.js
diff options
context:
space:
mode:
authorDavid Petersen <public@petersendidit.com>2013-01-31 20:19:52 -0600
committerDavid Petersen <public@petersendidit.com>2013-02-04 14:43:56 -0600
commita129a93a4d3a76e646423b6238459a12c80e22b0 (patch)
tree487fb4d93c26433a5503fed2f70ce56bb908d04b /tests/unit/slider/slider_options.js
parenta61af0b205c865b9c4f949bcc1bebe79994519d0 (diff)
downloadjquery-ui-a129a93a4d3a76e646423b6238459a12c80e22b0.tar.gz
jquery-ui-a129a93a4d3a76e646423b6238459a12c80e22b0.zip
Slider: Add disabled tests and remove disabled prop from handles
Diffstat (limited to 'tests/unit/slider/slider_options.js')
-rw-r--r--tests/unit/slider/slider_options.js31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/unit/slider/slider_options.js b/tests/unit/slider/slider_options.js
index d354ef91c..a7bd3ae83 100644
--- a/tests/unit/slider/slider_options.js
+++ b/tests/unit/slider/slider_options.js
@@ -11,6 +11,37 @@ function handle() {
module("slider: options");
+test( "disabled", function(){
+ expect( 8 );
+ var count = 0;
+
+ el = $( "#slider1" ).slider();
+ el.on( "slidestart", function() {
+ count++;
+ });
+
+ // enabled
+ ok( !el.hasClass( "ui-slider-disabled" ), "no disabled class" );
+ equal( el.slider( "option", "disabled" ), false , "is not disabled" );
+
+ handle().simulate( "drag", { dx: 10 } );
+ equal( count, 1, "slider moved");
+
+ handle().simulate("keydown", { keyCode: $.ui.keyCode.RIGHT });
+ equal( count, 2, "slider moved");
+
+ // disabled
+ el.slider( "option", "disabled", true );
+ ok( el.hasClass( "ui-slider-disabled" ), "has disabled class" );
+ equal( el.slider( "option", "disabled" ), true, "is disabled" );
+
+ handle().simulate( "drag", { dx: 10 } );
+ equal( count, 2, "slider did not move");
+
+ handle().simulate("keydown", { keyCode: $.ui.keyCode.RIGHT });
+ equal( count, 2, "slider did not move");
+});
+
test("max", function() {
expect( 2 );
el = $("<div></div>");