2015-04-07 14:30:07 +00:00
|
|
|
define( [
|
2016-04-03 14:37:27 +00:00
|
|
|
"qunit",
|
2015-04-07 14:30:07 +00:00
|
|
|
"jquery",
|
|
|
|
"lib/helper",
|
2015-07-15 01:54:33 +00:00
|
|
|
"ui/widgets/accordion"
|
2016-04-03 14:37:27 +00:00
|
|
|
], function( QUnit, $, helper ) {
|
2021-06-06 22:58:12 +00:00
|
|
|
"use strict";
|
2015-04-03 19:24:09 +00:00
|
|
|
|
2015-04-07 14:30:07 +00:00
|
|
|
return $.extend( helper, {
|
2016-04-03 14:37:27 +00:00
|
|
|
equalHeight: function( assert, accordion, height ) {
|
2015-08-21 04:12:07 +00:00
|
|
|
accordion.find( ".ui-accordion-content" ).each( function() {
|
2016-04-03 14:37:27 +00:00
|
|
|
assert.equal( $( this ).outerHeight(), height );
|
2015-08-21 04:12:07 +00:00
|
|
|
} );
|
2012-04-19 15:37:33 +00:00
|
|
|
},
|
2011-08-03 17:52:36 +00:00
|
|
|
|
2020-05-16 07:16:24 +00:00
|
|
|
beforeAfterEach: function() {
|
2012-04-19 15:37:33 +00:00
|
|
|
var animate = $.ui.accordion.prototype.options.animate;
|
|
|
|
return {
|
2020-05-16 07:16:24 +00:00
|
|
|
beforeEach: function() {
|
2012-04-19 15:37:33 +00:00
|
|
|
$.ui.accordion.prototype.options.animate = false;
|
|
|
|
},
|
2020-05-16 07:16:24 +00:00
|
|
|
afterEach: function() {
|
2012-04-19 15:37:33 +00:00
|
|
|
$.ui.accordion.prototype.options.animate = animate;
|
2020-05-16 07:16:24 +00:00
|
|
|
return helper.moduleAfterEach.apply( this, arguments );
|
2012-04-19 15:37:33 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
},
|
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 ),
|
2015-08-21 04:12:07 +00:00
|
|
|
actual = accordion.find( ".ui-accordion-content" ).map( function() {
|
2015-04-03 19:24:09 +00:00
|
|
|
return $( this ).css( "display" ) === "none" ? 0 : 1;
|
2015-08-21 04:12:07 +00:00
|
|
|
} ).get();
|
2016-04-03 14:37:27 +00:00
|
|
|
assert.deepEqual( actual, expected );
|
2012-04-19 15:37:33 +00:00
|
|
|
}
|
2015-04-07 14:30:07 +00:00
|
|
|
} );
|
2015-04-03 19:24:09 +00:00
|
|
|
|
|
|
|
} );
|