diff --git a/tests/unit/accordion/accordion.html b/tests/unit/accordion/accordion.html index 9e23a1243d..5bc31a9265 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 7ba6d47e4e..a2b0493b6a 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 0000000000..cdda7a7e36 --- /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; + } + }; +}