jquery-ui/tests/unit/accordion/helper.js

39 lines
965 B
JavaScript
Raw Normal View History

define( [
2016-04-03 14:37:27 +00:00
"qunit",
"jquery",
"lib/helper",
"ui/widgets/accordion"
2016-04-03 14:37:27 +00:00
], function( QUnit, $, helper ) {
"use strict";
return $.extend( helper, {
2016-04-03 14:37:27 +00:00
equalHeight: function( assert, accordion, height ) {
accordion.find( ".ui-accordion-content" ).each( function() {
2016-04-03 14:37:27 +00:00
assert.equal( $( this ).outerHeight(), height );
} );
},
2011-08-03 17:52:36 +00:00
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 );
}
};
},
2011-08-03 17:52:36 +00:00
2016-04-03 14:37:27 +00:00
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();
2016-04-03 14:37:27 +00:00
assert.deepEqual( actual, expected );
}
} );
} );