From ae71e71fe1fa3bdbdec33c9eb19b76c346d4d5ff Mon Sep 17 00:00:00 2001 From: Martijn Cuppens Date: Sun, 31 Dec 2017 13:53:33 +0100 Subject: Allow nested structure for accordions (#25121) This commit allows nested structures for accordions. Also a part of the documentation about data-children is removed because this functionality didn't work and it's not applicable anymore. Tests with the collapse accordion are also a bit adjusted to the new situation. --- js/tests/unit/collapse.js | 58 +++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 48 insertions(+), 10 deletions(-) (limited to 'js/tests') diff --git a/js/tests/unit/collapse.js b/js/tests/unit/collapse.js index f20c0809c..337ec647b 100644 --- a/js/tests/unit/collapse.js +++ b/js/tests/unit/collapse.js @@ -516,12 +516,50 @@ $(function () { var done = assert.async() var accordionHTML = '
' + '
' - + '' - + '
' + + '' + + '
' + '
' + '
' - + '' - + '
' + + '' + + '
' + + '
' + + '
' + + $(accordionHTML).appendTo('#qunit-fixture') + var $trigger = $('#linkTrigger') + var $triggerTwo = $('#linkTriggerTwo') + var $collapseOne = $('#collapseOne') + var $collapseTwo = $('#collapseTwo') + $collapseOne.on('shown.bs.collapse', function () { + assert.ok($collapseOne.hasClass('show'), '#collapseOne is shown') + assert.ok(!$collapseTwo.hasClass('show'), '#collapseTwo is not shown') + $collapseTwo.on('shown.bs.collapse', function () { + assert.ok(!$collapseOne.hasClass('show'), '#collapseOne is not shown') + assert.ok($collapseTwo.hasClass('show'), '#collapseTwo is shown') + done() + }) + $triggerTwo.trigger($.Event('click')) + }) + $trigger.trigger($.Event('click')) + }) + + QUnit.test('should allow accordion to contain nested elements', function (assert) { + assert.expect(4) + var done = assert.async() + var accordionHTML = '
' + + '
' + + '
' + + '
' + + '' + + '
' + + '
' + + '
' + + '
' + + '
' + + '' + + '
' + + '
' + + '
' + '
' + '
' @@ -548,20 +586,20 @@ $(function () { var done = assert.async() $('
' + '
' - + '' - + '
' + + '' + + '
' + '
' + '
' - + '' - + '
' + + '' + + '
' + '
' + '
' + '
' + '
' + '
' + '
' - + '' - + '
' + + '' + + '
' + '
' + '
').appendTo('#qunit-fixture') var $trigger = $('#linkTrigger') -- cgit v1.2.3