Skip to content
Permalink
Browse files

Tabs: Adjust handling of disabled option, using _setOptionDisabled

Tabs support multiple values to disable individual tabs. Only add the
ui-tabs-disabled class when all tabs are disabled.

Ref #9151
Closes gh-1599
  • Loading branch information
jzaefferer authored and scottgonzalez committed Sep 25, 2015
1 parent ef8ac2a commit 0bfbd21d4fefa98d165b7d50277bd23be84e919a
Showing with 8 additions and 12 deletions.
  1. +1 −1 tests/unit/tabs/options.js
  2. +7 −11 ui/widgets/tabs.js
@@ -185,7 +185,7 @@ test( "disabled", function( assert ) {
disabled( element, true );

assert.lacksClasses( element.tabs( "widget" ), "ui-state-disabled" );
assert.lacksClasses( element.tabs( "widget" ), "ui-tabs-disabled" );
assert.hasClasses( element.tabs( "widget" ), "ui-tabs-disabled" );
ok( !element.tabs( "widget" ).attr( "aria-disabled" ), "after: wrapper doesn't have aria-disabled attr" );

event = $.Event( "click" );
@@ -291,13 +291,6 @@ $.widget( "ui.tabs", {
return;
}

if ( key === "disabled" ) {

// don't use the widget factory's disabled handling
this._setupDisabled( value );
return;
}

this._super( key, value );

if ( key === "collapsible" ) {
@@ -363,7 +356,7 @@ $.widget( "ui.tabs", {
},

_refresh: function() {
this._setupDisabled( this.options.disabled );
this._setOptionDisabled( this.options.disabled );
this._setupEvents( this.options.event );
this._setupHeightStyle( this.options.heightStyle );

@@ -507,7 +500,7 @@ $.widget( "ui.tabs", {
.data( "ui-tabs-destroy", true );
},

_setupDisabled: function( disabled ) {
_setOptionDisabled: function( disabled ) {
var currentItem, li, i;

if ( $.isArray( disabled ) ) {
@@ -531,6 +524,9 @@ $.widget( "ui.tabs", {
}

this.options.disabled = disabled;

this._toggleClass( this.widget(), this.widgetFullName + "-disabled", null,
disabled === true );
},

_setupEvents: function( event ) {
@@ -804,7 +800,7 @@ $.widget( "ui.tabs", {
} );
}
}
this._setupDisabled( disabled );
this._setOptionDisabled( disabled );
},

disable: function( index ) {
@@ -826,7 +822,7 @@ $.widget( "ui.tabs", {
disabled = [ index ];
}
}
this._setupDisabled( disabled );
this._setOptionDisabled( disabled );
},

load: function( index, event ) {

0 comments on commit 0bfbd21

Please sign in to comment.
You can’t perform that action at this time.