aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/accordion/helper.js
blob: 3211765af06943f425b45169ee0bbe244794fc30 (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
36
37
define( [
	"qunit",
	"jquery",
	"lib/helper",
	"ui/widgets/accordion"
], function( QUnit, $, helper ) {

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

	beforeAfterEach: function() {
		var animate = $.ui.accordion.prototype.options.animate;
		return {
			beforeEach: function() {
				$.ui.accordion.prototype.options.animate = false;
			},
			afterEach: function() {
				$.ui.accordion.prototype.options.animate = animate;
				return helper.moduleAfterEach.apply( this, arguments );
			}
		};
	},

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

} );