diff --git a/tests/unit/tabs/tabs_defaults.js b/tests/unit/tabs/tabs_defaults.js index 194d2b76c..0f33cc28c 100644 --- a/tests/unit/tabs/tabs_defaults.js +++ b/tests/unit/tabs/tabs_defaults.js @@ -7,7 +7,6 @@ var tabs_defaults = { beforeload: null, beforeActivate: null, collapsible: false, - cookie: null, disabled: false, event: "click", fx: null, diff --git a/tests/unit/tabs/tabs_deprecated.js b/tests/unit/tabs/tabs_deprecated.js index 1abaa0b04..9885ff6a0 100644 --- a/tests/unit/tabs/tabs_deprecated.js +++ b/tests/unit/tabs/tabs_deprecated.js @@ -36,6 +36,42 @@ test('panelTemplate', function() { ok(false, "missing test - untested code is broken code."); }); +test('cookie', function() { + expect(6); + + el = $('#tabs1'); + var cookieName = 'tabs_test', cookieObj = { name: cookieName }; + $.cookie(cookieName, null); // blank state + var cookie = function() { + return parseInt($.cookie(cookieName), 10); + }; + + el.tabs({ cookie: cookieObj }); + equals(cookie(), 0, 'initial cookie value'); + + el.tabs('destroy'); + el.tabs({ active: 1, cookie: cookieObj }); + equals(cookie(), 1, 'initial cookie value, from active property'); + + el.tabs('option', 'active', 2); + equals(cookie(), 2, 'cookie value updated after activating'); + + el.tabs('destroy'); + $.cookie(cookieName, 1); + el.tabs({ cookie: cookieObj }); + equals(cookie(), 1, 'initial cookie value, from existing cookie'); + + el.tabs('destroy'); + el.tabs({ cookie: cookieObj, collapsible: true }); + el.tabs('option', 'active', false); + equals(cookie(), -1, 'cookie value for all tabs unselected'); + + el.tabs('destroy'); + ok($.cookie(cookieName) === null, 'erase cookie after destroy'); + +}); + + test('spinner', function() { expect(4); stop(); diff --git a/tests/unit/tabs/tabs_options.js b/tests/unit/tabs/tabs_options.js index 1352a68e5..5196ec9bb 100644 --- a/tests/unit/tabs/tabs_options.js +++ b/tests/unit/tabs/tabs_options.js @@ -22,41 +22,6 @@ test('collapsible', function() { }); -test('cookie', function() { - expect(6); - - el = $('#tabs1'); - var cookieName = 'tabs_test', cookieObj = { name: cookieName }; - $.cookie(cookieName, null); // blank state - var cookie = function() { - return parseInt($.cookie(cookieName), 10); - }; - - el.tabs({ cookie: cookieObj }); - equals(cookie(), 0, 'initial cookie value'); - - el.tabs('destroy'); - el.tabs({ active: 1, cookie: cookieObj }); - equals(cookie(), 1, 'initial cookie value, from active property'); - - el.tabs('option', 'active', 2); - equals(cookie(), 2, 'cookie value updated after activating'); - - el.tabs('destroy'); - $.cookie(cookieName, 1); - el.tabs({ cookie: cookieObj }); - equals(cookie(), 1, 'initial cookie value, from existing cookie'); - - el.tabs('destroy'); - el.tabs({ cookie: cookieObj, collapsible: true }); - el.tabs('option', 'active', false); - equals(cookie(), -1, 'cookie value for all tabs unselected'); - - el.tabs('destroy'); - ok($.cookie(cookieName) === null, 'erase cookie after destroy'); - -}); - test('disabled', function() { expect(4); diff --git a/ui/jquery.ui.tabs.js b/ui/jquery.ui.tabs.js index b35a91e51..066bd5299 100755 --- a/ui/jquery.ui.tabs.js +++ b/ui/jquery.ui.tabs.js @@ -29,7 +29,6 @@ $.widget( "ui.tabs", { activate: null, beforeload: null, beforeActivate: null, - cookie: null, // e.g. { expires: 7, path: '/', domain: 'jquery.com', secure: true } collapsible: false, disabled: false, event: "click", @@ -50,8 +49,7 @@ $.widget( "ui.tabs", { // Selected tab // use "selected" option or try to retrieve: // 1. from fragment identifier in url - // 2. from cookie - // 3. from selected class attribute on