0
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-01-17 09:52:29 +01:00

Collapse - Fix check to not prevent event for input and textarea

This commit is contained in:
Johann-S 2017-03-29 00:10:27 +02:00 committed by GitHub
parent 48c5efa4c3
commit fb42d6e043
2 changed files with 3 additions and 2 deletions

View File

@ -357,7 +357,7 @@ const Collapse = (($) => {
*/
$(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
if (/input|textarea/i.test(event.target.tagName)) {
if (!/input|textarea/i.test(event.target.tagName)) {
event.preventDefault()
}

View File

@ -515,13 +515,14 @@ $(function () {
})
QUnit.test('should not prevent event for input', function (assert) {
assert.expect(2)
assert.expect(3)
var done = assert.async()
var $target = $('<input type="checkbox" data-toggle="collapse" data-target="#collapsediv1" />').appendTo('#qunit-fixture')
$('<div id="collapsediv1"/>')
.appendTo('#qunit-fixture')
.on('shown.bs.collapse', function () {
assert.ok($(this).hasClass('show'))
assert.ok($target.attr('aria-expanded') === 'true')
assert.ok($target.prop('checked'))
done()