mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Tabs: Removed show event. Fixes #7155 - Tabs: Remove show event.
This commit is contained in:
parent
7cf2719d0c
commit
a1fd49fb29
@ -8,7 +8,7 @@ TestHelpers.commonWidgetTests( "tabs", {
|
|||||||
hide: null,
|
hide: null,
|
||||||
idPrefix: "ui-tabs-",
|
idPrefix: "ui-tabs-",
|
||||||
panelTemplate: "<div></div>",
|
panelTemplate: "<div></div>",
|
||||||
// show: null, // conflicts with old show callback
|
show: null,
|
||||||
spinner: "<em>Loading…</em>",
|
spinner: "<em>Loading…</em>",
|
||||||
tabTemplate: "<li><a href='#{href}'><span>#{label}</span></a></li>",
|
tabTemplate: "<li><a href='#{href}'><span>#{label}</span></a></li>",
|
||||||
|
|
||||||
@ -20,7 +20,6 @@ TestHelpers.commonWidgetTests( "tabs", {
|
|||||||
create: null,
|
create: null,
|
||||||
load: null,
|
load: null,
|
||||||
remove: null,
|
remove: null,
|
||||||
select: null,
|
select: null
|
||||||
show: null
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -198,46 +198,6 @@ asyncTest( "load", function() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
test( "show", function() {
|
|
||||||
expect( 13 );
|
|
||||||
|
|
||||||
var element = $( "#tabs1" ).tabs({
|
|
||||||
active: false,
|
|
||||||
collapsible: true
|
|
||||||
}),
|
|
||||||
anchors = element.find( ".ui-tabs-nav .ui-tabs-anchor" ),
|
|
||||||
panels = element.find( ".ui-tabs-panel" );
|
|
||||||
|
|
||||||
// from collapsed
|
|
||||||
element.one( "tabsshow", function( event, ui ) {
|
|
||||||
ok( !( "originalEvent" in event ), "originalEvent" );
|
|
||||||
strictEqual( ui.tab, anchors[ 0 ], "ui.tab" );
|
|
||||||
strictEqual( ui.panel, panels[ 0 ], "ui.panel" );
|
|
||||||
equal( ui.index, 0, "ui.index" );
|
|
||||||
state( element, 1, 0, 0 );
|
|
||||||
});
|
|
||||||
element.tabs( "option", "active", 0 );
|
|
||||||
state( element, 1, 0, 0 );
|
|
||||||
|
|
||||||
// switching tabs
|
|
||||||
element.one( "tabsshow", function( event, ui ) {
|
|
||||||
equal( event.originalEvent.type, "click", "originalEvent" );
|
|
||||||
strictEqual( ui.tab, anchors[ 1 ], "ui.tab" );
|
|
||||||
strictEqual( ui.panel, panels[ 1 ], "ui.panel" );
|
|
||||||
equal( ui.index, 1, "ui.index" );
|
|
||||||
state( element, 0, 1, 0 );
|
|
||||||
});
|
|
||||||
anchors.eq( 1 ).click();
|
|
||||||
state( element, 0, 1, 0 );
|
|
||||||
|
|
||||||
// collapsing
|
|
||||||
element.one( "tabsshow", function() {
|
|
||||||
ok( false, "collapsing" );
|
|
||||||
});
|
|
||||||
element.tabs( "option", "active", false );
|
|
||||||
state( element, 0, 0, 0 );
|
|
||||||
});
|
|
||||||
|
|
||||||
test( "select", function() {
|
test( "select", function() {
|
||||||
expect( 13 );
|
expect( 13 );
|
||||||
|
|
||||||
|
17
ui/jquery.ui.tabs.js
vendored
17
ui/jquery.ui.tabs.js
vendored
@ -1046,20 +1046,11 @@ if ( $.uiBackCompat !== false ) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// show and select event
|
// select event
|
||||||
$.widget( "ui.tabs", $.ui.tabs, {
|
$.widget( "ui.tabs", $.ui.tabs, {
|
||||||
options: {
|
options: {
|
||||||
show: null,
|
|
||||||
select: null
|
select: null
|
||||||
},
|
},
|
||||||
_create: function() {
|
|
||||||
this._super();
|
|
||||||
if ( this.options.active !== false ) {
|
|
||||||
this._trigger( "show", null, this._ui(
|
|
||||||
this.active.find( ".ui-tabs-anchor" )[ 0 ],
|
|
||||||
this._getPanelForTab( this.active )[ 0 ] ) );
|
|
||||||
}
|
|
||||||
},
|
|
||||||
_trigger: function( type, event, data ) {
|
_trigger: function( type, event, data ) {
|
||||||
var ret = this._superApply( arguments );
|
var ret = this._superApply( arguments );
|
||||||
if ( !ret ) {
|
if ( !ret ) {
|
||||||
@ -1071,12 +1062,6 @@ if ( $.uiBackCompat !== false ) {
|
|||||||
panel: data.newPanel[ 0 ],
|
panel: data.newPanel[ 0 ],
|
||||||
index: data.newTab.closest( "li" ).index()
|
index: data.newTab.closest( "li" ).index()
|
||||||
});
|
});
|
||||||
} else if ( type === "activate" && data.newTab.length ) {
|
|
||||||
ret = this._super( "show", event, {
|
|
||||||
tab: data.newTab.find( ".ui-tabs-anchor" )[ 0 ],
|
|
||||||
panel: data.newPanel[ 0 ],
|
|
||||||
index: data.newTab.closest( "li" ).index()
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user