aboutsummaryrefslogtreecommitdiff
path: root/js/tests
diff options
context:
space:
mode:
authorJohann-S <[email protected]>2018-09-10 11:01:14 +0200
committerJohann-S <[email protected]>2018-09-10 21:10:00 +0200
commit6e2a823a44063af96749d54560808656e007c2a8 (patch)
tree9e70195b7d4685dd34a1e3c964be92fd3be4e9e7 /js/tests
parentde75bd0a4fea8bc1443173a338e7f6888f82aa1d (diff)
downloadbootstrap-6e2a823a44063af96749d54560808656e007c2a8.tar.xz
bootstrap-6e2a823a44063af96749d54560808656e007c2a8.zip
collapse children with no data-parent
Diffstat (limited to 'js/tests')
-rw-r--r--js/tests/unit/collapse.js34
1 files changed, 34 insertions, 0 deletions
diff --git a/js/tests/unit/collapse.js b/js/tests/unit/collapse.js
index 7f4cedd74..e7fb8893e 100644
--- a/js/tests/unit/collapse.js
+++ b/js/tests/unit/collapse.js
@@ -855,4 +855,38 @@ $(function () {
assert.ok(false, 'collapse not created')
}
})
+
+ QUnit.test('should find collapse children if they have collapse class too not only data-parent', function (assert) {
+ assert.expect(2)
+ var done = assert.async()
+
+ var html =
+ '<div class="my-collapse">' +
+ ' <div class="item">' +
+ ' <a data-toggle="collapse" href="#">Toggle item 1</a>' +
+ ' <div id="collapse1" class="collapse show">Lorem ipsum 1</div>' +
+ ' </div>' +
+ ' <div class="item">' +
+ ' <a id="triggerCollapse2" data-toggle="collapse" href="#">Toggle item 2</a>' +
+ ' <div id="collapse2" class="collapse">Lorem ipsum 2</div>' +
+ ' </div>' +
+ '</div>'
+
+ $(html).appendTo('#qunit-fixture')
+
+ var $parent = $('.my-collapse')
+ var $collapse2 = $('#collapse2')
+ $parent.find('.collapse').bootstrapCollapse({
+ parent: $parent,
+ toggle: false
+ })
+
+ $collapse2.on('shown.bs.collapse', function () {
+ assert.ok($collapse2.hasClass('show'))
+ assert.ok(!$('#collapse1').hasClass('show'))
+ done()
+ })
+
+ $collapse2.bootstrapCollapse('toggle')
+ })
})