1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-29 16:19:53 +02:00

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
This commit is contained in:
Johann
2017-03-19 00:36:33 +01:00
committed by Mark Otto
parent ab77282004
commit 1a46d8c730
3 changed files with 60 additions and 3 deletions

View File

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