From edf90c1bc4ec7c081cdb891a7c10dfaf6b1832e7 Mon Sep 17 00:00:00 2001 From: Johann-S Date: Mon, 17 Jul 2017 10:05:45 +0200 Subject: [PATCH] Add unit test for nested tabs --- js/tests/unit/tab.js | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/js/tests/unit/tab.js b/js/tests/unit/tab.js index 1e2b66c048..3a7c1bb785 100644 --- a/js/tests/unit/tab.js +++ b/js/tests/unit/tab.js @@ -343,4 +343,42 @@ $(function () { assert.notOk($tabs.find('li:last > a').hasClass('active')) assert.notOk($tabs.find('li:last > .dropdown-menu > a:first').hasClass('active')) }) + + QUnit.test('Nested tabs', function (assert) { + assert.expect(2) + var done = assert.async() + var tabsHTML = + '' + + '
' + + '
' + + ' ' + + '
' + + '
Nested Tab1 Content
' + + '
Nested Tab2 Content
' + + '
' + + '
' + + '
Tab2 Content
' + + '
Tab3 Content
' + + '
' + + $(tabsHTML).appendTo('#qunit-fixture') + + $('#tabNested2').on('shown.bs.tab', function () { + assert.ok($('#x-tab1').hasClass('active')) + done() + }) + + $('#tab1').on('shown.bs.tab', function () { + assert.ok($('#x-tab1').hasClass('active')) + $('#tabNested2').trigger($.Event('click')) + }) + .trigger($.Event('click')) + }) })