From 32f9a5d6a594aaa4afd62b2410b45804edb737c5 Mon Sep 17 00:00:00 2001 From: Johann-S Date: Fri, 11 Sep 2015 10:45:08 +0200 Subject: [PATCH] fix resetting style on closing collapse --- js/src/collapse.js | 2 +- js/tests/unit/collapse.js | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/js/src/collapse.js b/js/src/collapse.js index e46d3ec604..d95d6f28e9 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 78fafc6c2d..e1bd8855cc 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() + + $('
') + .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()