From 5a90b4aa3e102e387839a39fbf0ab1444eebbc76 Mon Sep 17 00:00:00 2001 From: Johann-S Date: Fri, 25 Aug 2017 10:14:18 +0200 Subject: Collapse - preventDefault only on elements not inside the collapsible element --- js/tests/unit/collapse.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'js/tests/unit') diff --git a/js/tests/unit/collapse.js b/js/tests/unit/collapse.js index 4470a18c2..9ecb60994 100644 --- a/js/tests/unit/collapse.js +++ b/js/tests/unit/collapse.js @@ -673,4 +673,29 @@ $(function () { }) $trigger3.trigger('click') }) + + QUnit.test('should not prevent interactions inside the collapse element', function (assert) { + assert.expect(2) + var done = assert.async() + + var $target = $('').appendTo('#qunit-fixture') + var htmlCollapse = + '
' + + ' ' + + '
' + + $(htmlCollapse) + .appendTo('#qunit-fixture') + .on('shown.bs.collapse', function () { + assert.ok($target.prop('checked'), '$trigger is checked') + var $testCheckbox = $('#testCheckbox') + $testCheckbox.trigger($.Event('click')) + setTimeout(function () { + assert.ok($testCheckbox.prop('checked'), '$testCheckbox is checked too') + done() + }, 5) + }) + + $target.trigger($.Event('click')) + }) }) -- cgit v1.2.3