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 +++++++++++++++++++++++++ js/tests/visual/collapse.html | 2 +- 2 files changed, 26 insertions(+), 1 deletion(-) (limited to 'js/tests') 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')) + }) }) diff --git a/js/tests/visual/collapse.html b/js/tests/visual/collapse.html index 1d61ef19c..6b4e89bfb 100644 --- a/js/tests/visual/collapse.html +++ b/js/tests/visual/collapse.html @@ -57,7 +57,7 @@ - + -- cgit v1.2.3