diff options
author | David Petersen <public@petersendidit.com> | 2011-03-27 16:37:43 -0400 |
---|---|---|
committer | David Petersen <public@petersendidit.com> | 2011-03-27 16:42:30 -0400 |
commit | 9a00fd4c5ef637f29afc6debda4db136f1fcb3fb (patch) | |
tree | 93c096e6a6a1082f382ba22ec09240148e1f425f /tests/unit/tabs/tabs_deprecated.js | |
parent | c363019590da9c38754fb7c60e5f44e25ca48e21 (diff) | |
download | jquery-ui-9a00fd4c5ef637f29afc6debda4db136f1fcb3fb.tar.gz jquery-ui-9a00fd4c5ef637f29afc6debda4db136f1fcb3fb.zip |
Tabs: Rename selected option to active. Fixes #7135 Tabs: Rename selected option to active
Diffstat (limited to 'tests/unit/tabs/tabs_deprecated.js')
-rw-r--r-- | tests/unit/tabs/tabs_deprecated.js | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/tests/unit/tabs/tabs_deprecated.js b/tests/unit/tabs/tabs_deprecated.js index 7e4816793..8b6b50d7e 100644 --- a/tests/unit/tabs/tabs_deprecated.js +++ b/tests/unit/tabs/tabs_deprecated.js @@ -65,6 +65,55 @@ test('spinner', function() { }); }); +test('selected', function() { + expect(11); + + el = $('#tabs1').tabs(); + equals(el.tabs('option', 'selected'), 0, 'should be 0 by default'); + + el.tabs('destroy'); + //set a hash in the url + location.hash = '#fragment-2'; + //selection of tab with divs ordered differently than list + el = $('#tabs1').tabs(); + equals(el.tabs('option', 'selected'), 1, 'second tab should be selected'); + + el.tabs('destroy'); + //set a hash in the url + location.hash = '#tabs7-2'; + //selection of tab with divs ordered differently than list + el = $('#tabs7').tabs(); + equals(el.tabs('option', 'selected'), 1, 'second tab should be selected'); + + el.tabs('destroy'); + el = $('#tabs1').tabs({ selected: -1 }); + equals(el.tabs('option', 'selected'), -1, 'should be -1 for all tabs unselected'); + equals( $('li.ui-tabs-selected', el).length, 0, 'no tab should be selected' ); + equals( $('div.ui-tabs-hide', '#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'); + + el.tabs('destroy'); + el.tabs({ selected: 99 }); + equals(el.tabs('option', 'selected'), 0, 'selected should default to zero if given value is out of index'); + + el.tabs('destroy'); + el.tabs({ collapsible: true }); + el.tabs('option', 'selected', 0); + equals(el.tabs('option', 'selected'), 0, 'should not collapse tab if value is same as selected'); + + el.tabs('destroy'); + el = $('#tabs1').tabs(); + el.tabs('select', 1); + equals(el.tabs('option', 'selected'), 1, 'should select tab'); +}); + module("tabs (deprecated): events"); test('enable', function() { |