aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/accordion
diff options
context:
space:
mode:
authorAlexander Schmitz <arschmitz@gmail.com>2014-12-03 11:23:19 -0500
committerAlexander Schmitz <arschmitz@gmail.com>2015-03-11 16:01:44 -0400
commit7c6a7d71e98cbeea21bfc1560f8a82484a3c9510 (patch)
tree4a83647eb2c9c8ae49acc5fc4fdfd93734f00b23 /tests/unit/accordion
parentc192d4086d9bbaf09d5f870857af30c60a427e22 (diff)
downloadjquery-ui-7c6a7d71e98cbeea21bfc1560f8a82484a3c9510.tar.gz
jquery-ui-7c6a7d71e98cbeea21bfc1560f8a82484a3c9510.zip
Accordion: Add classes option
Ref #7053 Ref gh-1411
Diffstat (limited to 'tests/unit/accordion')
-rw-r--r--tests/unit/accordion/accordion.html1
-rw-r--r--tests/unit/accordion/accordion_common.js6
-rw-r--r--tests/unit/accordion/accordion_core.js28
3 files changed, 26 insertions, 9 deletions
diff --git a/tests/unit/accordion/accordion.html b/tests/unit/accordion/accordion.html
index 0a8755fd3..9ea2d3645 100644
--- a/tests/unit/accordion/accordion.html
+++ b/tests/unit/accordion/accordion.html
@@ -9,6 +9,7 @@
<script src="../../../external/qunit/qunit.js"></script>
<script src="../../../external/jquery-simulate/jquery.simulate.js"></script>
<script src="../testsuite.js"></script>
+ <script src="../../../external/qunit-assert-classes/qunit-assert-classes.js"></script>
<script>
TestHelpers.loadResources({
css: [ "core", "accordion" ],
diff --git a/tests/unit/accordion/accordion_common.js b/tests/unit/accordion/accordion_common.js
index 70e04e847..fb80ef353 100644
--- a/tests/unit/accordion/accordion_common.js
+++ b/tests/unit/accordion/accordion_common.js
@@ -2,7 +2,11 @@ TestHelpers.commonWidgetTests( "accordion", {
defaults: {
active: 0,
animate: {},
- classes: {},
+ classes: {
+ "ui-accordion-header": "ui-corner-top",
+ "ui-accordion-header-collapsed": "ui-corner-all",
+ "ui-accordion-content": "ui-corner-bottom"
+ },
collapsible: false,
disabled: false,
event: "click",
diff --git a/tests/unit/accordion/accordion_core.js b/tests/unit/accordion/accordion_core.js
index 721d15487..ea5959e9a 100644
--- a/tests/unit/accordion/accordion_core.js
+++ b/tests/unit/accordion/accordion_core.js
@@ -6,14 +6,26 @@ var setupTeardown = TestHelpers.accordion.setupTeardown,
module( "accordion: core", setupTeardown() );
$.each( { div: "#list1", ul: "#navigation", dl: "#accordion-dl" }, function( type, selector ) {
- test( "markup structure: " + type, function() {
- expect( 4 );
- var element = $( selector ).accordion();
- ok( element.hasClass( "ui-accordion" ), "main element is .ui-accordion" );
- equal( element.find( ".ui-accordion-header" ).length, 3,
- ".ui-accordion-header elements exist, correct number" );
- equal( element.find( ".ui-accordion-content" ).length, 3,
- ".ui-accordion-content elements exist, correct number" );
+
+ test( "markup structure: " + type, function( assert ) {
+ expect( 10 );
+ var element = $( selector ).accordion(),
+ headers = element.find( ".ui-accordion-header" ),
+ content = headers.next();
+
+ assert.hasClasses( element, "ui-accordion ui-widget" );
+ equal( headers.length, 3, ".ui-accordion-header elements exist, correct number" );
+ assert.hasClasses( headers[ 0 ],
+ "ui-accordion-header ui-accordion-header-active ui-accordion-icons" );
+ assert.hasClasses( headers[ 1 ],
+ "ui-accordion-header ui-accordion-header-collapsed ui-accordion-icons" );
+ assert.hasClasses( headers[ 2 ],
+ "ui-accordion-header ui-accordion-header-collapsed ui-accordion-icons" );
+ equal( content.length, 3, ".ui-accordion-content elements exist, correct number" );
+ assert.hasClasses( content[ 0 ],
+ "ui-accordion-content ui-widget-content ui-accordion-content-active" );
+ assert.hasClasses( content[ 1 ], "ui-accordion-content ui-widget-content" );
+ assert.hasClasses( content[ 2 ], "ui-accordion-content ui-widget-content" );
deepEqual( element.find( ".ui-accordion-header" ).next().get(),
element.find( ".ui-accordion-content" ).get(),
"content panels come immediately after headers" );