diff options
author | Scott González <scott.gonzalez@gmail.com> | 2012-04-19 12:53:06 -0400 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2012-04-19 12:53:13 -0400 |
commit | 33e93ef7f0aff6b6117177638a94e24e02dbc1be (patch) | |
tree | 8d9e4520f3d35391372e0b4986ea32d6fae24444 /tests/unit/tabs/tabs_deprecated.html | |
parent | c16bd7c510cff4e0b01d9c191128af014523da7c (diff) | |
download | jquery-ui-33e93ef7f0aff6b6117177638a94e24e02dbc1be.tar.gz jquery-ui-33e93ef7f0aff6b6117177638a94e24e02dbc1be.zip |
Tabs tests: Don't pollute the global namespace with helpers.
Diffstat (limited to 'tests/unit/tabs/tabs_deprecated.html')
-rw-r--r-- | tests/unit/tabs/tabs_deprecated.html | 57 |
1 files changed, 1 insertions, 56 deletions
diff --git a/tests/unit/tabs/tabs_deprecated.html b/tests/unit/tabs/tabs_deprecated.html index 410aebc40..c22ec3369 100644 --- a/tests/unit/tabs/tabs_deprecated.html +++ b/tests/unit/tabs/tabs_deprecated.html @@ -23,6 +23,7 @@ <script src="../../jquery.simulate.js"></script> <script src="../testsuite.js"></script> + <script src="tabs_test_helpers.js"></script> <script src="tabs_defaults_deprecated.js"></script> <script src="tabs_core.js"></script> <script src="tabs_events.js"></script> @@ -30,62 +31,6 @@ <script src="tabs_options.js"></script> <script src="tabs_deprecated.js"></script> - <script> - function tabs_state( tabs ) { - var expected = $.makeArray( arguments ).slice( 1 ); - var actual = tabs.find( ".ui-tabs-nav li" ).map(function() { - var tab = $( this ), - panel = $( $.ui.tabs.prototype._sanitizeSelector( - "#" + tab.find( "a" ).attr( "aria-controls" ) ) ), - tabIsActive = tab.hasClass( "ui-state-active" ), - panelIsActive = panel.css( "display" ) !== "none"; - - if ( tabIsActive && panelIsActive ) { - return 1; - } - if ( !tabIsActive && !panelIsActive ) { - return 0; - } - return -1; // mixed state - invalid - }).get(); - deepEqual( actual, expected ); - } - - function tabs_disabled( tabs, state ) { - var expected = $.map( new Array( tabs.find ( ".ui-tabs-nav li" ).length ), function( _, index ) { - if ( typeof state === "boolean" ) { - return state ? 1 : 0; - } else { - return $.inArray( index, state ) !== -1 ? 1 : 0; - } - }); - - var internalState = tabs.tabs( "option", "disabled" ); - if ( internalState === false ) { - internalState = []; - } - if ( internalState === true ) { - internalState = $.map( new Array( tabs.find( ".ui-tabs-nav li" ).length ), function( _, index ) { - return index; - }); - } - - var actual = tabs.find( ".ui-tabs-nav li" ).map(function( index ) { - var tab = $( this ), - tabIsDisabled = tab.hasClass( "ui-state-disabled" ); - - if ( tabIsDisabled && $.inArray( index, internalState ) !== -1 ) { - return 1; - } - if ( !tabIsDisabled && $.inArray( index, internalState ) === -1 ) { - return 0; - } - return -1; // mixed state - invalid - }).get(); - deepEqual( tabs.tabs( "option", "disabled" ), state ); - deepEqual( actual, expected ); - } - </script> <script src="../swarminject.js"></script> </head> <body> |