Skip to content

Commit

Permalink
Merge pull request twbs#17568 from Johann-S/fixCollapseHeight
Browse files Browse the repository at this point in the history
[Fix twbs#17555][V4] fix resetting style on closing collapse
  • Loading branch information
mdo authored Oct 10, 2016
2 parents 4493701 + 32f9a5d commit 4d725c9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion js/src/collapse.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ const Collapse = (($) => {
.trigger(Event.HIDDEN)
}

this._element.style[dimension] = 0
this._element.style[dimension] = ''

if (!Util.supportsTransitionEnd()) {
complete()
Expand Down
15 changes: 15 additions & 0 deletions js/tests/unit/collapse.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,21 @@ $(function () {
.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) {
assert.expect(1)
var done = assert.async()
Expand Down

0 comments on commit 4d725c9

Please sign in to comment.