define( [ "qunit", "jquery", "./helper", "ui/widgets/accordion" ], function( QUnit, $, testHelper ) { var equalHeight = testHelper.equalHeight, beforeAfterEach = testHelper.beforeAfterEach, state = testHelper.state; QUnit.module( "accordion: methods", beforeAfterEach() ); QUnit.test( "destroy", function( assert ) { assert.expect( 1 ); assert.domEqual( "#list1", function() { $( "#list1" ).accordion().accordion( "destroy" ); } ); } ); QUnit.test( "enable/disable", function( assert ) { assert.expect( 7 ); var element = $( "#list1" ).accordion(); state( assert, element, 1, 0, 0 ); element.accordion( "disable" ); assert.hasClasses( element, "ui-state-disabled" ); assert.equal( element.attr( "aria-disabled" ), "true", "element gets aria-disabled" ); assert.hasClasses( element, "ui-accordion-disabled" ); // Event does nothing element.find( ".ui-accordion-header" ).eq( 1 ).trigger( "click" ); state( assert, element, 1, 0, 0 ); // Option still works element.accordion( "option", "active", 1 ); state( assert, element, 0, 1, 0 ); element.accordion( "enable" ); element.accordion( "option", "active", 2 ); state( assert, element, 0, 0, 1 ); } ); QUnit.test( "refresh", function( assert ) { assert.expect( 19 ); var element = $( "#navigation" ) .parent() .height( 300 ) .end() .accordion( { heightStyle: "fill" } ); equalHeight( assert, element, 255 ); element.parent().height( 500 ); element.accordion( "refresh" ); equalHeight( assert, element, 455 ); element = $( "#list1" ); element.accordion(); state( assert, element, 1, 0, 0 ); // Disable panel via markup element.find( "h3.bar" ).eq( 1 ).addClass( "ui-state-disabled" ); element.accordion( "refresh" ); state( assert, element, 1, 0, 0 ); // Don't add multiple icons element.accordion( "refresh" ); assert.equal( element.find( ".ui-accordion-header-icon" ).length, 3 ); // Add a panel element .append( "