Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic tabs: use buttons rather than links (backport to v4) #33163

Merged
merged 21 commits into from
May 24, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 7 additions & 7 deletions js/tests/unit/tab.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ $(function () {

QUnit.test('should throw explicit error on undefined method', function (assert) {
assert.expect(1)
var $el = $('<div/>')
var $el = $('<div></div>')
alpadev marked this conversation as resolved.
Show resolved Hide resolved
$el.bootstrapTab()
try {
$el.bootstrapTab('noMethod')
Expand All @@ -38,7 +38,7 @@ $(function () {

QUnit.test('should return jquery collection containing the element', function (assert) {
assert.expect(2)
var $el = $('<div/>')
var $el = $('<div></div>')
var $tab = $el.bootstrapTab()
assert.ok($tab instanceof $, 'returns jquery collection')
assert.strictEqual($tab[0], $el[0], 'collection contains element')
Expand All @@ -51,7 +51,7 @@ $(function () {
'<li><button type="button" data-target="#profile" role="tab">Profile</button></li>' +
'</ul>'

$('<ul><li id="home" role="tabpanel"/><li id="profile" role="tabpanel"/></ul>').appendTo('#qunit-fixture')
$('<ul><li id="home" role="tabpanel"></li><li id="profile" role="tabpanel"></li></ul>').appendTo('#qunit-fixture')

$(tabsHTML).find('li:last-child button').bootstrapTab('show')
assert.strictEqual($('#qunit-fixture').find('.active').attr('id'), 'profile')
Expand All @@ -67,7 +67,7 @@ $(function () {
'<li><a href="#profile" role="tab">Profile</a></li>' +
'</ul>'

$('<ul><li id="home" role="tabpanel"/><li id="profile" role="tabpanel"/></ul>').appendTo('#qunit-fixture')
$('<ul><li id="home" role="tabpanel"></li><li id="profile" role="tabpanel"></li></ul>').appendTo('#qunit-fixture')

$(tabsHTML).find('li:last-child a').bootstrapTab('show')
assert.strictEqual($('#qunit-fixture').find('.active').attr('id'), 'profile')
Expand All @@ -83,7 +83,7 @@ $(function () {
'<li><a href="#profile">Profile</a></li>' +
'</ul>'

$('<ul><li id="home"/><li id="profile"/></ul>').appendTo('#qunit-fixture')
$('<ul><li id="home"></li><li id="profile"></li></ul>').appendTo('#qunit-fixture')

$(pillsHTML).find('li:last-child a').bootstrapTab('show')
assert.strictEqual($('#qunit-fixture').find('.active').attr('id'), 'profile')
Expand All @@ -99,7 +99,7 @@ $(function () {
'<li><button type="button" href="#profile" role="tab">Profile</button></li>' +
'</ol>'

$('<ol><li id="home" role="tabpanel"/><li id="profile" role="tabpanel"/></ol>').appendTo('#qunit-fixture')
$('<ol><li id="home" role="tabpanel"></li><li id="profile" role="tabpanel"></li></ol>').appendTo('#qunit-fixture')

$(pillsHTML).find('li:last-child button').bootstrapTab('show')
assert.strictEqual($('#qunit-fixture').find('.active').attr('id'), 'profile')
Expand Down Expand Up @@ -144,7 +144,7 @@ $(function () {
assert.expect(1)
var done = assert.async()

$('<div class="nav"/>')
$('<div class="nav"></div>')
.on('show.bs.tab', function (e) {
e.preventDefault()
assert.ok(true, 'show event fired')
Expand Down