Skip to content

Commit

Permalink
Add a dropdown test case for twbs#21328
Browse files Browse the repository at this point in the history
  • Loading branch information
pvdlg committed Jan 11, 2017
1 parent 89d2dcb commit 53ddc2a
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions js/tests/unit/dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,24 @@ $(function () {
assert.ok(!$dropdown.parent('.dropdown').hasClass('show'), '"show" class added on click')
})

QUnit.test('should open dropdown if trigger is a link with an href and data-target="#"', function (assert) {
assert.expect(1)
var dropdownHTML = '<ul class="tabs">'
+ '<li class="dropdown">'
+ '<a href="https://getbootstrap.com" data-target="#" class="btn dropdown-toggle" data-toggle="dropdown">Dropdown</a>'
+ '<ul class="dropdown-menu">'
+ '<li><a href="#">Secondary link</a></li>'
+ '<li><a href="#">Something else here</a></li>'
+ '<li class="divider"/>'
+ '<li><a href="#">Another link</a></li>'
+ '</ul>'
+ '</li>'
+ '</ul>'
var $dropdown = $(dropdownHTML).find('[data-toggle="dropdown"]').bootstrapDropdown().trigger('click')

assert.ok($dropdown.parent('.dropdown').hasClass('show'), '"show" class not added on click')
})

QUnit.test('should set aria-expanded="true" on target when dropdown menu is shown', function (assert) {
assert.expect(1)
var dropdownHTML = '<ul class="tabs">'
Expand Down

0 comments on commit 53ddc2a

Please sign in to comment.