diff options
author | Carson Sievert <cpsievert1@gmail.com> | 2021-04-28 07:02:22 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-28 07:02:22 +0300 |
commit | 4b5eb3ca5166f959815c626af5587b9192336ef5 (patch) | |
tree | a5aca0eab70b0253d815c089ddc19f54e0519466 /js/tests | |
parent | d9675539139c21503dce7e3c567dbaac856bb138 (diff) |
Backport #33634 (#33649)
Dropdown: support `.dropdown-item` wrapped in `<li>` tags
Diffstat (limited to 'js/tests')
-rw-r--r-- | js/tests/unit/tab.js | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/js/tests/unit/tab.js b/js/tests/unit/tab.js index a0c4ddf155..9c9b286f04 100644 --- a/js/tests/unit/tab.js +++ b/js/tests/unit/tab.js @@ -345,6 +345,28 @@ $(function () { assert.notOk($tabs.find('li:last-child .dropdown-menu a:first-child').hasClass('active')) }) + QUnit.test('should support li > .dropdown-item', function (assert) { + assert.expect(2) + var tabsHTML = [ + '<ul class="nav nav-tabs">', + ' <li class="nav-item"><a class="nav-link active" href="#home" data-toggle="tab">Home</a></li>', + ' <li class="nav-item"><a class="nav-link" href="#profile" data-toggle="tab">Profile</a></li>', + ' <li class="nav-item dropdown">', + ' <a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#">Dropdown</a>', + ' <ul class="dropdown-menu">', + ' <li><a class="dropdown-item" href="#dropdown1" id="dropdown1-tab" data-toggle="tab">@fat</a></li>', + ' <li><a class="dropdown-item" href="#dropdown2" id="dropdown2-tab" data-toggle="tab">@mdo</a></li>', + ' </ul>', + ' </li>', + '</ul>' + ].join('') + var $tabs = $(tabsHTML).appendTo('#qunit-fixture') + + $tabs.find('.dropdown-item').trigger('click') + assert.ok($tabs.find('.dropdown-item').hasClass('active')) + assert.notOk($tabs.find('.nav-link:not(.dropdown-toggle)').hasClass('active')) + }) + QUnit.test('Nested tabs', function (assert) { assert.expect(2) var done = assert.async() |