]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
fix resetting style on closing collapse 17568/head
authorJohann-S <johann.servoire@gmail.com>
Fri, 11 Sep 2015 08:45:08 +0000 (10:45 +0200)
committerJohann-S <johann.servoire@gmail.com>
Fri, 11 Sep 2015 08:45:08 +0000 (10:45 +0200)
js/src/collapse.js
js/tests/unit/collapse.js

index e46d3ec60426ccdf72feda21f2709cd75e4a1163..d95d6f28e92291de7e90a6a742c0ddf511d2db1c 100644 (file)
@@ -235,7 +235,7 @@ const Collapse = (($) => {
           .trigger(Event.HIDDEN)
       }
 
-      this._element.style[dimension] = 0
+      this._element.style[dimension] = ''
 
       if (!Util.supportsTransitionEnd()) {
         complete()
index 78fafc6c2d8826d4e6724413f3e370da7770ea78..e1bd8855cc7e40210d891f4dd885971dcf9308dc 100644 (file)
@@ -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()