Skip to content
Permalink
Browse files

Tabs: Removed cookie option. Fixes #7162 - Tabs: Remove cookie option.

  • Loading branch information...
scottgonzalez committed Oct 25, 2012
1 parent 723d3e0 commit 0429532ad10b0708e085c4830bb930d8457d62f4

This file was deleted.

@@ -2,7 +2,6 @@ TestHelpers.commonWidgetTests( "tabs", {
defaults: {
active: null,
collapsible: false,
cookie: null,
disabled: false,
event: "click",
heightStyle: "content",
@@ -5,7 +5,6 @@
<title>jQuery UI Tabs Test Suite</title>

<script src="../../jquery.js"></script>
<script src="../../../external/jquery.cookie.js"></script>
<link rel="stylesheet" href="../../../external/qunit.css">
<script src="../../../external/qunit.js"></script>
<script src="../../jquery.simulate.js"></script>
@@ -66,41 +66,6 @@ test( "tabTemplate + panelTemplate", function() {
ok( element.find( "#new" ).hasClass( "customPanel" ), "panel custom class" );
});

test( "cookie", function() {
expect( 6 );

var element = $( "#tabs1" ),
cookieName = "tabs_test",
cookieObj = { name: cookieName };
$.cookie( cookieName, null );
function cookie() {
return parseInt( $.cookie( cookieName ), 10 );
}

element.tabs({ cookie: cookieObj });
equal( cookie(), 0, "initial cookie value" );

element.tabs( "destroy" );
element.tabs({ active: 1, cookie: cookieObj });
equal( cookie(), 1, "initial cookie value, from active property" );

element.tabs( "option", "active", 2 );
equal( cookie(), 2, "cookie value updated after activating" );

element.tabs( "destroy" );
$.cookie( cookieName, 1 );
element.tabs({ cookie: cookieObj });
equal( cookie(), 1, "initial cookie value, from existing cookie" );

element.tabs( "destroy" );
element.tabs({ cookie: cookieObj, collapsible: true });
element.tabs( "option", "active", false );
equal( cookie(), -1, "cookie value for all tabs unselected" );

element.tabs( "destroy" );
ok( $.cookie( cookieName ) === null, "erase cookie after destroy" );
});

asyncTest( "spinner", function() {
expect( 2 );

@@ -1144,58 +1144,6 @@ if ( $.uiBackCompat !== false ) {
}
});

// cookie option
(function() {

var listId = 0;

$.widget( "ui.tabs", $.ui.tabs, {
options: {
cookie: null // e.g. { expires: 7, path: '/', domain: 'jquery.com', secure: true }
},
_create: function() {
var options = this.options,
active;
if ( options.active == null && options.cookie ) {
active = parseInt( this._cookie(), 10 );
if ( active === -1 ) {
active = false;
}
options.active = active;
}
this._super();
},
_cookie: function( active ) {
var cookie = [ this.cookie ||
( this.cookie = this.options.cookie.name || "ui-tabs-" + (++listId) ) ];
if ( arguments.length ) {
cookie.push( active === false ? -1 : active );
cookie.push( this.options.cookie );
}
return $.cookie.apply( null, cookie );
},
_refresh: function() {
this._super();
if ( this.options.cookie ) {
this._cookie( this.options.active, this.options.cookie );
}
},
_eventHandler: function() {
this._superApply( arguments );
if ( this.options.cookie ) {
this._cookie( this.options.active, this.options.cookie );
}
},
_destroy: function() {
this._super();
if ( this.options.cookie ) {
this._cookie( null, this.options.cookie );
}
}
});

})();

// load event
$.widget( "ui.tabs", $.ui.tabs, {
_trigger: function( type, event, data ) {

0 comments on commit 0429532

Please sign in to comment.
You can’t perform that action at this time.