diff options
Diffstat (limited to 'tests/unit/tabs/tabs_events.js')
-rw-r--r-- | tests/unit/tabs/tabs_events.js | 96 |
1 files changed, 49 insertions, 47 deletions
diff --git a/tests/unit/tabs/tabs_events.js b/tests/unit/tabs/tabs_events.js index 2fabaafca..12c9bb87b 100644 --- a/tests/unit/tabs/tabs_events.js +++ b/tests/unit/tabs/tabs_events.js @@ -209,66 +209,68 @@ test( "beforeLoad", function() { equals( panel.html(), "<p>testing</p>", "panel html after" ); }); -asyncTest( "load", function() { - expect( 21 ); +if ( $.uiBackCompat === false ) { + asyncTest( "load", function() { + expect( 21 ); - var tab, panelId, panel, - element = $( "#tabs2" ); - - // init - element.one( "tabsload", function( event, ui ) { - tab = element.find( ".ui-tabs-nav a" ).eq( 2 ); - panelId = tab.attr( "aria-controls" ); - panel = $( "#" + panelId ); - - ok( !( "originalEvent" in event ), "originalEvent" ); - equals( ui.tab.size(), 1, "tab size" ); - strictEqual( ui.tab[ 0 ], tab[ 0 ], "tab" ); - equals( ui.panel.size(), 1, "panel size" ); - strictEqual( ui.panel[ 0 ], panel[ 0 ], "panel" ); - equals( ui.panel.find( "p" ).length, 1, "panel html" ); - tabs_state( element, 0, 0, 1, 0, 0 ); - tabsload1(); - }); - element.tabs({ active: 2 }); + var tab, panelId, panel, + element = $( "#tabs2" ); - function tabsload1() { - // .option() + // init element.one( "tabsload", function( event, ui ) { - tab = element.find( ".ui-tabs-nav a" ).eq( 3 ); + tab = element.find( ".ui-tabs-nav a" ).eq( 2 ); panelId = tab.attr( "aria-controls" ); panel = $( "#" + panelId ); - + ok( !( "originalEvent" in event ), "originalEvent" ); equals( ui.tab.size(), 1, "tab size" ); strictEqual( ui.tab[ 0 ], tab[ 0 ], "tab" ); equals( ui.panel.size(), 1, "panel size" ); strictEqual( ui.panel[ 0 ], panel[ 0 ], "panel" ); equals( ui.panel.find( "p" ).length, 1, "panel html" ); - tabs_state( element, 0, 0, 0, 1, 0 ); - tabsload2(); + tabs_state( element, 0, 0, 1, 0, 0 ); + tabsload1(); }); - element.tabs( "option", "active", 3 ); - } + element.tabs({ active: 2 }); - function tabsload2() { - // click, change panel content - element.one( "tabsload", function( event, ui ) { - tab = element.find( ".ui-tabs-nav a" ).eq( 4 ); - panelId = tab.attr( "aria-controls" ); - panel = $( "#" + panelId ); + function tabsload1() { + // .option() + element.one( "tabsload", function( event, ui ) { + tab = element.find( ".ui-tabs-nav a" ).eq( 3 ); + panelId = tab.attr( "aria-controls" ); + panel = $( "#" + panelId ); - equals( event.originalEvent.type, "click", "originalEvent" ); - equals( ui.tab.size(), 1, "tab size" ); - strictEqual( ui.tab[ 0 ], tab[ 0 ], "tab" ); - equals( ui.panel.size(), 1, "panel size" ); - strictEqual( ui.panel[ 0 ], panel[ 0 ], "panel" ); - equals( ui.panel.find( "p" ).length, 1, "panel html" ); - tabs_state( element, 0, 0, 0, 0, 1 ); - start(); - }); - element.find( ".ui-tabs-nav a" ).eq( 4 ).click(); - } -}); + ok( !( "originalEvent" in event ), "originalEvent" ); + equals( ui.tab.size(), 1, "tab size" ); + strictEqual( ui.tab[ 0 ], tab[ 0 ], "tab" ); + equals( ui.panel.size(), 1, "panel size" ); + strictEqual( ui.panel[ 0 ], panel[ 0 ], "panel" ); + equals( ui.panel.find( "p" ).length, 1, "panel html" ); + tabs_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 a" ).eq( 4 ); + panelId = tab.attr( "aria-controls" ); + panel = $( "#" + panelId ); + + equals( event.originalEvent.type, "click", "originalEvent" ); + equals( ui.tab.size(), 1, "tab size" ); + strictEqual( ui.tab[ 0 ], tab[ 0 ], "tab" ); + equals( ui.panel.size(), 1, "panel size" ); + strictEqual( ui.panel[ 0 ], panel[ 0 ], "panel" ); + equals( ui.panel.find( "p" ).length, 1, "panel html" ); + tabs_state( element, 0, 0, 0, 0, 1 ); + start(); + }); + element.find( ".ui-tabs-nav a" ).eq( 4 ).click(); + } + }); +} }( jQuery ) ); |