aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJörn Zaefferer <joern.zaefferer@gmail.com>2015-09-22 13:14:25 +0200
committerScott González <scott.gonzalez@gmail.com>2015-09-25 13:47:27 -0400
commit0bfbd21d4fefa98d165b7d50277bd23be84e919a (patch)
tree5cac15ca983cfb29a27f5514fed5ffabc8ac76f9
parentef8ac2a9f2a98600a029553e45cbde42ca179066 (diff)
downloadjquery-ui-0bfbd21d4fefa98d165b7d50277bd23be84e919a.tar.gz
jquery-ui-0bfbd21d4fefa98d165b7d50277bd23be84e919a.zip
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
-rw-r--r--tests/unit/tabs/options.js2
-rw-r--r--ui/widgets/tabs.js18
2 files changed, 8 insertions, 12 deletions
diff --git a/tests/unit/tabs/options.js b/tests/unit/tabs/options.js
index f9d9857b1..4092cfcf8 100644
--- a/tests/unit/tabs/options.js
+++ b/tests/unit/tabs/options.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" );
diff --git a/ui/widgets/tabs.js b/ui/widgets/tabs.js
index ff3a64ec8..baece431d 100644
--- a/ui/widgets/tabs.js
+++ b/ui/widgets/tabs.js
@@ -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 ) {