aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2012-07-05 21:07:49 -0400
committerScott González <scott.gonzalez@gmail.com>2012-07-05 21:07:49 -0400
commita6e6a0504f7ebdee9726cfb31091e6e8b7f62a1d (patch)
tree3055233be01a8209823035d99b22c06d84eb029d /tests
parentc6567ba8800c2ddf0b2b2a18682f670ba77a3a2b (diff)
downloadjquery-ui-a6e6a0504f7ebdee9726cfb31091e6e8b7f62a1d.tar.gz
jquery-ui-a6e6a0504f7ebdee9726cfb31091e6e8b7f62a1d.zip
Tabs tests: Added tests for show and hide options.
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/tabs/tabs_options.js50
1 files changed, 49 insertions, 1 deletions
diff --git a/tests/unit/tabs/tabs_options.js b/tests/unit/tabs/tabs_options.js
index eed5b99d8..5a90ff895 100644
--- a/tests/unit/tabs/tabs_options.js
+++ b/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 ) );