aboutsummaryrefslogtreecommitdiff
path: root/js/tests/unit
diff options
context:
space:
mode:
authorChris Rebert <[email protected]>2015-03-06 03:05:30 -0800
committerChris Rebert <[email protected]>2015-03-06 06:58:48 -0800
commit872e56fcf2a7bb1ec936d9e0a5dfed8d31f87590 (patch)
tree551ba9a4d0e7400a9d4bd76ca2a6c53f48d04d1a /js/tests/unit
parent01aa0d840ab4a5a193ebf37446adee79fa81e5ee (diff)
downloadbootstrap-872e56fcf2a7bb1ec936d9e0a5dfed8d31f87590.tar.xz
bootstrap-872e56fcf2a7bb1ec936d9e0a5dfed8d31f87590.zip
.collapse('hide') on hidden uninit-ed collapsible no longer shows it; fixes #15315
Thanks to @peterblazejewicz & @Nikita240 Adds unit tests based on #14417 X-Ref: #14282 Closes #15807
Diffstat (limited to 'js/tests/unit')
-rw-r--r--js/tests/unit/collapse.js32
1 files changed, 30 insertions, 2 deletions
diff --git a/js/tests/unit/collapse.js b/js/tests/unit/collapse.js
index 68c4bce25..40f586c2e 100644
--- a/js/tests/unit/collapse.js
+++ b/js/tests/unit/collapse.js
@@ -147,7 +147,7 @@ $(function () {
$target.click()
})
- QUnit.test('should not close a collapse when initialized with "show" if already shown', function (assert) {
+ QUnit.test('should not close a collapse when initialized with "show" option if already shown', function (assert) {
assert.expect(0)
var done = assert.async()
@@ -162,7 +162,7 @@ $(function () {
setTimeout(done, 0)
})
- QUnit.test('should open a collapse when initialized with "show" if not already shown', function (assert) {
+ QUnit.test('should open a collapse when initialized with "show" option if not already shown', function (assert) {
assert.expect(1)
var done = assert.async()
@@ -177,6 +177,34 @@ $(function () {
setTimeout(done, 0)
})
+ QUnit.test('should not show a collapse when initialized with "hide" option if already hidden', function (assert) {
+ assert.expect(0)
+ var done = assert.async()
+
+ $('<div class="collapse"></div>')
+ .appendTo('#qunit-fixture')
+ .on('show.bs.collapse', function () {
+ assert.ok(false, 'showing a previously-uninitialized hidden collapse when the "hide" method is called')
+ })
+ .bootstrapCollapse('hide')
+
+ setTimeout(done, 0)
+ })
+
+ QUnit.test('should hide a collapse when initialized with "hide" option if not already hidden', function (assert) {
+ assert.expect(1)
+ var done = assert.async()
+
+ $('<div class="collapse in"></div>')
+ .appendTo('#qunit-fixture')
+ .on('hide.bs.collapse', function () {
+ assert.ok(true, 'hiding a previously-uninitialized shown collapse when the "hide" method is called')
+ })
+ .bootstrapCollapse('hide')
+
+ setTimeout(done, 0)
+ })
+
QUnit.test('should remove "collapsed" class from active accordion target', function (assert) {
assert.expect(3)
var done = assert.async()