1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-26 06:44:35 +02:00

Allow to use nav with tab JS

This commit is contained in:
Johann-S
2016-12-28 11:58:50 +01:00
committed by Mark Otto
parent d935cca9f6
commit 026e1a1421
3 changed files with 50 additions and 1 deletions

View File

@@ -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()