From 1d9e3fb1943f44e0982678ed3db11e98fa113fd6 Mon Sep 17 00:00:00 2001 From: "Patrick H. Lauke" Date: Sun, 21 Feb 2021 01:43:13 +0200 Subject: [PATCH 01/16] Manually backport 32630 Dynamic tabs: use buttons rather than links --- js/tests/unit/tab.js | 208 +++++++++++------------ js/tests/visual/tab.html | 57 +++---- scss/_nav.scss | 5 + site/content/docs/4.6/components/navs.md | 86 +++++----- 4 files changed, 177 insertions(+), 179 deletions(-) diff --git a/js/tests/unit/tab.js b/js/tests/unit/tab.js index a0c4ddf15547..a79e3c634788 100644 --- a/js/tests/unit/tab.js +++ b/js/tests/unit/tab.js @@ -44,14 +44,30 @@ $(function () { assert.strictEqual($tab[0], $el[0], 'collection contains element') }) - QUnit.test('should activate element by tab id', function (assert) { + QUnit.test('should activate element by tab id (using buttons, the preferred semantic way)', function (assert) { assert.expect(2) - var tabsHTML = '' - $('').appendTo('#qunit-fixture') + $('').appendTo('#qunit-fixture') $(tabsHTML).find('li:last-child a').bootstrapTab('show') assert.strictEqual($('#qunit-fixture').find('.active').attr('id'), 'profile') @@ -83,7 +83,7 @@ $(function () { '
  • Profile
  • ' + '' - $('').appendTo('#qunit-fixture') + $('').appendTo('#qunit-fixture') $(pillsHTML).find('li:last-child a').bootstrapTab('show') assert.strictEqual($('#qunit-fixture').find('.active').attr('id'), 'profile') @@ -99,7 +99,7 @@ $(function () { '
  • ' + '' - $('
    ').appendTo('#qunit-fixture') + $('
    ').appendTo('#qunit-fixture') $(pillsHTML).find('li:last-child button').bootstrapTab('show') assert.strictEqual($('#qunit-fixture').find('.active').attr('id'), 'profile') @@ -115,7 +115,7 @@ $(function () { '' + '' - $('
    ').appendTo('#qunit-fixture') + $('
    ').appendTo('#qunit-fixture') $(tabsHTML).find('button:last-child').bootstrapTab('show') assert.strictEqual($('#qunit-fixture').find('.active').attr('id'), 'profile') @@ -144,7 +144,7 @@ $(function () { assert.expect(1) var done = assert.async() - $('') + $('