@@ -2,6 +2,10 @@ function press(input, key, ctrlKey) {
2
2
input . dispatchEvent ( new KeyboardEvent ( 'keydown' , { key, ctrlKey} ) )
3
3
}
4
4
5
+ function click ( element ) {
6
+ element . dispatchEvent ( new MouseEvent ( 'click' , { bubbles : true } ) )
7
+ }
8
+
5
9
describe ( 'combobox-nav' , function ( ) {
6
10
describe ( 'with API' , function ( ) {
7
11
beforeEach ( function ( ) {
@@ -84,6 +88,7 @@ describe('combobox-nav', function() {
84
88
assert . equal ( options [ 4 ] . getAttribute ( 'aria-selected' ) , 'true' )
85
89
assert . equal ( input . getAttribute ( 'aria-activedescendant' ) , 'wall-e' )
86
90
press ( input , 'Enter' )
91
+ click ( options [ 4 ] )
87
92
88
93
press ( input , 'p' , true )
89
94
assert . equal ( options [ 3 ] . getAttribute ( 'aria-selected' ) , 'true' )
@@ -107,9 +112,9 @@ describe('combobox-nav', function() {
107
112
expectedTargets . push ( target . id )
108
113
} )
109
114
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 ] )
113
118
114
119
assert . equal ( expectedTargets . length , 2 )
115
120
assert . equal ( expectedTargets [ 0 ] , 'hubot' )
0 commit comments