aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohann-S <[email protected]>2015-09-11 10:45:08 +0200
committerJohann-S <[email protected]>2015-09-11 10:45:08 +0200
commit32f9a5d6a594aaa4afd62b2410b45804edb737c5 (patch)
tree5c5e03e1b12203a6543f1b4fb220bfeaa83c727e
parent4ee6d99c9d7dcba154772c7c8c3901fbe3cb0b04 (diff)
downloadbootstrap-32f9a5d6a594aaa4afd62b2410b45804edb737c5.tar.xz
bootstrap-32f9a5d6a594aaa4afd62b2410b45804edb737c5.zip
fix resetting style on closing collapse
-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 e46d3ec60..d95d6f28e 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 78fafc6c2..e1bd8855c 100644
--- a/js/tests/unit/collapse.js
+++ b/js/tests/unit/collapse.js
@@ -78,6 +78,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()