Tabs: Removed back-compat for load event. Fixes #8731 - Tabs: Remove back-compat for load event.

This commit is contained in:
Scott González 2012-10-25 05:59:20 -04:00
parent 828b3c420c
commit 3d6c2a66d4
4 changed files with 48 additions and 131 deletions

View File

@ -66,67 +66,6 @@ test( "tabTemplate + panelTemplate", function() {
ok( element.find( "#new" ).hasClass( "customPanel" ), "panel custom class" );
});
module( "tabs (deprecated): events" );
asyncTest( "load", function() {
expect( 15 );
var tab, anchor, panelId, panel,
element = $( "#tabs2" );
// init
element.one( "tabsload", function( event, ui ) {
tab = element.find( ".ui-tabs-nav li" ).eq( 2 );
anchor = tab.find( ".ui-tabs-anchor" );
panelId = tab.attr( "aria-controls" );
panel = $( "#" + panelId );
ok( !( "originalEvent" in event ), "originalEvent" );
strictEqual( ui.tab, anchor[ 0 ], "tab" );
strictEqual( ui.panel, panel[ 0 ], "panel" );
equal( $( ui.panel ).find( "p" ).length, 1, "panel html" );
state( element, 0, 0, 1, 0, 0 );
tabsload1();
});
element.tabs({ active: 2 });
function tabsload1() {
// .option()
element.one( "tabsload", function( event, ui ) {
tab = element.find( ".ui-tabs-nav li" ).eq( 3 );
anchor = tab.find( ".ui-tabs-anchor" );
panelId = tab.attr( "aria-controls" );
panel = $( "#" + panelId );
ok( !( "originalEvent" in event ), "originalEvent" );
strictEqual( ui.tab, anchor[ 0 ], "tab" );
strictEqual( ui.panel, panel[ 0 ], "panel" );
equal( $( ui.panel ).find( "p" ).length, 1, "panel html" );
state( element, 0, 0, 0, 1, 0 );
tabsload2();
});
element.tabs( "option", "active", 3 );
}
function tabsload2() {
// click, change panel content
element.one( "tabsload", function( event, ui ) {
tab = element.find( ".ui-tabs-nav li" ).eq( 4 );
anchor = tab.find( ".ui-tabs-anchor" );
panelId = tab.attr( "aria-controls" );
panel = $( "#" + panelId );
equal( event.originalEvent.type, "click", "originalEvent" );
strictEqual( ui.tab, anchor[ 0 ], "tab" );
strictEqual( ui.panel, panel[ 0 ], "panel" );
equal( $( ui.panel ).find( "p" ).length, 1, "panel html" );
state( element, 0, 0, 0, 0, 1 );
start();
});
element.find( ".ui-tabs-nav .ui-tabs-anchor" ).eq( 4 ).click();
}
});
module( "tabs (deprecated): methods" );
test( "add", function() {

View File

@ -253,8 +253,7 @@ test( "beforeLoad", function() {
equal( panel.html().toLowerCase(), "<p>testing</p>", "panel html after" );
});
if ( $.uiBackCompat === false ) {
asyncTest( "load", function() {
asyncTest( "load", function() {
expect( 21 );
var tab, panelId, panel,
@ -314,7 +313,6 @@ if ( $.uiBackCompat === false ) {
});
element.find( ".ui-tabs-nav .ui-tabs-anchor" ).eq( 4 ).click();
}
});
}
});
}( jQuery ) );

View File

@ -198,11 +198,7 @@ asyncTest( "load", function() {
ok( !( "originalEvent" in event ), "originalEvent" );
equal( uiTab.length, 1, "tab length" );
if ( $.uiBackCompat === false ) {
strictEqual( uiTab[ 0 ], tab[ 0 ], "tab" );
} else {
strictEqual( uiTab[ 0 ], tab.find( ".ui-tabs-anchor" )[ 0 ], "tab" );
}
equal( uiPanel.length, 1, "panel length" );
strictEqual( uiPanel[ 0 ], panel[ 0 ], "panel" );
equal( uiPanel.find( "p" ).length, 1, "panel html" );
@ -249,11 +245,7 @@ asyncTest( "load", function() {
ok( !( "originalEvent" in event ), "originalEvent" );
equal( uiTab.length, 1, "tab length" );
if ( $.uiBackCompat === false ) {
strictEqual( uiTab[ 0 ], tab[ 0 ], "tab" );
} else {
strictEqual( uiTab[ 0 ], tab.find( ".ui-tabs-anchor" )[ 0 ], "tab" );
}
equal( uiPanel.length, 1, "panel length" );
strictEqual( uiPanel[ 0 ], panel[ 0 ], "panel" );
state( element, 0, 0, 0, 1, 0 );

12
ui/jquery.ui.tabs.js vendored
View File

@ -974,18 +974,6 @@ if ( $.uiBackCompat !== false ) {
.data( "ui-tabs-destroy", true );
}
});
// load event
$.widget( "ui.tabs", $.ui.tabs, {
_trigger: function( type, event, data ) {
var _data = $.extend( {}, data );
if ( type === "load" ) {
_data.panel = _data.panel[ 0 ];
_data.tab = _data.tab.find( ".ui-tabs-anchor" )[ 0 ];
}
return this._super( type, event, _data );
}
});
}
})( jQuery );