aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2011-05-09 17:38:34 -0400
committerScott González <scott.gonzalez@gmail.com>2011-05-09 17:38:34 -0400
commit0f7075e2811489a5aeba13a763be602ef1aeea72 (patch)
tree5907450c653d4472f58e6182332c2b03291a3e94 /tests
parent6a9b789bc7f3ef99036974c1c06695aef091a994 (diff)
downloadjquery-ui-0f7075e2811489a5aeba13a763be602ef1aeea72.tar.gz
jquery-ui-0f7075e2811489a5aeba13a763be602ef1aeea72.zip
Tabs: Added tests for beforeload event on init.
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/tabs/tabs_events.js30
1 files changed, 24 insertions, 6 deletions
diff --git a/tests/unit/tabs/tabs_events.js b/tests/unit/tabs/tabs_events.js
index d64005f8b..2fabaafca 100644
--- a/tests/unit/tabs/tabs_events.js
+++ b/tests/unit/tabs/tabs_events.js
@@ -138,15 +138,32 @@ test( "activate", function() {
});
test( "beforeLoad", function() {
- expect( 21 );
+ expect( 32 );
var tab, panelId, panel,
- element = $( "#tabs2" ).tabs();
+ element = $( "#tabs2" );
- // TODO: init
-// element.one( "tabsbeforeload", function( event, ui ) {
-// });
-// element.tabs({ active: 2 });
+ // init
+ element.one( "tabsbeforeload", function( event, ui ) {
+ tab = element.find( ".ui-tabs-nav a" ).eq( 2 );
+ 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" );
+ 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.html(), "", "panel html" );
+ event.preventDefault();
+ tabs_state( element, 0, 0, 1, 0, 0 );
+ });
+ element.tabs({ active: 2 });
+ tabs_state( element, 0, 0, 1, 0, 0 );
+ equals( panel.html(), "", "panel html after" );
+ element.tabs( "destroy" );
// .option()
element.one( "tabsbeforeload", function( event, ui ) {
@@ -165,6 +182,7 @@ test( "beforeLoad", function() {
event.preventDefault();
tabs_state( element, 1, 0, 0, 0, 0 );
});
+ element.tabs();
element.tabs( "option", "active", 2 );
tabs_state( element, 0, 0, 1, 0, 0 );
equals( panel.html(), "", "panel html after" );