2015-04-06 19:01:13 +00:00
|
|
|
define( [
|
|
|
|
"jquery",
|
2015-04-07 14:55:52 +00:00
|
|
|
"./helper",
|
2015-07-15 02:11:35 +00:00
|
|
|
"ui/widgets/tabs"
|
2015-04-07 14:30:07 +00:00
|
|
|
], function( $, testHelper ) {
|
2011-04-04 15:22:32 +00:00
|
|
|
|
2015-04-07 14:30:07 +00:00
|
|
|
var state = testHelper.state;
|
2012-04-19 16:53:06 +00:00
|
|
|
|
2011-04-04 15:22:32 +00:00
|
|
|
module( "tabs: events" );
|
|
|
|
|
2012-01-21 13:46:02 +00:00
|
|
|
test( "create", function() {
|
|
|
|
expect( 10 );
|
|
|
|
|
|
|
|
var element = $( "#tabs1" ),
|
2012-05-18 20:11:14 +00:00
|
|
|
tabs = element.find( "ul li" ),
|
2012-01-21 13:46:02 +00:00
|
|
|
panels = element.children( "div" );
|
|
|
|
|
2015-08-24 12:57:25 +00:00
|
|
|
element.tabs( {
|
2012-01-21 13:46:02 +00:00
|
|
|
create: function( event, ui ) {
|
2012-04-23 18:25:23 +00:00
|
|
|
equal( ui.tab.length, 1, "tab length" );
|
2012-01-21 13:46:02 +00:00
|
|
|
strictEqual( ui.tab[ 0 ], tabs[ 0 ], "tab" );
|
2012-04-23 18:25:23 +00:00
|
|
|
equal( ui.panel.length, 1, "panel length" );
|
2012-01-21 13:46:02 +00:00
|
|
|
strictEqual( ui.panel[ 0 ], panels[ 0 ], "panel" );
|
|
|
|
}
|
2015-08-24 12:57:25 +00:00
|
|
|
} );
|
2012-01-21 13:46:02 +00:00
|
|
|
element.tabs( "destroy" );
|
|
|
|
|
2015-08-24 12:57:25 +00:00
|
|
|
element.tabs( {
|
2012-01-21 13:46:02 +00:00
|
|
|
active: 2,
|
|
|
|
create: function( event, ui ) {
|
2012-04-23 18:25:23 +00:00
|
|
|
equal( ui.tab.length, 1, "tab length" );
|
2012-01-21 13:46:02 +00:00
|
|
|
strictEqual( ui.tab[ 0 ], tabs[ 2 ], "tab" );
|
2012-04-23 18:25:23 +00:00
|
|
|
equal( ui.panel.length, 1, "panel length" );
|
2012-01-21 13:46:02 +00:00
|
|
|
strictEqual( ui.panel[ 0 ], panels[ 2 ], "panel" );
|
|
|
|
}
|
2015-08-24 12:57:25 +00:00
|
|
|
} );
|
2012-01-21 13:46:02 +00:00
|
|
|
element.tabs( "destroy" );
|
|
|
|
|
2015-08-24 12:57:25 +00:00
|
|
|
element.tabs( {
|
2012-01-21 13:46:02 +00:00
|
|
|
active: false,
|
|
|
|
collapsible: true,
|
|
|
|
create: function( event, ui ) {
|
2012-04-23 18:25:23 +00:00
|
|
|
equal( ui.tab.length, 0, "tab length" );
|
|
|
|
equal( ui.panel.length, 0, "panel length" );
|
2012-01-21 13:46:02 +00:00
|
|
|
}
|
2015-08-24 12:57:25 +00:00
|
|
|
} );
|
2012-01-21 13:46:02 +00:00
|
|
|
element.tabs( "destroy" );
|
2015-08-24 12:57:25 +00:00
|
|
|
} );
|
2012-01-21 13:46:02 +00:00
|
|
|
|
2011-04-04 15:22:32 +00:00
|
|
|
test( "beforeActivate", function() {
|
2011-04-04 18:27:38 +00:00
|
|
|
expect( 38 );
|
2011-04-04 15:22:32 +00:00
|
|
|
|
2015-08-24 12:57:25 +00:00
|
|
|
var element = $( "#tabs1" ).tabs( {
|
2011-04-05 20:53:52 +00:00
|
|
|
active: false,
|
2011-04-04 15:22:32 +00:00
|
|
|
collapsible: true
|
2015-08-24 12:57:25 +00:00
|
|
|
} ),
|
2012-05-18 20:11:14 +00:00
|
|
|
tabs = element.find( ".ui-tabs-nav li" ),
|
|
|
|
anchors = tabs.find( ".ui-tabs-anchor" ),
|
2011-04-04 15:22:32 +00:00
|
|
|
panels = element.find( ".ui-tabs-panel" );
|
|
|
|
|
2015-08-21 04:04:44 +00:00
|
|
|
// From collapsed
|
2011-04-04 15:22:32 +00:00
|
|
|
element.one( "tabsbeforeactivate", function( event, ui ) {
|
2011-04-05 20:53:52 +00:00
|
|
|
ok( !( "originalEvent" in event ), "originalEvent" );
|
2012-04-23 18:25:23 +00:00
|
|
|
equal( ui.oldTab.length, 0, "oldTab length" );
|
|
|
|
equal( ui.oldPanel.length, 0, "oldPanel length" );
|
|
|
|
equal( ui.newTab.length, 1, "newTab length" );
|
2011-04-05 20:53:52 +00:00
|
|
|
strictEqual( ui.newTab[ 0 ], tabs[ 0 ], "newTab" );
|
2012-04-23 18:25:23 +00:00
|
|
|
equal( ui.newPanel.length, 1, "newPanel length" );
|
2011-04-05 20:53:52 +00:00
|
|
|
strictEqual( ui.newPanel[ 0 ], panels[ 0 ], "newPanel" );
|
2012-04-19 16:53:06 +00:00
|
|
|
state( element, 0, 0, 0 );
|
2015-08-24 12:57:25 +00:00
|
|
|
} );
|
2011-04-04 15:22:32 +00:00
|
|
|
element.tabs( "option", "active", 0 );
|
2012-04-19 16:53:06 +00:00
|
|
|
state( element, 1, 0, 0 );
|
2011-02-08 00:32:32 +00:00
|
|
|
|
2015-08-21 04:04:44 +00:00
|
|
|
// Switching tabs
|
2011-04-04 15:22:32 +00:00
|
|
|
element.one( "tabsbeforeactivate", function( event, ui ) {
|
2012-02-28 14:56:32 +00:00
|
|
|
equal( event.originalEvent.type, "click", "originalEvent" );
|
2012-04-23 18:25:23 +00:00
|
|
|
equal( ui.oldTab.length, 1, "oldTab length" );
|
2011-04-05 20:53:52 +00:00
|
|
|
strictEqual( ui.oldTab[ 0 ], tabs[ 0 ], "oldTab" );
|
2012-04-23 18:25:23 +00:00
|
|
|
equal( ui.oldPanel.length, 1, "oldPanel length" );
|
2011-04-05 20:53:52 +00:00
|
|
|
strictEqual( ui.oldPanel[ 0 ], panels[ 0 ], "oldPanel" );
|
2012-04-23 18:25:23 +00:00
|
|
|
equal( ui.newTab.length, 1, "newTab length" );
|
2011-04-05 20:53:52 +00:00
|
|
|
strictEqual( ui.newTab[ 0 ], tabs[ 1 ], "newTab" );
|
2012-04-23 18:25:23 +00:00
|
|
|
equal( ui.newPanel.length, 1, "newPanel length" );
|
2011-04-05 20:53:52 +00:00
|
|
|
strictEqual( ui.newPanel[ 0 ], panels[ 1 ], "newPanel" );
|
2012-04-19 16:53:06 +00:00
|
|
|
state( element, 1, 0, 0 );
|
2015-08-24 12:57:25 +00:00
|
|
|
} );
|
2015-05-14 02:01:58 +00:00
|
|
|
anchors.eq( 1 ).trigger( "click" );
|
2012-04-19 16:53:06 +00:00
|
|
|
state( element, 0, 1, 0 );
|
2011-04-04 15:22:32 +00:00
|
|
|
|
2015-08-21 04:04:44 +00:00
|
|
|
// Collapsing
|
2011-04-04 15:22:32 +00:00
|
|
|
element.one( "tabsbeforeactivate", function( event, ui ) {
|
2011-04-05 20:53:52 +00:00
|
|
|
ok( !( "originalEvent" in event ), "originalEvent" );
|
2012-04-23 18:25:23 +00:00
|
|
|
equal( ui.oldTab.length, 1, "oldTab length" );
|
2011-04-05 20:53:52 +00:00
|
|
|
strictEqual( ui.oldTab[ 0 ], tabs[ 1 ], "oldTab" );
|
2012-04-23 18:25:23 +00:00
|
|
|
equal( ui.oldPanel.length, 1, "oldPanel length" );
|
2011-04-05 20:53:52 +00:00
|
|
|
strictEqual( ui.oldPanel[ 0 ], panels[ 1 ], "oldPanel" );
|
2012-04-23 18:25:23 +00:00
|
|
|
equal( ui.newTab.length, 0, "newTab length" );
|
|
|
|
equal( ui.newPanel.length, 0, "newPanel length" );
|
2012-04-19 16:53:06 +00:00
|
|
|
state( element, 0, 1, 0 );
|
2015-08-24 12:57:25 +00:00
|
|
|
} );
|
2011-04-04 15:22:32 +00:00
|
|
|
element.tabs( "option", "active", false );
|
2012-04-19 16:53:06 +00:00
|
|
|
state( element, 0, 0, 0 );
|
2011-04-04 18:27:38 +00:00
|
|
|
|
2015-08-21 04:04:44 +00:00
|
|
|
// Prevent activation
|
2011-04-04 18:27:38 +00:00
|
|
|
element.one( "tabsbeforeactivate", function( event, ui ) {
|
2011-04-05 20:53:52 +00:00
|
|
|
ok( !( "originalEvent" in event ), "originalEvent" );
|
2012-04-23 18:25:23 +00:00
|
|
|
equal( ui.oldTab.length, 0, "oldTab length" );
|
|
|
|
equal( ui.oldPanel.length, 0, "oldTab" );
|
|
|
|
equal( ui.newTab.length, 1, "newTab length" );
|
2011-04-05 20:53:52 +00:00
|
|
|
strictEqual( ui.newTab[ 0 ], tabs[ 1 ], "newTab" );
|
2012-04-23 18:25:23 +00:00
|
|
|
equal( ui.newPanel.length, 1, "newPanel length" );
|
2011-04-05 20:53:52 +00:00
|
|
|
strictEqual( ui.newPanel[ 0 ], panels[ 1 ], "newPanel" );
|
2011-04-04 18:27:38 +00:00
|
|
|
event.preventDefault();
|
2012-04-19 16:53:06 +00:00
|
|
|
state( element, 0, 0, 0 );
|
2015-08-24 12:57:25 +00:00
|
|
|
} );
|
2011-04-04 18:27:38 +00:00
|
|
|
element.tabs( "option", "active", 1 );
|
2012-04-19 16:53:06 +00:00
|
|
|
state( element, 0, 0, 0 );
|
2015-08-24 12:57:25 +00:00
|
|
|
} );
|
2009-02-03 13:37:54 +00:00
|
|
|
|
2011-04-04 19:28:33 +00:00
|
|
|
test( "activate", function() {
|
|
|
|
expect( 30 );
|
|
|
|
|
2015-08-24 12:57:25 +00:00
|
|
|
var element = $( "#tabs1" ).tabs( {
|
2011-04-05 20:53:52 +00:00
|
|
|
active: false,
|
2011-04-04 19:28:33 +00:00
|
|
|
collapsible: true
|
2015-08-24 12:57:25 +00:00
|
|
|
} ),
|
2012-05-18 20:11:14 +00:00
|
|
|
tabs = element.find( ".ui-tabs-nav li" ),
|
|
|
|
anchors = element.find( ".ui-tabs-anchor" ),
|
2011-04-04 19:28:33 +00:00
|
|
|
panels = element.find( ".ui-tabs-panel" );
|
|
|
|
|
2015-08-21 04:04:44 +00:00
|
|
|
// From collapsed
|
2011-04-04 19:28:33 +00:00
|
|
|
element.one( "tabsactivate", function( event, ui ) {
|
2011-04-05 20:53:52 +00:00
|
|
|
ok( !( "originalEvent" in event ), "originalEvent" );
|
2012-04-23 18:25:23 +00:00
|
|
|
equal( ui.oldTab.length, 0, "oldTab length" );
|
|
|
|
equal( ui.oldPanel.length, 0, "oldPanel length" );
|
|
|
|
equal( ui.newTab.length, 1, "newTab length" );
|
2011-04-05 20:53:52 +00:00
|
|
|
strictEqual( ui.newTab[ 0 ], tabs[ 0 ], "newTab" );
|
2012-04-23 18:25:23 +00:00
|
|
|
equal( ui.newPanel.length, 1, "newPanel length" );
|
2011-04-05 20:53:52 +00:00
|
|
|
strictEqual( ui.newPanel[ 0 ], panels[ 0 ], "newPanel" );
|
2012-04-19 16:53:06 +00:00
|
|
|
state( element, 1, 0, 0 );
|
2015-08-24 12:57:25 +00:00
|
|
|
} );
|
2011-04-04 19:28:33 +00:00
|
|
|
element.tabs( "option", "active", 0 );
|
2012-04-19 16:53:06 +00:00
|
|
|
state( element, 1, 0, 0 );
|
2011-04-04 19:28:33 +00:00
|
|
|
|
2015-08-21 04:04:44 +00:00
|
|
|
// Switching tabs
|
2011-04-04 19:28:33 +00:00
|
|
|
element.one( "tabsactivate", function( event, ui ) {
|
2012-02-28 14:56:32 +00:00
|
|
|
equal( event.originalEvent.type, "click", "originalEvent" );
|
2012-04-23 18:25:23 +00:00
|
|
|
equal( ui.oldTab.length, 1, "oldTab length" );
|
2011-04-05 20:53:52 +00:00
|
|
|
strictEqual( ui.oldTab[ 0 ], tabs[ 0 ], "oldTab" );
|
2012-04-23 18:25:23 +00:00
|
|
|
equal( ui.oldPanel.length, 1, "oldPanel length" );
|
2011-04-05 20:53:52 +00:00
|
|
|
strictEqual( ui.oldPanel[ 0 ], panels[ 0 ], "oldPanel" );
|
2012-04-23 18:25:23 +00:00
|
|
|
equal( ui.newTab.length, 1, "newTab length" );
|
2011-04-05 20:53:52 +00:00
|
|
|
strictEqual( ui.newTab[ 0 ], tabs[ 1 ], "newTab" );
|
2012-04-23 18:25:23 +00:00
|
|
|
equal( ui.newPanel.length, 1, "newPanel length" );
|
2011-04-05 20:53:52 +00:00
|
|
|
strictEqual( ui.newPanel[ 0 ], panels[ 1 ], "newPanel" );
|
2012-04-19 16:53:06 +00:00
|
|
|
state( element, 0, 1, 0 );
|
2015-08-24 12:57:25 +00:00
|
|
|
} );
|
2015-05-14 02:01:58 +00:00
|
|
|
anchors.eq( 1 ).trigger( "click" );
|
2012-04-19 16:53:06 +00:00
|
|
|
state( element, 0, 1, 0 );
|
2011-04-04 19:28:33 +00:00
|
|
|
|
2015-08-21 04:04:44 +00:00
|
|
|
// Collapsing
|
2011-04-04 19:28:33 +00:00
|
|
|
element.one( "tabsactivate", function( event, ui ) {
|
2011-04-05 20:53:52 +00:00
|
|
|
ok( !( "originalEvent" in event ), "originalEvent" );
|
2012-04-23 18:25:23 +00:00
|
|
|
equal( ui.oldTab.length, 1, "oldTab length" );
|
2011-04-05 20:53:52 +00:00
|
|
|
strictEqual( ui.oldTab[ 0 ], tabs[ 1 ], "oldTab" );
|
2012-04-23 18:25:23 +00:00
|
|
|
equal( ui.oldPanel.length, 1, "oldPanel length" );
|
2011-04-05 20:53:52 +00:00
|
|
|
strictEqual( ui.oldPanel[ 0 ], panels[ 1 ], "oldPanel" );
|
2012-04-23 18:25:23 +00:00
|
|
|
equal( ui.newTab.length, 0, "newTab length" );
|
|
|
|
equal( ui.newPanel.length, 0, "newPanel length" );
|
2012-04-19 16:53:06 +00:00
|
|
|
state( element, 0, 0, 0 );
|
2015-08-24 12:57:25 +00:00
|
|
|
} );
|
2011-04-04 19:28:33 +00:00
|
|
|
element.tabs( "option", "active", false );
|
2012-04-19 16:53:06 +00:00
|
|
|
state( element, 0, 0, 0 );
|
2011-04-04 19:28:33 +00:00
|
|
|
|
2015-08-21 04:04:44 +00:00
|
|
|
// Prevent activation
|
2011-04-04 19:28:33 +00:00
|
|
|
element.one( "tabsbeforeactivate", function( event ) {
|
2011-04-05 20:53:52 +00:00
|
|
|
ok( true, "tabsbeforeactivate" );
|
2011-04-04 19:28:33 +00:00
|
|
|
event.preventDefault();
|
2015-08-24 12:57:25 +00:00
|
|
|
} );
|
2011-04-04 19:28:33 +00:00
|
|
|
element.one( "tabsactivate", function() {
|
2011-04-05 20:53:52 +00:00
|
|
|
ok( false, "tabsactivate" );
|
2015-08-24 12:57:25 +00:00
|
|
|
} );
|
2011-04-04 19:28:33 +00:00
|
|
|
element.tabs( "option", "active", 1 );
|
2015-08-24 12:57:25 +00:00
|
|
|
} );
|
2011-04-04 19:28:33 +00:00
|
|
|
|
2011-04-04 21:06:13 +00:00
|
|
|
test( "beforeLoad", function() {
|
2011-05-09 21:38:34 +00:00
|
|
|
expect( 32 );
|
2011-04-05 15:28:05 +00:00
|
|
|
|
|
|
|
var tab, panelId, panel,
|
2011-05-09 21:38:34 +00:00
|
|
|
element = $( "#tabs2" );
|
2011-04-05 15:28:05 +00:00
|
|
|
|
2015-08-21 04:04:44 +00:00
|
|
|
// Init
|
2011-05-09 21:38:34 +00:00
|
|
|
element.one( "tabsbeforeload", function( event, ui ) {
|
2012-05-18 20:11:14 +00:00
|
|
|
tab = element.find( ".ui-tabs-nav li" ).eq( 2 );
|
2011-05-09 21:38:34 +00:00
|
|
|
panelId = tab.attr( "aria-controls" );
|
|
|
|
panel = $( "#" + panelId );
|
|
|
|
|
|
|
|
ok( !( "originalEvent" in event ), "originalEvent" );
|
|
|
|
ok( "abort" in ui.jqXHR, "jqXHR" );
|
|
|
|
ok( ui.ajaxSettings.url, "data/test.html", "ajaxSettings.url" );
|
2012-04-23 18:25:23 +00:00
|
|
|
equal( ui.tab.length, 1, "tab length" );
|
2011-05-09 21:38:34 +00:00
|
|
|
strictEqual( ui.tab[ 0 ], tab[ 0 ], "tab" );
|
2012-04-23 18:25:23 +00:00
|
|
|
equal( ui.panel.length, 1, "panel length" );
|
2011-05-09 21:38:34 +00:00
|
|
|
strictEqual( ui.panel[ 0 ], panel[ 0 ], "panel" );
|
2012-02-28 14:56:32 +00:00
|
|
|
equal( ui.panel.html(), "", "panel html" );
|
2011-05-09 21:38:34 +00:00
|
|
|
event.preventDefault();
|
2012-04-19 16:53:06 +00:00
|
|
|
state( element, 0, 0, 1, 0, 0 );
|
2015-08-24 12:57:25 +00:00
|
|
|
} );
|
|
|
|
element.tabs( { active: 2 } );
|
2012-04-19 16:53:06 +00:00
|
|
|
state( element, 0, 0, 1, 0, 0 );
|
2012-02-28 14:56:32 +00:00
|
|
|
equal( panel.html(), "", "panel html after" );
|
2011-05-09 21:38:34 +00:00
|
|
|
element.tabs( "destroy" );
|
2011-04-05 15:28:05 +00:00
|
|
|
|
|
|
|
// .option()
|
|
|
|
element.one( "tabsbeforeload", function( event, ui ) {
|
2012-05-18 20:11:14 +00:00
|
|
|
tab = element.find( ".ui-tabs-nav li" ).eq( 2 );
|
2011-04-05 15:28:05 +00:00
|
|
|
panelId = tab.attr( "aria-controls" );
|
|
|
|
panel = $( "#" + panelId );
|
|
|
|
|
|
|
|
ok( !( "originalEvent" in event ), "originalEvent" );
|
|
|
|
ok( "abort" in ui.jqXHR, "jqXHR" );
|
|
|
|
ok( ui.ajaxSettings.url, "data/test.html", "ajaxSettings.url" );
|
2012-04-23 18:25:23 +00:00
|
|
|
equal( ui.tab.length, 1, "tab length" );
|
2011-04-05 15:28:05 +00:00
|
|
|
strictEqual( ui.tab[ 0 ], tab[ 0 ], "tab" );
|
2012-04-23 18:25:23 +00:00
|
|
|
equal( ui.panel.length, 1, "panel length" );
|
2011-04-05 15:28:05 +00:00
|
|
|
strictEqual( ui.panel[ 0 ], panel[ 0 ], "panel" );
|
2012-02-28 14:56:32 +00:00
|
|
|
equal( ui.panel.html(), "", "panel html" );
|
2011-04-05 15:28:05 +00:00
|
|
|
event.preventDefault();
|
2012-04-19 16:53:06 +00:00
|
|
|
state( element, 1, 0, 0, 0, 0 );
|
2015-08-24 12:57:25 +00:00
|
|
|
} );
|
2011-05-09 21:38:34 +00:00
|
|
|
element.tabs();
|
2011-04-05 15:28:05 +00:00
|
|
|
element.tabs( "option", "active", 2 );
|
2012-04-19 16:53:06 +00:00
|
|
|
state( element, 0, 0, 1, 0, 0 );
|
2012-02-28 14:56:32 +00:00
|
|
|
equal( panel.html(), "", "panel html after" );
|
2011-04-05 15:28:05 +00:00
|
|
|
|
2015-08-21 04:04:44 +00:00
|
|
|
// Click, change panel content
|
2011-04-05 15:28:05 +00:00
|
|
|
element.one( "tabsbeforeload", function( event, ui ) {
|
2012-05-18 20:11:14 +00:00
|
|
|
tab = element.find( ".ui-tabs-nav li" ).eq( 3 );
|
2011-04-05 15:28:05 +00:00
|
|
|
panelId = tab.attr( "aria-controls" );
|
|
|
|
panel = $( "#" + panelId );
|
|
|
|
|
2012-02-28 14:56:32 +00:00
|
|
|
equal( event.originalEvent.type, "click", "originalEvent" );
|
2011-04-05 15:28:05 +00:00
|
|
|
ok( "abort" in ui.jqXHR, "jqXHR" );
|
|
|
|
ok( ui.ajaxSettings.url, "data/test.html", "ajaxSettings.url" );
|
2012-04-23 18:25:23 +00:00
|
|
|
equal( ui.tab.length, 1, "tab length" );
|
2011-04-05 15:28:05 +00:00
|
|
|
strictEqual( ui.tab[ 0 ], tab[ 0 ], "tab" );
|
2012-04-23 18:25:23 +00:00
|
|
|
equal( ui.panel.length, 1, "panel length" );
|
2011-04-05 15:28:05 +00:00
|
|
|
strictEqual( ui.panel[ 0 ], panel[ 0 ], "panel" );
|
|
|
|
ui.panel.html( "<p>testing</p>" );
|
|
|
|
event.preventDefault();
|
2012-04-19 16:53:06 +00:00
|
|
|
state( element, 0, 0, 1, 0, 0 );
|
2015-08-24 12:57:25 +00:00
|
|
|
} );
|
2015-05-14 02:01:58 +00:00
|
|
|
element.find( ".ui-tabs-nav .ui-tabs-anchor" ).eq( 3 ).trigger( "click" );
|
2012-04-19 16:53:06 +00:00
|
|
|
state( element, 0, 0, 0, 1, 0 );
|
2015-08-24 12:57:25 +00:00
|
|
|
|
2011-10-10 19:34:47 +00:00
|
|
|
// .toLowerCase() is needed to convert <P> to <p> in old IEs
|
2012-02-28 14:56:32 +00:00
|
|
|
equal( panel.html().toLowerCase(), "<p>testing</p>", "panel html after" );
|
2015-08-24 12:57:25 +00:00
|
|
|
} );
|
2011-03-26 19:00:39 +00:00
|
|
|
|
2012-10-25 09:59:20 +00:00
|
|
|
asyncTest( "load", function() {
|
|
|
|
expect( 21 );
|
2011-05-09 19:42:24 +00:00
|
|
|
|
2012-10-25 09:59:20 +00:00
|
|
|
var tab, panelId, panel,
|
|
|
|
element = $( "#tabs2" );
|
|
|
|
|
2015-08-21 04:04:44 +00:00
|
|
|
// Init
|
2012-10-25 09:59:20 +00:00
|
|
|
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();
|
2015-08-24 12:57:25 +00:00
|
|
|
} );
|
|
|
|
element.tabs( { active: 2 } );
|
2011-05-09 19:42:24 +00:00
|
|
|
|
2012-10-25 09:59:20 +00:00
|
|
|
function tabsload1() {
|
2015-08-24 12:57:25 +00:00
|
|
|
|
2012-10-25 09:59:20 +00:00
|
|
|
// .option()
|
2011-05-09 19:42:24 +00:00
|
|
|
element.one( "tabsload", function( event, ui ) {
|
2012-10-25 09:59:20 +00:00
|
|
|
tab = element.find( ".ui-tabs-nav li" ).eq( 3 );
|
2011-05-09 19:42:24 +00:00
|
|
|
panelId = tab.attr( "aria-controls" );
|
|
|
|
panel = $( "#" + panelId );
|
2012-02-28 14:56:32 +00:00
|
|
|
|
2011-05-09 19:42:24 +00:00
|
|
|
ok( !( "originalEvent" in event ), "originalEvent" );
|
2012-04-23 18:25:23 +00:00
|
|
|
equal( ui.tab.length, 1, "tab length" );
|
2011-05-09 19:42:24 +00:00
|
|
|
strictEqual( ui.tab[ 0 ], tab[ 0 ], "tab" );
|
2012-04-23 18:25:23 +00:00
|
|
|
equal( ui.panel.length, 1, "panel length" );
|
2011-05-09 19:42:24 +00:00
|
|
|
strictEqual( ui.panel[ 0 ], panel[ 0 ], "panel" );
|
2012-02-28 14:56:32 +00:00
|
|
|
equal( ui.panel.find( "p" ).length, 1, "panel html" );
|
2012-10-25 09:59:20 +00:00
|
|
|
state( element, 0, 0, 0, 1, 0 );
|
|
|
|
tabsload2();
|
2015-08-24 12:57:25 +00:00
|
|
|
} );
|
2012-10-25 09:59:20 +00:00
|
|
|
element.tabs( "option", "active", 3 );
|
|
|
|
}
|
2011-05-17 19:46:41 +00:00
|
|
|
|
2012-10-25 09:59:20 +00:00
|
|
|
function tabsload2() {
|
2015-08-24 12:57:25 +00:00
|
|
|
|
2012-10-25 09:59:20 +00:00
|
|
|
// 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();
|
2015-08-24 12:57:25 +00:00
|
|
|
} );
|
2015-05-14 02:01:58 +00:00
|
|
|
element.find( ".ui-tabs-nav .ui-tabs-anchor" ).eq( 4 ).trigger( "click" );
|
2012-10-25 09:59:20 +00:00
|
|
|
}
|
2015-08-24 12:57:25 +00:00
|
|
|
} );
|
2009-02-03 13:37:54 +00:00
|
|
|
|
2015-04-06 19:01:13 +00:00
|
|
|
} );
|