diff --git a/tests/unit/tabs/tabs_defaults.js b/tests/unit/tabs/tabs_defaults.js index d64316f9f..e15d618de 100644 --- a/tests/unit/tabs/tabs_defaults.js +++ b/tests/unit/tabs/tabs_defaults.js @@ -1,7 +1,7 @@ commonWidgetTests( "tabs", { defaults: { activate: null, -// active: null, + active: null, beforeLoad: null, beforeActivate: null, collapsible: false, diff --git a/tests/unit/tabs/tabs_defaults_deprecated.js b/tests/unit/tabs/tabs_defaults_deprecated.js index c496e72f5..2d9772c6d 100644 --- a/tests/unit/tabs/tabs_defaults_deprecated.js +++ b/tests/unit/tabs/tabs_defaults_deprecated.js @@ -1,7 +1,7 @@ commonWidgetTests( "tabs", { defaults: { activate: null, -// active: null, + active: null, add: null, ajaxOptions: null, beforeLoad: null, diff --git a/tests/unit/tabs/tabs_deprecated.js b/tests/unit/tabs/tabs_deprecated.js index 535358636..9c816734a 100644 --- a/tests/unit/tabs/tabs_deprecated.js +++ b/tests/unit/tabs/tabs_deprecated.js @@ -102,7 +102,7 @@ test('spinner', function() { }); test('selected', function() { - expect(11); + expect(10); el = $('#tabs1').tabs(); equals(el.tabs('option', 'selected'), 0, 'should be 0 by default'); @@ -127,10 +127,6 @@ test('selected', function() { equals( $('li.ui-tabs-selected', el).length, 0, 'no tab should be selected' ); equals( $('div:hidden', '#tabs1').length, 3, 'all panels should be hidden' ); - el.tabs('destroy'); - el.tabs({ selected: null }); - equals(el.tabs('option', 'selected'), -1, 'should be -1 for all tabs unselected with value null (deprecated)'); - el.tabs('destroy'); el.tabs({ selected: 1 }); equals(el.tabs('option', 'selected'), 1, 'should be specified tab'); diff --git a/tests/unit/tabs/tabs_events.js b/tests/unit/tabs/tabs_events.js index ef0297653..2e54407de 100644 --- a/tests/unit/tabs/tabs_events.js +++ b/tests/unit/tabs/tabs_events.js @@ -6,8 +6,7 @@ test( "beforeActivate", function() { expect( 38 ); var element = $( "#tabs1" ).tabs({ - // TODO: should be false - active: -1, + active: false, collapsible: true }), tabs = element.find( ".ui-tabs-nav a" ), @@ -15,13 +14,13 @@ test( "beforeActivate", function() { // from collapsed element.one( "tabsbeforeactivate", function( event, ui ) { - ok( !( "originalEvent" in event ) ); - equals( ui.oldTab.size(), 0 ); - equals( ui.oldPanel.size(), 0 ); - equals( ui.newTab.size(), 1 ); - strictEqual( ui.newTab[ 0 ], tabs[ 0 ] ); - equals( ui.newPanel.size(), 1 ); - strictEqual( ui.newPanel[ 0 ], panels[ 0 ] ); + ok( !( "originalEvent" in event ), "originalEvent" ); + equals( ui.oldTab.size(), 0, "oldTab size" ); + equals( ui.oldPanel.size(), 0, "oldPanel size" ); + equals( ui.newTab.size(), 1, "newTab size" ); + strictEqual( ui.newTab[ 0 ], tabs[ 0 ], "newTab" ); + equals( ui.newPanel.size(), 1, "newPanel size" ); + strictEqual( ui.newPanel[ 0 ], panels[ 0 ], "newPanel" ); tabs_state( element, 0, 0, 0 ); }); element.tabs( "option", "active", 0 ); @@ -29,15 +28,15 @@ test( "beforeActivate", function() { // switching tabs element.one( "tabsbeforeactivate", function( event, ui ) { - equals( event.originalEvent.type, "click" ); - equals( ui.oldTab.size(), 1 ); - strictEqual( ui.oldTab[ 0 ], tabs[ 0 ] ); - equals( ui.oldPanel.size(), 1 ); - strictEqual( ui.oldPanel[ 0 ], panels[ 0 ] ); - equals( ui.newTab.size(), 1 ); - strictEqual( ui.newTab[ 0 ], tabs[ 1 ] ); - equals( ui.newPanel.size(), 1 ); - strictEqual( ui.newPanel[ 0 ], panels[ 1 ] ); + equals( event.originalEvent.type, "click", "originalEvent" ); + equals( ui.oldTab.size(), 1, "oldTab size" ); + strictEqual( ui.oldTab[ 0 ], tabs[ 0 ], "oldTab" ); + equals( ui.oldPanel.size(), 1, "oldPanel size" ); + strictEqual( ui.oldPanel[ 0 ], panels[ 0 ], "oldPanel" ); + equals( ui.newTab.size(), 1, "newTab size" ); + strictEqual( ui.newTab[ 0 ], tabs[ 1 ], "newTab" ); + equals( ui.newPanel.size(), 1, "newPanel size" ); + strictEqual( ui.newPanel[ 0 ], panels[ 1 ], "newPanel" ); tabs_state( element, 1, 0, 0 ); }); tabs.eq( 1 ).click(); @@ -45,13 +44,13 @@ test( "beforeActivate", function() { // collapsing element.one( "tabsbeforeactivate", function( event, ui ) { - ok( !( "originalEvent" in event ) ); - equals( ui.oldTab.size(), 1 ); - strictEqual( ui.oldTab[ 0 ], tabs[ 1 ] ); - equals( ui.oldPanel.size(), 1 ); - strictEqual( ui.oldPanel[ 0 ], panels[ 1 ] ); - equals( ui.newTab.size(), 0 ); - equals( ui.newPanel.size(), 0 ); + ok( !( "originalEvent" in event ), "originalEvent" ); + equals( ui.oldTab.size(), 1, "oldTab size" ); + strictEqual( ui.oldTab[ 0 ], tabs[ 1 ], "oldTab" ); + equals( ui.oldPanel.size(), 1, "oldPanel size" ); + strictEqual( ui.oldPanel[ 0 ], panels[ 1 ], "oldPanel" ); + equals( ui.newTab.size(), 0, "newTab size" ); + equals( ui.newPanel.size(), 0, "newPanel size" ); tabs_state( element, 0, 1, 0 ); }); element.tabs( "option", "active", false ); @@ -59,13 +58,13 @@ test( "beforeActivate", function() { // prevent activation element.one( "tabsbeforeactivate", function( event, ui ) { - ok( !( "originalEvent" in event ) ); - equals( ui.oldTab.size(), 0 ); - equals( ui.oldPanel.size(), 0 ); - equals( ui.newTab.size(), 1 ); - strictEqual( ui.newTab[ 0 ], tabs[ 1 ] ); - equals( ui.newPanel.size(), 1 ); - strictEqual( ui.newPanel[ 0 ], panels[ 1 ] ); + ok( !( "originalEvent" in event ), "originalEvent" ); + equals( ui.oldTab.size(), 0, "oldTab size" ); + equals( ui.oldPanel.size(), 0, "oldTab" ); + equals( ui.newTab.size(), 1, "newTab size" ); + strictEqual( ui.newTab[ 0 ], tabs[ 1 ], "newTab" ); + equals( ui.newPanel.size(), 1, "newPanel size" ); + strictEqual( ui.newPanel[ 0 ], panels[ 1 ], "newPanel" ); event.preventDefault(); tabs_state( element, 0, 0, 0 ); }); @@ -77,8 +76,7 @@ test( "activate", function() { expect( 30 ); var element = $( "#tabs1" ).tabs({ - // TODO: should be false - active: -1, + active: false, collapsible: true }), tabs = element.find( ".ui-tabs-nav a" ), @@ -86,13 +84,13 @@ test( "activate", function() { // from collapsed element.one( "tabsactivate", function( event, ui ) { - ok( !( "originalEvent" in event ) ); - equals( ui.oldTab.size(), 0 ); - equals( ui.oldPanel.size(), 0 ); - equals( ui.newTab.size(), 1 ); - strictEqual( ui.newTab[ 0 ], tabs[ 0 ] ); - equals( ui.newPanel.size(), 1 ); - strictEqual( ui.newPanel[ 0 ], panels[ 0 ] ); + ok( !( "originalEvent" in event ), "originalEvent" ); + equals( ui.oldTab.size(), 0, "oldTab size" ); + equals( ui.oldPanel.size(), 0, "oldPanel size" ); + equals( ui.newTab.size(), 1, "newTab size" ); + strictEqual( ui.newTab[ 0 ], tabs[ 0 ], "newTab" ); + equals( ui.newPanel.size(), 1, "newPanel size" ); + strictEqual( ui.newPanel[ 0 ], panels[ 0 ], "newPanel" ); tabs_state( element, 1, 0, 0 ); }); element.tabs( "option", "active", 0 ); @@ -100,15 +98,15 @@ test( "activate", function() { // switching tabs element.one( "tabsactivate", function( event, ui ) { - equals( event.originalEvent.type, "click" ); - equals( ui.oldTab.size(), 1 ); - strictEqual( ui.oldTab[ 0 ], tabs[ 0 ] ); - equals( ui.oldPanel.size(), 1 ); - strictEqual( ui.oldPanel[ 0 ], panels[ 0 ] ); - equals( ui.newTab.size(), 1 ); - strictEqual( ui.newTab[ 0 ], tabs[ 1 ] ); - equals( ui.newPanel.size(), 1 ); - strictEqual( ui.newPanel[ 0 ], panels[ 1 ] ); + equals( event.originalEvent.type, "click", "originalEvent" ); + equals( ui.oldTab.size(), 1, "oldTab size" ); + strictEqual( ui.oldTab[ 0 ], tabs[ 0 ], "oldTab" ); + equals( ui.oldPanel.size(), 1, "oldPanel size" ); + strictEqual( ui.oldPanel[ 0 ], panels[ 0 ], "oldPanel" ); + equals( ui.newTab.size(), 1, "newTab size" ); + strictEqual( ui.newTab[ 0 ], tabs[ 1 ], "newTab" ); + equals( ui.newPanel.size(), 1, "newPanel size" ); + strictEqual( ui.newPanel[ 0 ], panels[ 1 ], "newPanel" ); tabs_state( element, 0, 1, 0 ); }); tabs.eq( 1 ).click(); @@ -116,13 +114,13 @@ test( "activate", function() { // collapsing element.one( "tabsactivate", function( event, ui ) { - ok( !( "originalEvent" in event ) ); - equals( ui.oldTab.size(), 1 ); - strictEqual( ui.oldTab[ 0 ], tabs[ 1 ] ); - equals( ui.oldPanel.size(), 1 ); - strictEqual( ui.oldPanel[ 0 ], panels[ 1 ] ); - equals( ui.newTab.size(), 0 ); - equals( ui.newPanel.size(), 0 ); + ok( !( "originalEvent" in event ), "originalEvent" ); + equals( ui.oldTab.size(), 1, "oldTab size" ); + strictEqual( ui.oldTab[ 0 ], tabs[ 1 ], "oldTab" ); + equals( ui.oldPanel.size(), 1, "oldPanel size" ); + strictEqual( ui.oldPanel[ 0 ], panels[ 1 ], "oldPanel" ); + equals( ui.newTab.size(), 0, "newTab size" ); + equals( ui.newPanel.size(), 0, "newPanel size" ); tabs_state( element, 0, 0, 0 ); }); element.tabs( "option", "active", false ); @@ -130,11 +128,11 @@ test( "activate", function() { // prevent activation element.one( "tabsbeforeactivate", function( event ) { - ok( true ); + ok( true, "tabsbeforeactivate" ); event.preventDefault(); }); element.one( "tabsactivate", function() { - ok( false ); + ok( false, "tabsactivate" ); }); element.tabs( "option", "active", 1 ); }); @@ -171,7 +169,7 @@ test( "beforeLoad", function() { tabs_state( element, 0, 0, 1, 0 ); equals( panel.html(), "", "panel html after" ); - // click + // click, change panel content element.one( "tabsbeforeload", function( event, ui ) { tab = element.find( ".ui-tabs-nav a" ).eq( 3 ); panelId = tab.attr( "aria-controls" ); @@ -193,8 +191,8 @@ test( "beforeLoad", function() { equals( panel.html(), "
testing
", "panel html after" ); }); -test('load', function() { - ok(false, "missing test - untested code is broken code."); +test( "load", function() { + ok( false, "missing test - untested code is broken code." ); }); -})(jQuery); +}( jQuery ) ); diff --git a/tests/unit/tabs/tabs_methods.js b/tests/unit/tabs/tabs_methods.js index c33bebe65..8fcd2a848 100644 --- a/tests/unit/tabs/tabs_methods.js +++ b/tests/unit/tabs/tabs_methods.js @@ -136,7 +136,7 @@ test('refresh', function() { var el = $('