Tabs: Added tests for cache option. Fixes #7131 - Tabs: Add beforeload event; deprecate ajaxOptions and cache options.

This commit is contained in:
Scott González 2011-05-09 15:04:01 -04:00
parent 9549686cb3
commit 7157af2550
2 changed files with 29 additions and 3 deletions

View File

@ -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() {

View File

@ -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 );
}