mirror of
https://github.com/jquery/jquery-ui.git
synced 2025-01-07 20:34:24 +00:00
Tabs: Removed enable and disable events. Fixes #7160 - Tabs: Remove enable and disable events.
This commit is contained in:
parent
1a7958a430
commit
0fc682a8da
@ -18,8 +18,6 @@ TestHelpers.commonWidgetTests( "tabs", {
|
||||
beforeActivate: null,
|
||||
beforeLoad: null,
|
||||
create: null,
|
||||
disable: null,
|
||||
enable: null,
|
||||
load: null,
|
||||
remove: null,
|
||||
select: null,
|
||||
|
@ -198,38 +198,6 @@ asyncTest( "load", function() {
|
||||
}
|
||||
});
|
||||
|
||||
test( "enable", function() {
|
||||
expect( 3 );
|
||||
|
||||
var element = $( "#tabs1" ).tabs({
|
||||
disabled: [ 0, 1 ],
|
||||
enable: function( event, ui ) {
|
||||
equal( ui.tab, element.find( ".ui-tabs-nav .ui-tabs-anchor" )[ 1 ], "ui.tab" );
|
||||
equal( ui.panel, element.find( ".ui-tabs-panel" )[ 1 ], "ui.panel" );
|
||||
equal( ui.index, 1, "ui.index" );
|
||||
}
|
||||
});
|
||||
element.tabs( "enable", 1 );
|
||||
// shouldn't trigger event
|
||||
element.tabs( "enable", 2 );
|
||||
});
|
||||
|
||||
test( "disable", function() {
|
||||
expect( 3 );
|
||||
|
||||
var element = $( "#tabs1" ).tabs({
|
||||
disable: function( event, ui ) {
|
||||
equal( ui.tab, element.find( ".ui-tabs-nav .ui-tabs-anchor" )[ 1 ], "ui.tab" );
|
||||
equal( ui.panel, element.find( ".ui-tabs-panel" )[ 1 ], "ui.panel" );
|
||||
equal( ui.index, 1, "ui.index" );
|
||||
}
|
||||
});
|
||||
element.tabs( "disable", 1 );
|
||||
// shouldn't trigger event
|
||||
element.tabs( "disable", 1 );
|
||||
});
|
||||
|
||||
|
||||
test( "show", function() {
|
||||
expect( 13 );
|
||||
|
||||
|
40
ui/jquery.ui.tabs.js
vendored
40
ui/jquery.ui.tabs.js
vendored
@ -889,46 +889,6 @@ if ( $.uiBackCompat !== false ) {
|
||||
}
|
||||
});
|
||||
|
||||
// enable/disable events
|
||||
$.widget( "ui.tabs", $.ui.tabs, {
|
||||
options: {
|
||||
enable: null,
|
||||
disable: null
|
||||
},
|
||||
|
||||
enable: function( index ) {
|
||||
var options = this.options,
|
||||
trigger;
|
||||
|
||||
if ( index && options.disabled === true ||
|
||||
( $.isArray( options.disabled ) && $.inArray( index, options.disabled ) !== -1 ) ) {
|
||||
trigger = true;
|
||||
}
|
||||
|
||||
this._superApply( arguments );
|
||||
|
||||
if ( trigger ) {
|
||||
this._trigger( "enable", null, this._ui( this.anchors[ index ], this.panels[ index ] ) );
|
||||
}
|
||||
},
|
||||
|
||||
disable: function( index ) {
|
||||
var options = this.options,
|
||||
trigger;
|
||||
|
||||
if ( index && options.disabled === false ||
|
||||
( $.isArray( options.disabled ) && $.inArray( index, options.disabled ) === -1 ) ) {
|
||||
trigger = true;
|
||||
}
|
||||
|
||||
this._superApply( arguments );
|
||||
|
||||
if ( trigger ) {
|
||||
this._trigger( "disable", null, this._ui( this.anchors[ index ], this.panels[ index ] ) );
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// add/remove methods and events
|
||||
$.widget( "ui.tabs", $.ui.tabs, {
|
||||
options: {
|
||||
|
Loading…
Reference in New Issue
Block a user