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

Merge pull request #17568 from Johann-S/fixCollapseHeight

[Fix #17555][V4] fix resetting style on closing collapse
This commit is contained in:
Mark Otto 2016-10-09 20:32:40 -07:00 committed by GitHub
commit 4d725c90d6
2 changed files with 16 additions and 1 deletions

View File

@ -235,7 +235,7 @@ const Collapse = (($) => {
.trigger(Event.HIDDEN) .trigger(Event.HIDDEN)
} }
this._element.style[dimension] = 0 this._element.style[dimension] = ''
if (!Util.supportsTransitionEnd()) { if (!Util.supportsTransitionEnd()) {
complete() complete()

View File

@ -90,6 +90,21 @@ $(function () {
.bootstrapCollapse('show') .bootstrapCollapse('show')
}) })
QUnit.test('should reset style to auto after finishing closing collapse', function (assert) {
assert.expect(1)
var done = assert.async()
$('<div class="collapse"/>')
.on('shown.bs.collapse', function () {
$(this).bootstrapCollapse('hide')
})
.on('hidden.bs.collapse', function () {
assert.strictEqual(this.style.height, '', 'height is auto')
done()
})
.bootstrapCollapse('show')
})
QUnit.test('should remove "collapsed" class from target when collapse is shown', function (assert) { QUnit.test('should remove "collapsed" class from target when collapse is shown', function (assert) {
assert.expect(1) assert.expect(1)
var done = assert.async() var done = assert.async()