aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorMark Otto <[email protected]>2016-10-09 20:32:40 -0700
committerGitHub <[email protected]>2016-10-09 20:32:40 -0700
commit4d725c90d618f50622960c86704faedf04ea3d7a (patch)
tree305ad7c643090beebdc466f03eb24fa943751b8e /js
parent4493701ee2975a5041d0309ee4f06715f89675cb (diff)
parent32f9a5d6a594aaa4afd62b2410b45804edb737c5 (diff)
downloadbootstrap-4d725c90d618f50622960c86704faedf04ea3d7a.tar.xz
bootstrap-4d725c90d618f50622960c86704faedf04ea3d7a.zip
Merge pull request #17568 from Johann-S/fixCollapseHeight
[Fix #17555][V4] fix resetting style on closing collapse
Diffstat (limited to 'js')
-rw-r--r--js/src/collapse.js2
-rw-r--r--js/tests/unit/collapse.js15
2 files changed, 16 insertions, 1 deletions
diff --git a/js/src/collapse.js b/js/src/collapse.js
index f4b89c37b..3fb0245e7 100644
--- a/js/src/collapse.js
+++ b/js/src/collapse.js
@@ -235,7 +235,7 @@ const Collapse = (($) => {
.trigger(Event.HIDDEN)
}
- this._element.style[dimension] = 0
+ this._element.style[dimension] = ''
if (!Util.supportsTransitionEnd()) {
complete()
diff --git a/js/tests/unit/collapse.js b/js/tests/unit/collapse.js
index 4eadc205b..d387ebb18 100644
--- a/js/tests/unit/collapse.js
+++ b/js/tests/unit/collapse.js
@@ -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()