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

fix resetting style on closing collapse

This commit is contained in:
Johann-S 2015-09-11 10:45:08 +02:00
parent 4ee6d99c9d
commit 32f9a5d6a5
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

@ -78,6 +78,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()