]> source.dussan.org Git - jquery-ui.git/commitdiff
Tabs: Removed back-compat for load event. Fixes #8731 - Tabs: Remove back-compat...
authorScott González <scott.gonzalez@gmail.com>
Thu, 25 Oct 2012 09:59:20 +0000 (05:59 -0400)
committerScott González <scott.gonzalez@gmail.com>
Thu, 25 Oct 2012 09:59:20 +0000 (05:59 -0400)
tests/unit/tabs/tabs_deprecated.js
tests/unit/tabs/tabs_events.js
tests/unit/tabs/tabs_methods.js
ui/jquery.ui.tabs.js

index bc2caab29dd99a468fd903c79d297c9d9a7a9a0b..9d359949486c2eb35a800e33fab7e32808797754 100644 (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() {
index 57011bdad8be0c6a467fb7a86b0dbd776181f266..f9b1755f778a7e7f0bbb30e5d01f6e093ce78950 100644 (file)
@@ -253,16 +253,33 @@ test( "beforeLoad", function() {
        equal( panel.html().toLowerCase(), "<p>testing</p>", "panel html after" );
 });
 
-if ( $.uiBackCompat === false ) {
-       asyncTest( "load", function() {
-               expect( 21 );
+asyncTest( "load", function() {
+       expect( 21 );
 
-               var tab, panelId, panel,
-                       element = $( "#tabs2" );
+       var tab, panelId, panel,
+               element = $( "#tabs2" );
+
+       // init
+       element.one( "tabsload", function( event, ui ) {
+               tab = element.find( ".ui-tabs-nav li" ).eq( 2 );
+               panelId = tab.attr( "aria-controls" );
+               panel = $( "#" + panelId );
+
+               ok( !( "originalEvent" in event ), "originalEvent" );
+               equal( ui.tab.length, 1, "tab length" );
+               strictEqual( ui.tab[ 0 ], tab[ 0 ], "tab" );
+               equal( ui.panel.length, 1, "panel length" );
+               strictEqual( ui.panel[ 0 ], panel[ 0 ], "panel" );
+               equal( ui.panel.find( "p" ).length, 1, "panel html" );
+               state( element, 0, 0, 1, 0, 0 );
+               tabsload1();
+       });
+       element.tabs({ active: 2 });
 
-               // init
+       function tabsload1() {
+               // .option()
                element.one( "tabsload", function( event, ui ) {
-                       tab = element.find( ".ui-tabs-nav li" ).eq( 2 );
+                       tab = element.find( ".ui-tabs-nav li" ).eq( 3 );
                        panelId = tab.attr( "aria-controls" );
                        panel = $( "#" + panelId );
 
@@ -272,49 +289,30 @@ if ( $.uiBackCompat === false ) {
                        equal( ui.panel.length, 1, "panel length" );
                        strictEqual( ui.panel[ 0 ], panel[ 0 ], "panel" );
                        equal( ui.panel.find( "p" ).length, 1, "panel html" );
-                       state( element, 0, 0, 1, 0, 0 );
-                       tabsload1();
+                       state( element, 0, 0, 0, 1, 0 );
+                       tabsload2();
                });
-               element.tabs({ active: 2 });
-
-               function tabsload1() {
-                       // .option()
-                       element.one( "tabsload", function( event, ui ) {
-                               tab = element.find( ".ui-tabs-nav li" ).eq( 3 );
-                               panelId = tab.attr( "aria-controls" );
-                               panel = $( "#" + panelId );
-
-                               ok( !( "originalEvent" in event ), "originalEvent" );
-                               equal( ui.tab.length, 1, "tab length" );
-                               strictEqual( ui.tab[ 0 ], tab[ 0 ], "tab" );
-                               equal( ui.panel.length, 1, "panel length" );
-                               strictEqual( ui.panel[ 0 ], 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 );
-               }
+               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 );
-                               panelId = tab.attr( "aria-controls" );
-                               panel = $( "#" + panelId );
-
-                               equal( event.originalEvent.type, "click", "originalEvent" );
-                               equal( ui.tab.length, 1, "tab length" );
-                               strictEqual( ui.tab[ 0 ], tab[ 0 ], "tab" );
-                               equal( ui.panel.length, 1, "panel length" );
-                               strictEqual( ui.panel[ 0 ], 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();
-               }
-       });
-}
+       function tabsload2() {
+               // click, change panel content
+               element.one( "tabsload", function( event, ui ) {
+                       tab = element.find( ".ui-tabs-nav li" ).eq( 4 );
+                       panelId = tab.attr( "aria-controls" );
+                       panel = $( "#" + panelId );
+
+                       equal( event.originalEvent.type, "click", "originalEvent" );
+                       equal( ui.tab.length, 1, "tab length" );
+                       strictEqual( ui.tab[ 0 ], tab[ 0 ], "tab" );
+                       equal( ui.panel.length, 1, "panel length" );
+                       strictEqual( ui.panel[ 0 ], 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();
+       }
+});
 
 }( jQuery ) );
index fa6535158e3cd6aff5b52f6f0b1167b621fe1015..076c3f379dab6ed4bb80af87db81f5ff6c7070d6 100644 (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" );
-               }
+               strictEqual( uiTab[ 0 ], tab[ 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" );
-                       }
+                       strictEqual( uiTab[ 0 ], tab[ 0 ], "tab" );
                        equal( uiPanel.length, 1, "panel length" );
                        strictEqual( uiPanel[ 0 ], panel[ 0 ], "panel" );
                        state( element, 0, 0, 0, 1, 0 );
index 8d6e3bfa72740001dc11984b53862dcc315bffd1..70a827acec5bd0136f2c3ade98cdc05055a51f01 100644 (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 );