From b70832981dda4881b0f498958432b8048ec0ef55 Mon Sep 17 00:00:00 2001 From: scottjehl Date: Tue, 20 Dec 2011 17:34:13 +0700 Subject: [PATCH] fixed up the failing unit test by ensuring the toolbars were shown before testing for transition classes. --- tests/unit/fixedToolbar/fixedToolbar.js | 36 ++++++++++++++++++------- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/tests/unit/fixedToolbar/fixedToolbar.js b/tests/unit/fixedToolbar/fixedToolbar.js index e345fb1b..7c3858b4 100644 --- a/tests/unit/fixedToolbar/fixedToolbar.js +++ b/tests/unit/fixedToolbar/fixedToolbar.js @@ -22,7 +22,7 @@ window.scrollTo(0,0); } - + // add meta viewport tag injectMeta(); @@ -47,19 +47,37 @@ }); - test( "Fixed header and footer transition classes are applied correctly", function(){ + asyncTest( "Fixed header and footer transition classes are applied correctly", function(){ + expect( 6 ); + + $.testHelper.sequence([ + function(){ + scrollDown(); + }, + + function(){ + //show first + $( '#classes-test-b, #classes-test-g, #classes-test-e,#classes-test-h,#classes-test-i,#classes-test-j' ).fixedtoolbar( "show" ); + }, + + function() { + ok( $( '#classes-test-g' ).hasClass('fade'), 'The fade class should be applied by default'); + ok( $( '#classes-test-b' ).hasClass('in'), 'The "in" class should be applied by default'); + ok( !$( '#classes-test-h' ).hasClass('fade'), 'The fade class should not be applied when the header has a data-transition of "none"'); - ok( $( '#classes-test-g' ).hasClass('fade'), 'The fade class should be applied by default'); - ok( $( '#classes-test-g' ).hasClass('in'), 'The "in" class should be applied by default'); - ok( !$( '#classes-test-h' ).hasClass('fade'), 'The fade class should not be applied when the header has a data-transition of "none"'); - - ok( !$( '#classes-test-h' ).hasClass('in'), 'The "in" class should not be applied when the header has a data-transition of "none"'); - ok( $( '#classes-test-i' ).hasClass('slidedown'), 'The "slidedown" class should be applied when the header has a data-transition of "slide"'); - ok( $( '#classes-test-j' ).hasClass('slideup'), 'The "slideup" class should be applied when the footer has a data-transition of "slide"'); + ok( !$( '#classes-test-h' ).hasClass('in'), 'The "in" class should not be applied when the header has a data-transition of "none"'); + ok( $( '#classes-test-i' ).hasClass('slidedown'), 'The "slidedown" class should be applied when the header has a data-transition of "slide"'); + ok( $( '#classes-test-j' ).hasClass('slideup'), 'The "slideup" class should be applied when the footer has a data-transition of "slide"'); + }, + function(){ + scrollUp(); + start(); + } + ], 500); });