diff options
| author | Johann-S <[email protected]> | 2019-02-13 15:13:53 +0100 |
|---|---|---|
| committer | XhmikosR <[email protected]> | 2019-02-13 17:55:38 +0200 |
| commit | 2ccfa57467c0e31ec2016d1be03c55184ce8a69d (patch) | |
| tree | d04a427b482b3afd5fe0f4da66c5d44b9f824ce0 /js/tests | |
| parent | a43077d3c3b3ef9b2afc426a573b40daeff788fe (diff) | |
| download | bootstrap-2ccfa57467c0e31ec2016d1be03c55184ce8a69d.tar.xz bootstrap-2ccfa57467c0e31ec2016d1be03c55184ce8a69d.zip | |
handle # selector for dropdown
Diffstat (limited to 'js/tests')
| -rw-r--r-- | js/tests/unit/dropdown.js | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/js/tests/unit/dropdown.js b/js/tests/unit/dropdown.js index 566b50ee7..747bf60d9 100644 --- a/js/tests/unit/dropdown.js +++ b/js/tests/unit/dropdown.js @@ -420,4 +420,35 @@ $(function () { assert.ok($dropdown.parent('.btn-group').hasClass('open'), 'dropdown menu is open') }) + + QUnit.test('should handle # in data-target', function (assert) { + assert.expect(1) + var done = assert.async() + + var html = [ + '<div class="dropdown">', + ' <a id="dLabel" data-target="#" href="http://example.com/" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">', + ' Dropdown trigger', + ' </a>', + ' <ul class="dropdown-menu" aria-labelledby="dLabel">', + ' <li><a href="/test">One</a></li>', + ' <li><a href="/test2">Two</a></li>', + ' </ul>', + '</div>' + ].join('') + + var $dropdown = $(html) + .appendTo('#qunit-fixture') + .find('[data-toggle="dropdown"]') + .bootstrapDropdown() + + $dropdown + .parent('.dropdown') + .on('shown.bs.dropdown', function () { + assert.ok($dropdown.parent('.dropdown').hasClass('open'), '"open" class added on click') + done() + }) + + $dropdown.trigger('click') + }) }) |
