aboutsummaryrefslogtreecommitdiff
path: root/js/tests/unit/tab.js
diff options
context:
space:
mode:
authorPierre-Denis Vanduynslager <[email protected]>2017-01-04 12:22:06 -0500
committerPierre-Denis Vanduynslager <[email protected]>2017-01-04 12:22:06 -0500
commitc4867cfedb6235708967aa8518c59ffed2816f0b (patch)
treec7be6d18ee7c7a61f319bccacc035b9952171db1 /js/tests/unit/tab.js
parent425d156df27fa6c18e979aa000bfe5a346ee3450 (diff)
parent1b194c06607f6cc3d087d25d6d49e1698771f3a1 (diff)
downloadbootstrap-c4867cfedb6235708967aa8518c59ffed2816f0b.tar.xz
bootstrap-c4867cfedb6235708967aa8518c59ffed2816f0b.zip
Merge branch 'twbs/v4-dev' into dropdown-keyboard
# Conflicts: # js/src/dropdown.js
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 62eece896..734648e9e 100644
--- a/js/tests/unit/tab.js
+++ b/js/tests/unit/tab.js
@@ -92,6 +92,22 @@ $(function () {
assert.strictEqual($('#qunit-fixture').find('.active').attr('id'), 'home')
})
+ QUnit.test('should activate element by tab id in nav list', function (assert) {
+ assert.expect(2)
+ var tabsHTML = '<nav class="nav">' +
+ '<a href="#home">Home</a>' +
+ '<a href="#profile">Profile</a>' +
+ '</nav>'
+
+ $('<nav><div id="home"></div><div id="profile"></div></nav>').appendTo('#qunit-fixture')
+
+ $(tabsHTML).find('a:last').bootstrapTab('show')
+ assert.strictEqual($('#qunit-fixture').find('.active').attr('id'), 'profile')
+
+ $(tabsHTML).find('a:first').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()