Skip to content

Commit c906521

Browse files
committed
Add test for clicking on disabled item
1 parent 235b3ec commit c906521

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

test/test.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ function press(input, key, ctrlKey) {
22
input.dispatchEvent(new KeyboardEvent('keydown', {key, ctrlKey}))
33
}
44

5+
function click(element) {
6+
element.dispatchEvent(new MouseEvent('click', {bubbles: true}))
7+
}
8+
59
describe('combobox-nav', function() {
610
describe('with API', function() {
711
beforeEach(function() {
@@ -84,6 +88,7 @@ describe('combobox-nav', function() {
8488
assert.equal(options[4].getAttribute('aria-selected'), 'true')
8589
assert.equal(input.getAttribute('aria-activedescendant'), 'wall-e')
8690
press(input, 'Enter')
91+
click(options[4])
8792

8893
press(input, 'p', true)
8994
assert.equal(options[3].getAttribute('aria-selected'), 'true')
@@ -107,9 +112,9 @@ describe('combobox-nav', function() {
107112
expectedTargets.push(target.id)
108113
})
109114

110-
options[2].dispatchEvent(new MouseEvent('click', {bubbles: true}))
111-
options[1].dispatchEvent(new MouseEvent('click', {bubbles: true}))
112-
options[0].dispatchEvent(new MouseEvent('click', {bubbles: true}))
115+
click(options[2])
116+
click(options[1])
117+
click(options[0])
113118

114119
assert.equal(expectedTargets.length, 2)
115120
assert.equal(expectedTargets[0], 'hubot')

0 commit comments

Comments
 (0)