mirror of
https://github.com/twbs/bootstrap.git
synced 2025-01-29 21:52:22 +01:00
Collapse - Fix check to not prevent event for input and textarea
This commit is contained in:
parent
48c5efa4c3
commit
fb42d6e043
@ -357,7 +357,7 @@ const Collapse = (($) => {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
$(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
|
$(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()
|
event.preventDefault()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -515,13 +515,14 @@ $(function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
QUnit.test('should not prevent event for input', function (assert) {
|
QUnit.test('should not prevent event for input', function (assert) {
|
||||||
assert.expect(2)
|
assert.expect(3)
|
||||||
var done = assert.async()
|
var done = assert.async()
|
||||||
var $target = $('<input type="checkbox" data-toggle="collapse" data-target="#collapsediv1" />').appendTo('#qunit-fixture')
|
var $target = $('<input type="checkbox" data-toggle="collapse" data-target="#collapsediv1" />').appendTo('#qunit-fixture')
|
||||||
|
|
||||||
$('<div id="collapsediv1"/>')
|
$('<div id="collapsediv1"/>')
|
||||||
.appendTo('#qunit-fixture')
|
.appendTo('#qunit-fixture')
|
||||||
.on('shown.bs.collapse', function () {
|
.on('shown.bs.collapse', function () {
|
||||||
|
assert.ok($(this).hasClass('show'))
|
||||||
assert.ok($target.attr('aria-expanded') === 'true')
|
assert.ok($target.attr('aria-expanded') === 'true')
|
||||||
assert.ok($target.prop('checked'))
|
assert.ok($target.prop('checked'))
|
||||||
done()
|
done()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user