Testing jQuery UI Accordion Component Behavior in Brackets
This test helper module provides utility functions for testing jQuery UI accordion components, focusing on height validation, animation control, and state verification.
The suite enables consistent testing of accordion behavior and visual states.
Test Coverage Overview
Implementation Analysis
Technical Details
Best Practices Demonstrated
adobe/brackets
src/extensions/default/JavaScriptQuickEdit/unittest-files/jquery-ui/tests/unit/accordion/accordion_test_helpers.js
TestHelpers.accordion = {
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 );
}
};