Skip to content

Commit acb509f

Browse files
committed
Add test for link clicks through
1 parent 1f287ba commit acb509f

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

test/test.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ describe('combobox-nav', function() {
5151
<li id="hubot" role="option">Hubot</li>
5252
<li id="r2-d2" role="option">R2-D2</li>
5353
<li id="wall-e" role="option" aria-disabled="true">Wall-E</li>
54+
<li><a href="#wall-e" role="option">Wall-E</a></li>
5455
</ul>
5556
`
5657
comboboxNav.install(document.querySelector('input'), document.querySelector('ul'))
@@ -120,5 +121,16 @@ describe('combobox-nav', function() {
120121
assert.equal(expectedTargets[0], 'hubot')
121122
assert.equal(expectedTargets[1], 'baymax')
122123
})
124+
125+
it('fires event and follows the link on click', function() {
126+
let eventFired = false
127+
document.addEventListener('combobox-commit', function() {
128+
eventFired = true
129+
})
130+
131+
click(document.querySelectorAll('[role=option]')[4])
132+
assert(eventFired)
133+
assert.equal(window.location.hash, '#wall-e')
134+
})
123135
})
124136
})

0 commit comments

Comments
 (0)