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:
authorJohann <johann.servoire@gmail.com>2017-03-19 02:36:33 +0300
committerMark Otto <markd.otto@gmail.com>2017-03-19 02:36:33 +0300
commit1a46d8c7309092566c2da8cbaa9999ae0a1bacc7 (patch)
treecba4fd518ad29333231f3934a2db3081cf8e3b68 /js/tests/unit/tab.js
parentab77282004a6534ed050d78b9699c84068de547a (diff)
Allow to use Tab.js with list-group (#21756)
* Allow to use Tab.js with list-group * Allow to use list-group with div parent instead of an ul parent
Diffstat (limited to 'js/tests/unit/tab.js')
-rw-r--r--js/tests/unit/tab.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/js/tests/unit/tab.js b/js/tests/unit/tab.js
index 734648e9ec..d0aeb372b6 100644
--- a/js/tests/unit/tab.js
+++ b/js/tests/unit/tab.js
@@ -108,6 +108,22 @@ $(function () {
assert.strictEqual($('#qunit-fixture').find('.active').attr('id'), 'home')
})
+ QUnit.test('should activate element by tab id in list-group', function (assert) {
+ assert.expect(2)
+ var ulHTML = '<ul class="list-group">' +
+ '<li class="list-group-item"><a href="#home">Home</a></li>' +
+ '<li class="list-group-item"><a href="#profile">Profile</a></li>' +
+ '</ul>'
+
+ $('<ul><li id="home"></li><li id="profile"></div></li>').appendTo('#qunit-fixture')
+
+ $(ulHTML).find('li:last a').bootstrapTab('show')
+ assert.strictEqual($('#qunit-fixture').find('.active').attr('id'), 'profile')
+
+ $(ulHTML).find('li:first a').bootstrapTab('show')
+ assert.strictEqual($('#qunit-fixture').find('.active').attr('id'), 'home')
+ })
+
QUnit.test('should not fire shown when show is prevented', function (assert) {
assert.expect(1)
var done = assert.async()