aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/tabs/tabs_deprecated.js
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit/tabs/tabs_deprecated.js')
-rw-r--r--tests/unit/tabs/tabs_deprecated.js90
1 files changed, 46 insertions, 44 deletions
diff --git a/tests/unit/tabs/tabs_deprecated.js b/tests/unit/tabs/tabs_deprecated.js
index c8f0e2881..8386a13ac 100644
--- a/tests/unit/tabs/tabs_deprecated.js
+++ b/tests/unit/tabs/tabs_deprecated.js
@@ -1,5 +1,7 @@
(function( $ ) {
+var state = TestHelpers.tabs.state;
+
module( "tabs (deprecated): core" );
test( "panel ids", function() {
@@ -48,17 +50,17 @@ asyncTest( "cache", function() {
cache: true
});
element.one( "tabsshow", function( event, ui ) {
- tabs_state( element, 0, 0, 1, 0, 0 );
+ state( element, 0, 0, 1, 0, 0 );
});
element.one( "tabsload", function( event, ui ) {
ok( true, "tabsload" );
setTimeout(function() {
element.tabs( "option", "active", 0 );
- tabs_state( element, 1, 0, 0, 0, 0 );
+ state( element, 1, 0, 0, 0, 0 );
element.one( "tabsshow", function( event, ui ) {
- tabs_state( element, 0, 0, 1, 0, 0 );
+ state( element, 0, 0, 1, 0, 0 );
});
element.one( "tabsload", function( event, ui ) {
ok( false, "should be cached" );
@@ -68,7 +70,7 @@ asyncTest( "cache", function() {
}, 1 );
});
element.tabs( "option", "active", 2 );
- tabs_state( element, 0, 0, 1, 0, 0 );
+ state( element, 0, 0, 1, 0, 0 );
});
test( "idPrefix", function() {
@@ -171,50 +173,50 @@ test( "selected", function() {
var element = $( "#tabs1" ).tabs();
equal( element.tabs( "option", "selected" ), 0, "should be 0 by default" );
- tabs_state( element, 1, 0, 0 );
+ state( element, 1, 0, 0 );
element.tabs( "destroy" );
location.hash = "#fragment-3";
element = $( "#tabs1" ).tabs();
equal( element.tabs( "option", "selected" ), 2, "should be 2 based on URL" );
- tabs_state( element, 0, 0, 1 );
+ state( element, 0, 0, 1 );
element.tabs( "destroy" );
el = $('#tabs1').tabs({
selected: -1,
collapsible: true
});
- tabs_state( element, 0, 0, 0 );
+ state( element, 0, 0, 0 );
equal( element.find( ".ui-tabs-nav .ui-state-active" ).size(), 0, "no tabs selected" );
strictEqual( element.tabs( "option", "selected" ), -1 );
element.tabs( "option", "collapsible", false );
- tabs_state( element, 1, 0, 0 );
+ state( element, 1, 0, 0 );
equal( element.tabs( "option", "selected" ), 0 );
element.tabs( "destroy" );
element.tabs({
selected: -1
});
- tabs_state( element, 1, 0, 0 );
+ state( element, 1, 0, 0 );
strictEqual( element.tabs( "option", "selected" ), 0 );
element.tabs( "destroy" );
element.tabs({ selected: 2 });
equal( element.tabs( "option", "selected" ), 2 );
- tabs_state( element, 0, 0, 1 );
+ state( element, 0, 0, 1 );
element.tabs( "option", "selected", 0 );
equal( element.tabs( "option", "selected" ), 0 );
- tabs_state( element, 1, 0, 0 );
+ state( element, 1, 0, 0 );
element.find( ".ui-tabs-nav a" ).eq( 1 ).click();
equal( element.tabs( "option", "selected" ), 1 );
- tabs_state( element, 0, 1, 0 );
+ state( element, 0, 1, 0 );
element.tabs( "option", "selected", 10 );
equal( element.tabs( "option", "selected" ), 1 );
- tabs_state( element, 0, 1, 0 );
+ state( element, 0, 1, 0 );
location.hash = "#";
});
@@ -237,7 +239,7 @@ asyncTest( "load", function() {
strictEqual( ui.tab, tab[ 0 ], "tab" );
strictEqual( ui.panel, panel[ 0 ], "panel" );
equal( $( ui.panel ).find( "p" ).length, 1, "panel html" );
- tabs_state( element, 0, 0, 1, 0, 0 );
+ state( element, 0, 0, 1, 0, 0 );
tabsload1();
});
element.tabs({ active: 2 });
@@ -253,7 +255,7 @@ asyncTest( "load", function() {
strictEqual( ui.tab, tab[ 0 ], "tab" );
strictEqual( ui.panel, panel[ 0 ], "panel" );
equal( $( ui.panel ).find( "p" ).length, 1, "panel html" );
- tabs_state( element, 0, 0, 0, 1, 0 );
+ state( element, 0, 0, 0, 1, 0 );
tabsload2();
});
element.tabs( "option", "active", 3 );
@@ -270,7 +272,7 @@ asyncTest( "load", function() {
strictEqual( ui.tab, tab[ 0 ], "tab" );
strictEqual( ui.panel, panel[ 0 ], "panel" );
equal( $( ui.panel ).find( "p" ).length, 1, "panel html" );
- tabs_state( element, 0, 0, 0, 0, 1 );
+ state( element, 0, 0, 0, 0, 1 );
start();
});
element.find( ".ui-tabs-nav a" ).eq( 4 ).click();
@@ -325,10 +327,10 @@ test( "show", function() {
strictEqual( ui.tab, tabs[ 0 ], "ui.tab" );
strictEqual( ui.panel, panels[ 0 ], "ui.panel" );
equal( ui.index, 0, "ui.index" );
- tabs_state( element, 1, 0, 0 );
+ state( element, 1, 0, 0 );
});
element.tabs( "option", "active", 0 );
- tabs_state( element, 1, 0, 0 );
+ state( element, 1, 0, 0 );
// switching tabs
element.one( "tabsshow", function( event, ui ) {
@@ -336,17 +338,17 @@ test( "show", function() {
strictEqual( ui.tab, tabs[ 1 ], "ui.tab" );
strictEqual( ui.panel, panels[ 1 ], "ui.panel" );
equal( ui.index, 1, "ui.index" );
- tabs_state( element, 0, 1, 0 );
+ state( element, 0, 1, 0 );
});
tabs.eq( 1 ).click();
- tabs_state( element, 0, 1, 0 );
+ state( element, 0, 1, 0 );
// collapsing
element.one( "tabsshow", function( event, ui ) {
ok( false, "collapsing" );
});
element.tabs( "option", "active", false );
- tabs_state( element, 0, 0, 0 );
+ state( element, 0, 0, 0 );
});
test( "select", function() {
@@ -365,10 +367,10 @@ test( "select", function() {
strictEqual( ui.tab, tabs[ 0 ], "ui.tab" );
strictEqual( ui.panel, panels[ 0 ], "ui.panel" );
equal( ui.index, 0, "ui.index" );
- tabs_state( element, 0, 0, 0 );
+ state( element, 0, 0, 0 );
});
element.tabs( "option", "active", 0 );
- tabs_state( element, 1, 0, 0 );
+ state( element, 1, 0, 0 );
// switching tabs
element.one( "tabsselect", function( event, ui ) {
@@ -376,17 +378,17 @@ test( "select", function() {
strictEqual( ui.tab, tabs[ 1 ], "ui.tab" );
strictEqual( ui.panel, panels[ 1 ], "ui.panel" );
equal( ui.index, 1, "ui.index" );
- tabs_state( element, 1, 0, 0 );
+ state( element, 1, 0, 0 );
});
tabs.eq( 1 ).click();
- tabs_state( element, 0, 1, 0 );
+ state( element, 0, 1, 0 );
// collapsing
element.one( "tabsselect", function( event, ui ) {
ok( false, "collapsing" );
});
element.tabs( "option", "active", false );
- tabs_state( element, 0, 0, 0 );
+ state( element, 0, 0, 0 );
});
module( "tabs (deprecated): methods" );
@@ -396,7 +398,7 @@ test( "add", function() {
var tab, anchor,
element = $( "#tabs1" ).tabs();
- tabs_state( element, 1, 0, 0 );
+ state( element, 1, 0, 0 );
// add without index
element.one( "tabsadd", function( event, ui ) {
@@ -405,7 +407,7 @@ test( "add", function() {
equal( ui.panel.id, "new", "ui.panel" );
});
element.tabs( "add", "#new", "New" );
- tabs_state( element, 1, 0, 0, 0 );
+ state( element, 1, 0, 0, 0 );
tab = element.find( ".ui-tabs-nav li" ).last();
anchor = tab.find( "a" );
equal( tab.text(), "New", "label" );
@@ -415,7 +417,7 @@ test( "add", function() {
anchor.simulate( "mouseover" );
ok( tab.hasClass( "ui-state-hover" ), "hovered" );
anchor.simulate( "click" );
- tabs_state( element, 0, 0, 0, 1 );
+ state( element, 0, 0, 0, 1 );
// add remote tab with index
element.one( "tabsadd", function( event, ui ) {
@@ -424,7 +426,7 @@ test( "add", function() {
equal( ui.panel.id, $( ui.tab ).attr( "aria-controls" ), "ui.panel" );
});
element.tabs( "add", "data/test.html", "New Remote", 1 );
- tabs_state( element, 0, 0, 0, 0, 1 );
+ state( element, 0, 0, 0, 0, 1 );
tab = element.find( ".ui-tabs-nav li" ).eq( 1 );
anchor = tab.find( "a" );
equal( tab.text(), "New Remote", "label" );
@@ -434,7 +436,7 @@ test( "add", function() {
anchor.simulate( "mouseover" );
ok( tab.hasClass( "ui-state-hover" ), "hovered" );
anchor.simulate( "click" );
- tabs_state( element, 0, 1, 0, 0, 0 );
+ state( element, 0, 1, 0, 0, 0 );
// add to empty tab set
element = $( "<div><ul></ul></div>" ).tabs();
@@ -445,7 +447,7 @@ test( "add", function() {
equal( ui.panel.id, "first", "ui.panel" );
});
element.tabs( "add", "#first", "First" );
- tabs_state( element, 1 );
+ state( element, 1 );
equal( element.tabs( "option", "active" ), 0, "active: 0 after add" );
});
@@ -462,7 +464,7 @@ test( "remove", function() {
expect( 17 );
var element = $( "#tabs1" ).tabs({ active: 1 });
- tabs_state( element, 0, 1, 0 );
+ state( element, 0, 1, 0 );
element.one( "tabsremove", function( event, ui ) {
equal( ui.index, -1, "ui.index" );
@@ -470,7 +472,7 @@ test( "remove", function() {
equal( ui.panel.id, "fragment-2", "ui.panel" );
});
element.tabs( "remove", 1 );
- tabs_state( element, 0, 1 );
+ state( element, 0, 1 );
equal( element.tabs( "option", "active" ), 1 );
equal( element.find( ".ui-tabs-nav li a[href$='fragment-2']" ).length, 0,
"remove correct list item" );
@@ -482,7 +484,7 @@ test( "remove", function() {
equal( ui.panel.id, "fragment-3", "ui.panel" );
});
element.tabs( "remove", 1 );
- tabs_state( element, 1 );
+ state( element, 1 );
equal( element.tabs( "option", "active"), 0 );
element.one( "tabsremove", function( event, ui ) {
@@ -498,43 +500,43 @@ test( "select", function() {
expect( 23 );
var element = $( "#tabs1" ).tabs();
- tabs_state( element, 1, 0, 0 );
+ state( element, 1, 0, 0 );
element.tabs( "select", 1 );
- tabs_state( element, 0, 1, 0 );
+ state( element, 0, 1, 0 );
equal( element.tabs( "option", "active" ), 1, "active" );
equal( element.tabs( "option", "selected" ), 1, "selected" );
element.tabs( "destroy" );
element.tabs({ collapsible: true });
- tabs_state( element, 1, 0, 0 );
+ state( element, 1, 0, 0 );
element.tabs( "select", 0 );
- tabs_state( element, 0, 0, 0 );
+ state( element, 0, 0, 0 );
equal( element.tabs( "option", "active" ), false, "active" );
equal( element.tabs( "option", "selected" ), -1, "selected" );
element.tabs( "destroy" );
element.tabs({ collapsible: true });
element.tabs( "select", -1 );
- tabs_state( element, 0, 0, 0 );
+ state( element, 0, 0, 0 );
equal( element.tabs( "option", "active" ), false, "active" );
equal( element.tabs( "option", "selected" ), -1, "selected" );
element.tabs( "destroy" );
element.tabs();
- tabs_state( element, 1, 0, 0 );
+ state( element, 1, 0, 0 );
equal( element.tabs( "option", "active" ), 0, "active" );
equal( element.tabs( "option", "selected" ), 0, "selected" );
element.tabs( "select", 0 );
- tabs_state( element, 1, 0, 0 );
+ state( element, 1, 0, 0 );
equal( element.tabs( "option", "active" ), 0, "active" );
equal( element.tabs( "option", "selected" ), 0, "selected" );
element.tabs( "select", -1 );
- tabs_state( element, 1, 0, 0 );
+ state( element, 1, 0, 0 );
equal( element.tabs( "option", "active" ), 0, "active" );
equal( element.tabs( "option", "selected" ), 0, "selected" );
element.tabs( "select", "#fragment-2" );
- tabs_state( element, 0, 1, 0 );
+ state( element, 0, 1, 0 );
equal( element.tabs( "option", "active" ), 1, "active" );
equal( element.tabs( "option", "selected" ), 1, "selected" );
});