diff options
| author | Mark Otto <[email protected]> | 2014-08-27 22:38:46 -0700 |
|---|---|---|
| committer | Mark Otto <[email protected]> | 2014-08-27 22:38:46 -0700 |
| commit | f4eefd28d10198ea60ce4069c00236e74cda1bf5 (patch) | |
| tree | 9141bf9c907a2bf7962ca5abdb6f0c8496d8b1ad /js | |
| parent | dfa2759a52e73e720b0cda302a1edb9e2dbebc1f (diff) | |
| parent | 1ebc7e62a8672c59c3bd886bc71ca90e9571d1bc (diff) | |
| download | bootstrap-f4eefd28d10198ea60ce4069c00236e74cda1bf5.tar.xz bootstrap-f4eefd28d10198ea60ce4069c00236e74cda1bf5.zip | |
Merge branch 'master' into sr_friendly_hidden_content
Conflicts:
dist/css/bootstrap.css.map
dist/css/bootstrap.min.css
Diffstat (limited to 'js')
| -rw-r--r-- | js/collapse.js | 2 | ||||
| -rw-r--r-- | js/tests/unit/collapse.js | 32 |
2 files changed, 33 insertions, 1 deletions
diff --git a/js/collapse.js b/js/collapse.js index a265344f4..db89804cb 100644 --- a/js/collapse.js +++ b/js/collapse.js @@ -124,7 +124,7 @@ var data = $this.data('bs.collapse') var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option) - if (!data && options.toggle && option == 'show') option = !option + if (!data && options.toggle && option == 'show') options.toggle = false if (!data) $this.data('bs.collapse', (data = new Collapse(this, options))) if (typeof option == 'string') data[option]() }) diff --git a/js/tests/unit/collapse.js b/js/tests/unit/collapse.js index 8e6bb8273..ffa8f7e6d 100644 --- a/js/tests/unit/collapse.js +++ b/js/tests/unit/collapse.js @@ -102,6 +102,38 @@ $(function () { $target.click() }) + test('should not close a collapse when initialized with "show" if already shown', function () { + stop() + + expect(0) + + var $test = $('<div id="test1" class="in"/>') + .appendTo('#qunit-fixture') + .on('hide.bs.collapse', function () { + ok(false) + }) + + $test.bootstrapCollapse('show') + + setTimeout(start, 0) + }) + + test('should open a collapse when initialized with "show" if not already shown', function () { + stop() + + expect(1) + + var $test = $('<div id="test1" />') + .appendTo('#qunit-fixture') + .on('show.bs.collapse', function () { + ok(true) + }) + + $test.bootstrapCollapse('show') + + setTimeout(start, 0) + }) + test('should remove "collapsed" class from active accordion target', function () { stop() |
