aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/accordion/helper.js
blob: b47510733f4ca799fe8d84b2077e57633b795319 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
define( [
	"jquery",
	"lib/helper",
	"ui/widgets/accordion"
], function( $, helper ) {

return $.extend( helper, {
	equalHeight: function( accordion, height ) {
		accordion.find( ".ui-accordion-content" ).each( function() {
			equal( $( this ).outerHeight(), height );
		} );
	},

	setupTeardown: function() {
		var animate = $.ui.accordion.prototype.options.animate;
		return {
			setup: function() {
				$.ui.accordion.prototype.options.animate = false;
			},
			teardown: function() {
				$.ui.accordion.prototype.options.animate = animate;
			}
		};
	},

	state: function( accordion ) {
		var expected = $.makeArray( arguments ).slice( 1 ),
			actual = accordion.find( ".ui-accordion-content" ).map( function() {
				return $( this ).css( "display" ) === "none" ? 0 : 1;
			} ).get();
		QUnit.push( QUnit.equiv( actual, expected ), actual, expected );
	}
} );

} );