From: Scott González Date: Wed, 3 Aug 2011 17:52:36 +0000 (-0400) Subject: Accordion tests: cleanup. X-Git-Tag: 1.9m6~80 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=4415e992c5ef0f280309acc34e6903e7161a6ac9;p=jquery-ui.git Accordion tests: cleanup. --- diff --git a/tests/unit/accordion/accordion.html b/tests/unit/accordion/accordion.html index 9e23a1243..5bc31a926 100644 --- a/tests/unit/accordion/accordion.html +++ b/tests/unit/accordion/accordion.html @@ -4,6 +4,7 @@ jQuery UI Accordion Test Suite + @@ -19,36 +20,7 @@ - + @@ -57,8 +29,12 @@ diff --git a/tests/unit/accordion/accordion_deprecated.html b/tests/unit/accordion/accordion_deprecated.html index 7ba6d47e4..a2b0493b6 100644 --- a/tests/unit/accordion/accordion_deprecated.html +++ b/tests/unit/accordion/accordion_deprecated.html @@ -4,6 +4,7 @@ jQuery UI Accordion Test Suite + @@ -16,36 +17,7 @@ - + @@ -55,8 +27,12 @@ diff --git a/tests/unit/accordion/accordion_test_helpers.js b/tests/unit/accordion/accordion_test_helpers.js new file mode 100644 index 000000000..cdda7a7e3 --- /dev/null +++ b/tests/unit/accordion/accordion_test_helpers.js @@ -0,0 +1,30 @@ +function accordion_state( accordion ) { + var expected = $.makeArray( arguments ).slice( 1 ); + var actual = accordion.find( ".ui-accordion-content" ).map(function() { + return $( this ).css( "display" ) === "none" ? 0 : 1; + }).get(); + deepEqual( actual, expected ); +} + +function accordion_equalHeights( accordion, min, max ) { + var sizes = []; + accordion.find( ".ui-accordion-content" ).each(function() { + sizes.push( $( this ).outerHeight() ); + }); + ok( sizes[ 0 ] >= min && sizes[ 0 ] <= max, + "must be within " + min + " and " + max + ", was " + sizes[ 0 ] ); + deepEqual( sizes[ 0 ], sizes[ 1 ] ); + deepEqual( sizes[ 0 ], sizes[ 2 ] ); +} + +function accordionSetupTeardown() { + var animated = $.ui.accordion.prototype.options.animated; + return { + setup: function() { + $.ui.accordion.prototype.options.animated = false; + }, + teardown: function() { + $.ui.accordion.prototype.options.animated = animated; + } + }; +}