Skip to content

Commit

Permalink
Slider: Add disabled tests and remove disabled prop from handles
Browse files Browse the repository at this point in the history
  • Loading branch information
petersendidit committed Feb 4, 2013
1 parent a61af0b commit a129a93
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 3 deletions.
31 changes: 31 additions & 0 deletions tests/unit/slider/slider_options.js
Original file line number Diff line number Diff line change
Expand Up @@ -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>");
Expand Down
3 changes: 0 additions & 3 deletions ui/jquery.ui.slider.js
Original file line number Diff line number Diff line change
Expand Up @@ -412,9 +412,6 @@ $.widget( "ui.slider", $.ui.mouse, {
if ( value ) {
this.handles.filter( ".ui-state-focus" ).blur();
this.handles.removeClass( "ui-state-hover" );
this.handles.prop( "disabled", true );
} else {
this.handles.prop( "disabled", false );
}
break;
case "orientation":
Expand Down

0 comments on commit a129a93

Please sign in to comment.