From d5071b19f181c1cb4f71ae77ca5effbccca6c66e Mon Sep 17 00:00:00 2001 From: Ivan Cheung Date: Wed, 4 Feb 2015 16:25:57 -0600 Subject: Update all collapse triggers with .collapsed class and aria-expanded Fixes #15741 Closes #15751 by merging it. --- js/tests/unit/collapse.js | 74 +++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 71 insertions(+), 3 deletions(-) (limited to 'js/tests') diff --git a/js/tests/unit/collapse.js b/js/tests/unit/collapse.js index c1a41a45f..8fe367532 100644 --- a/js/tests/unit/collapse.js +++ b/js/tests/unit/collapse.js @@ -80,7 +80,7 @@ $(function () { $('
') .appendTo('#qunit-fixture') .on('shown.bs.collapse', function () { - assert.ok(!$target.hasClass('collapsed')) + assert.ok(!$target.hasClass('collapsed'), 'target does not have collapsed class') done() }) @@ -95,7 +95,41 @@ $(function () { $('
') .appendTo('#qunit-fixture') .on('hidden.bs.collapse', function () { - assert.ok($target.hasClass('collapsed')) + assert.ok($target.hasClass('collapsed'), 'target has collapsed class') + done() + }) + + $target.click() + }) + + QUnit.test('should remove "collapsed" class from all triggers targeting the collapse when the collapse is shown', function (assert) { + var done = assert.async() + + var $target = $('
').appendTo('#qunit-fixture') + var $alt = $('').appendTo('#qunit-fixture') + + $('
') + .appendTo('#qunit-fixture') + .on('hidden.bs.collapse', function () { + assert.ok($target.hasClass('collapsed'), 'target has collapsed class') + assert.ok($alt.hasClass('collapsed'), 'alt trigger has collapsed class') done() }) @@ -230,6 +264,40 @@ $(function () { $target.click() }) + QUnit.test('should set aria-expanded="true" on all triggers targeting the collapse when the collapse is shown', function (assert) { + var done = assert.async() + + var $target = $('