Skip to content
Permalink
Browse files

Tabs tests: Added tests for show and hide options.

  • Loading branch information
scottgonzalez committed Jul 6, 2012
1 parent c6567ba commit a6e6a0504f7ebdee9726cfb31091e6e8b7f62a1d
Showing with 49 additions and 1 deletion.
  1. +49 −1 tests/unit/tabs/tabs_options.js
@@ -280,6 +280,54 @@ test( "{ heightStyle: 'fill' } with multiple siblings", function() {
equalHeight( element, 335 );
});

// TODO: add animation tests
test( "hide and show: false", function() {
expect( 3 );
var element = $( "#tabs1" ).tabs({
show: false,
hide: false
}),
widget = element.data( "tabs" ),
panels = element.find( ".ui-tabs-panel" );
widget._show = function() {
ok( false, "_show() called" );
};
widget._hide = function() {
ok( false, "_hide() called" );
};

ok( panels.eq( 0 ).is( ":visible" ), "first panel visible" );
element.tabs( "option", "active", 1 );
ok( panels.eq( 0 ).is( ":hidden" ), "first panel hidden" );
ok( panels.eq( 1 ).is( ":visible" ), "second panel visible" );
});

asyncTest( "hide and show - animation", function() {
expect( 5 );
var element = $( "#tabs1" ).tabs({
show: "drop",
hide: 2000
}),
widget = element.data( "tabs" ),
panels = element.find( ".ui-tabs-panel" );
widget._show = function( element, options, callback ) {
strictEqual( element[ 0 ], panels[ 1 ], "correct element in _show()" );
equal( options, "drop", "correct options in _show()" );
setTimeout(function() {
callback();
}, 1 );
};
widget._hide = function( element, options, callback ) {
strictEqual( element[ 0 ], panels[ 0 ], "correct element in _hide()" );
equal( options, 2000, "correct options in _hide()" );
setTimeout(function() {
callback();
start();
}, 1 );
};

ok( panels.eq( 0 ).is( ":visible" ), "first panel visible" );
element.tabs( "option", "active", 1 );
});


}( jQuery ) );

0 comments on commit a6e6a05

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