diff options
author | Scott González <scott.gonzalez@gmail.com> | 2011-04-15 08:53:05 -0400 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2011-04-15 08:53:05 -0400 |
commit | d3e10de6bce82bc6184eb7b5a4fd68247bc5905b (patch) | |
tree | 7d1d2f63e4c240d9962f73d2664ed02f271746fd /tests/unit/tabs/tabs.html | |
parent | 59c787fa4a975547e7789928126028bdfe132582 (diff) | |
download | jquery-ui-d3e10de6bce82bc6184eb7b5a4fd68247bc5905b.tar.gz jquery-ui-d3e10de6bce82bc6184eb7b5a4fd68247bc5905b.zip |
Tabs: Better tests for tab state.
Diffstat (limited to 'tests/unit/tabs/tabs.html')
-rw-r--r-- | tests/unit/tabs/tabs.html | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/unit/tabs/tabs.html b/tests/unit/tabs/tabs.html index c800894ff..bba0e8a58 100644 --- a/tests/unit/tabs/tabs.html +++ b/tests/unit/tabs/tabs.html @@ -30,7 +30,19 @@ function tabs_state( tabs ) { var expected = $.makeArray( arguments ).slice( 1 ); var actual = tabs.find( ".ui-tabs-nav li" ).map(function() { - return $( this ).hasClass( "ui-state-active" ) ? 1 : 0; + var tab = $( this ), + panel = $( $.ui.tabs.prototype._sanitizeSelector( + "#" + tab.find( "a" ).attr( "aria-controls" ) ) ), + tabIsActive = tab.hasClass( "ui-state-active" ), + panelIsActive = panel.is( ":visible" ); + + if ( tabIsActive && panelIsActive ) { + return 1; + } + if ( !tabIsActive && !panelIsActive ) { + return 0; + } + return -1; // mixed state - invalid }).get(); same( actual, expected ); } |