diff options
author | Klaus Hartl <klaus.hartl@googlemail.com> | 2009-02-05 19:36:31 +0000 |
---|---|---|
committer | Klaus Hartl <klaus.hartl@googlemail.com> | 2009-02-05 19:36:31 +0000 |
commit | fbc6ff5f812b673c5263d0ccaf3b2c2bf4d34790 (patch) | |
tree | 734e3ea045c716cac8efe697f4b69f0391eea3d3 /tests/unit/tabs | |
parent | 78adee126cbf4ec3147f698f5bb6d71199a51b65 (diff) | |
download | jquery-ui-fbc6ff5f812b673c5263d0ccaf3b2c2bf4d34790.tar.gz jquery-ui-fbc6ff5f812b673c5263d0ccaf3b2c2bf4d34790.zip |
Tabs: fixed bug related to setting selected via data method, cleaned up mess in tests
Diffstat (limited to 'tests/unit/tabs')
-rw-r--r-- | tests/unit/tabs/tabs_options.js | 49 |
1 files changed, 22 insertions, 27 deletions
diff --git a/tests/unit/tabs/tabs_options.js b/tests/unit/tabs/tabs_options.js index 51193b8cc..e6554f6ce 100644 --- a/tests/unit/tabs/tabs_options.js +++ b/tests/unit/tabs/tabs_options.js @@ -99,39 +99,34 @@ test('panelTemplate', function() { ok(false, "missing test - untested code is broken code."); }); -test('selected: null', function() { // TODO move to selected - expect(2); - - el = $('#tabs1'); - - el.tabs({ selected: null }); +test('selected', function() { + expect(8); + + el = $('#tabs1').tabs(); + equals(el.data('selected.tabs'), 0, 'should be 0 by default'); + + el.tabs('destroy'); + el.tabs({ selected: -1 }); + equals(el.data('selected.tabs'), -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' ); -}); - -test('selected', function() { - expect(5); - - $('#tabs1').tabs(); - equals($('#tabs1').data('selected.tabs'), 0, 'selected should be 0 by default'); - - reset(); - $('#tabs1').tabs({ selected: null }); - equals($('#tabs1').data('selected.tabs'), -1, 'selected should be -1 for all tabs unselected'); - - reset(); - $('#tabs1').tabs({ selected: -1 }); - equals($('#tabs1').data('selected.tabs'), -1, 'selected should be -1 for all tabs unselected'); + el.tabs('destroy'); + el.tabs({ selected: null }); + equals(el.data('selected.tabs'), -1, 'should be -1 for all tabs unselected with value null (deprecated)'); - reset(); - $('#tabs1').tabs({ selected: 1 }); - equals($('#tabs1').data('selected.tabs'), 1, 'selected should be specified tab'); + el.tabs('destroy'); + el.tabs({ selected: 1 }); + equals(el.data('selected.tabs'), 1, 'should be specified tab'); - reset(); - $('#tabs1').tabs({ selected: 8 }); - equals($('#tabs1').data('selected.tabs'), 0, 'selected should default to zero if given value is out of index'); + el.tabs('destroy'); + el.tabs({ selected: 99 }); + equals(el.data('selected.tabs'), 0, 'selected should default to zero if given value is out of index'); + el.tabs('destroy'); + el.tabs({ collapsible: true }); + el.data('selected.tabs', 0); + equals(el.data('selected.tabs'), 0, 'should not collapse tab if value is same as selected'); }); test('spinner', function() { |