diff options
| author | Pierre Vanduynslager <[email protected]> | 2017-04-08 18:43:25 -0400 |
|---|---|---|
| committer | GitHub <[email protected]> | 2017-04-08 18:43:25 -0400 |
| commit | fe72daf2b34263d3cfc9bc77e9998cd22adfa34d (patch) | |
| tree | 15dc9fc6fcb513362ba112d52ab01b568b423709 /js/tests/unit/tab.js | |
| parent | f5cc59145642d78d7abbdf38fee1905786da5367 (diff) | |
| parent | feb35b94a61c4d6016be8d1773a79a6bbe57d856 (diff) | |
| download | bootstrap-fe72daf2b34263d3cfc9bc77e9998cd22adfa34d.tar.xz bootstrap-fe72daf2b34263d3cfc9bc77e9998cd22adfa34d.zip | |
Merge branch 'v4-dev' into dropdown-keyboard
Diffstat (limited to 'js/tests/unit/tab.js')
| -rw-r--r-- | js/tests/unit/tab.js | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/js/tests/unit/tab.js b/js/tests/unit/tab.js index 734648e9e..1e2b66c04 100644 --- a/js/tests/unit/tab.js +++ b/js/tests/unit/tab.js @@ -46,7 +46,7 @@ $(function () { QUnit.test('should activate element by tab id', function (assert) { assert.expect(2) - var tabsHTML = '<ul class="tabs">' + var tabsHTML = '<ul class="nav">' + '<li><a href="#home">Home</a></li>' + '<li><a href="#profile">Profile</a></li>' + '</ul>' @@ -62,7 +62,7 @@ $(function () { QUnit.test('should activate element by tab id', function (assert) { assert.expect(2) - var pillsHTML = '<ul class="pills">' + var pillsHTML = '<ul class="nav nav-pills">' + '<li><a href="#home">Home</a></li>' + '<li><a href="#profile">Profile</a></li>' + '</ul>' @@ -78,7 +78,7 @@ $(function () { QUnit.test('should activate element by tab id in ordered list', function (assert) { assert.expect(2) - var pillsHTML = '<ol class="pills">' + var pillsHTML = '<ol class="nav nav-pills">' + '<li><a href="#home">Home</a></li>' + '<li><a href="#profile">Profile</a></li>' + '</ol>' @@ -108,11 +108,27 @@ $(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 tabsHTML = '<div class="list-group">' + + '<a href="#home">Home</a>' + + '<a href="#profile">Profile</a>' + + '</div>' + + $('<nav><div id="home"></div><div id="profile"></div></nav>').appendTo('#qunit-fixture') + + $(tabsHTML).find('a:last').bootstrapTab('show') + assert.strictEqual($('#qunit-fixture').find('.active').attr('id'), 'profile') + + $(tabsHTML).find('a:first').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() - $('<div class="tab"/>') + $('<div class="nav"/>') .on('show.bs.tab', function (e) { e.preventDefault() assert.ok(true, 'show event fired') @@ -166,7 +182,7 @@ $(function () { assert.expect(2) var done = assert.async() - var dropHTML = '<ul class="drop">' + var dropHTML = '<ul class="drop nav">' + '<li class="dropdown"><a data-toggle="dropdown" href="#">1</a>' + '<ul class="dropdown-menu">' + '<li><a href="#1-1" data-toggle="tab">1-1</a></li>' @@ -194,7 +210,7 @@ $(function () { assert.expect(2) var done = assert.async() - var tabsHTML = '<ul class="tabs">' + var tabsHTML = '<ul class="nav">' + '<li><a href="#home">Home</a></li>' + '<li><a href="#profile">Profile</a></li>' + '</ul>' @@ -225,7 +241,7 @@ $(function () { assert.expect(1) var done = assert.async() - var tabsHTML = '<ul class="tabs">' + var tabsHTML = '<ul class="nav">' + '<li><a href="#home">Home</a></li>' + '<li><a href="#profile">Profile</a></li>' + '</ul>' @@ -250,7 +266,7 @@ $(function () { assert.expect(2) var done = assert.async() - var tabsHTML = '<ul class="tabs">' + var tabsHTML = '<ul class="nav">' + '<li><a href="#home">Home</a></li>' + '<li><a href="#profile">Profile</a></li>' + '</ul>' |
