Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/bootstrap.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlessandro Chitolina <alekitto@gmail.com>2017-11-25 18:07:41 +0300
committerJohann-S <johann.servoire@gmail.com>2017-11-26 22:29:19 +0300
commit80d4a51e79b951f11f61ed7a302d331b7942c920 (patch)
treec4256df1db7a7c4cd5ccb363e3bf9fed2715c476 /js/tests/unit
parent544b3ee954179f7cfbd25f8dd7894394ca834105 (diff)
tab.js: do not remove fade class if there's no initial active pane
Diffstat (limited to 'js/tests/unit')
-rw-r--r--js/tests/unit/tab.js33
1 files changed, 33 insertions, 0 deletions
diff --git a/js/tests/unit/tab.js b/js/tests/unit/tab.js
index c26f076009..ee88bad305 100644
--- a/js/tests/unit/tab.js
+++ b/js/tests/unit/tab.js
@@ -382,4 +382,37 @@ $(function () {
})
.trigger($.Event('click'))
})
+
+ QUnit.test('should not remove fade class if no active pane is present', function (assert) {
+ assert.expect(6)
+ var done = assert.async()
+ var tabsHTML = '<ul class="nav nav-tabs" role="tablist">'
+ + '<li class="nav-item"><a id="tab-home" href="#home" class="nav-link" data-toggle="tab" role="tab">Home</a></li>'
+ + '<li class="nav-item"><a id="tab-profile" href="#profile" class="nav-link" data-toggle="tab" role="tab">Profile</a></li>'
+ + '</ul>'
+ + '<div class="tab-content">'
+ + '<div class="tab-pane fade" id="home" role="tabpanel"></div>'
+ + '<div class="tab-pane fade" id="profile" role="tabpanel"></div>'
+ + '</div>'
+
+
+ $(tabsHTML).appendTo('#qunit-fixture')
+ $('#tab-profile')
+ .on('shown.bs.tab', function () {
+ assert.ok($('#profile').hasClass('fade'))
+ assert.ok($('#profile').hasClass('show'))
+
+ $('#tab-home')
+ .on('shown.bs.tab', function () {
+ assert.ok($('#profile').hasClass('fade'))
+ assert.notOk($('#profile').hasClass('show'))
+ assert.ok($('#home').hasClass('fade'))
+ assert.ok($('#home').hasClass('show'))
+
+ done()
+ })
+ .trigger($.Event('click'))
+ })
+ .trigger($.Event('click'))
+ })
})