Skip to content

Commit

Permalink
Tabs: Added tests for cache option. Fixes #7131 - Tabs: Add beforeloa…
Browse files Browse the repository at this point in the history
…d event; deprecate ajaxOptions and cache options.
  • Loading branch information
scottgonzalez committed May 9, 2011
1 parent 9549686 commit 7157af2
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 3 deletions.
30 changes: 28 additions & 2 deletions tests/unit/tabs/tabs_deprecated.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,34 @@ asyncTest( "ajaxOptions", function() {
element.tabs( "option", "active", 2 );
});

test('cache', function() {
ok(false, "missing test - untested code is broken code.");
asyncTest( "cache", function() {
expect( 5 );

var element = $( "#tabs2" ).tabs({
cache: true
});
element.one( "tabsshow", function( event, ui ) {
tabs_state( element, 0, 0, 1, 0, 0 );
});
element.one( "tabsload", function( event, ui ) {
ok( true, "tabsload" );

setTimeout(function() {
element.tabs( "option", "active", 0 );
tabs_state( element, 1, 0, 0, 0, 0 );

element.one( "tabsshow", function( event, ui ) {
tabs_state( element, 0, 0, 1, 0, 0 );
});
element.one( "tabsload", function( event, ui ) {
ok( false, "should be cached" );
});
element.tabs( "option", "active", 2 );
start();
}, 1 );
});
element.tabs( "option", "active", 2 );
tabs_state( element, 0, 0, 1, 0, 0 );
});

test( "idPrefix", function() {
Expand Down
2 changes: 1 addition & 1 deletion ui/jquery.ui.tabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,7 @@ if ( $.uiBackCompat !== false ) {
}
});

ui.jqXHR.success( function() {
ui.jqXHR.success(function() {
if ( self.options.cache ) {
$.data( ui.tab[ 0 ], "cache.tabs", true );
}
Expand Down

0 comments on commit 7157af2

Please sign in to comment.