@@ -68,16 +68,16 @@ module.exports = {
68
68
assert . ok ( ! editor . container . querySelector ( "style" ) ) ;
69
69
70
70
sendKey ( "a" ) ;
71
- checkInnerHTML ( '<d "ace_line ace_selected" role="option" aria-roledescription="item" aria-label="arraysort, local" aria- setsize="2" aria-describedby="doc-tooltip" aria-posinset="1" id="suggest-aria-id:0" aria-selected="true"><s "ace_completion-highlight" role="mark">a</s><s "ace_">rraysort</s><s "ace_completion-spacer"> </s><s "ace_completion-meta">local</s></d><d "ace_line" role="option" aria-roledescription="item" aria-label="alooooooooooooooooooooooooooooong_word, local" aria- setsize="2" aria-describedby="doc-tooltip" aria-posinset="2"><s "ace_completion-highlight" role="mark">a</s><s "ace_">looooooooooooooooooooooooooooong_word</s><s "ace_completion-spacer"> </s><s "ace_completion-meta">local</s></d>' , function ( ) {
71
+ checkInnerHTML ( '<d "ace_line ace_selected" role="option" aria-roledescription="item" aria-setsize="2" aria-describedby="doc-tooltip" aria-posinset="1" aria-label="arraysort, local" id="suggest-aria-id:0" aria-selected="true"><s "ace_completion-highlight" role="mark">a</s><s "ace_">rraysort</s><s "ace_completion-spacer"> </s><s "ace_completion-meta">local</s></d><d "ace_line" role="option" aria-roledescription="item" aria-setsize="2" aria-describedby="doc-tooltip" aria-posinset="2" aria-label="alooooooooooooooooooooooooooooong_word, local "><s "ace_completion-highlight" role="mark">a</s><s "ace_">looooooooooooooooooooooooooooong_word</s><s "ace_completion-spacer"> </s><s "ace_completion-meta">local</s></d>' , function ( ) {
72
72
sendKey ( "rr" ) ;
73
- checkInnerHTML ( '<d "ace_line ace_selected" role="option" aria-roledescription="item" aria-label="arraysort, local" aria- setsize="1" aria-describedby="doc-tooltip" aria-posinset="1" id="suggest-aria-id:0" aria-selected="true"><s "ace_completion-highlight" role="mark">arr</s><s "ace_">aysort</s><s "ace_completion-spacer"> </s><s "ace_completion-meta">local</s></d>' , function ( ) {
73
+ checkInnerHTML ( '<d "ace_line ace_selected" role="option" aria-roledescription="item" aria-setsize="1" aria-describedby="doc-tooltip" aria-posinset="1" aria-label="arraysort, local" id="suggest-aria-id:0" aria-selected="true"><s "ace_completion-highlight" role="mark">arr</s><s "ace_">aysort</s><s "ace_completion-spacer"> </s><s "ace_completion-meta">local</s></d>' , function ( ) {
74
74
sendKey ( "r" ) ;
75
- checkInnerHTML ( '<d "ace_line ace_selected" role="option" aria-roledescription="item" aria-label="arraysort, local" aria- setsize="1" aria-describedby="doc-tooltip" aria-posinset="1" id="suggest-aria-id:0" aria-selected="true"><s "ace_completion-highlight" role="mark">arr</s><s "ace_">ayso</s><s "ace_completion-highlight" role="mark">r</s><s "ace_">t</s><s "ace_completion-spacer"> </s><s "ace_completion-meta">local</s></d>' , function ( ) {
76
-
75
+ checkInnerHTML ( '<d "ace_line ace_selected" role="option" aria-roledescription="item" aria-setsize="1" aria-describedby="doc-tooltip" aria-posinset="1" aria-label="arraysort, local" id="suggest-aria-id:0" aria-selected="true"><s "ace_completion-highlight" role="mark">arr</s><s "ace_">ayso</s><s "ace_completion-highlight" role="mark">r</s><s "ace_">t</s><s "ace_completion-spacer"> </s><s "ace_completion-meta">local</s></d>' , function ( ) {
76
+
77
77
sendKey ( "Return" ) ;
78
78
assert . equal ( editor . getValue ( ) , "arraysort\narraysort alooooooooooooooooooooooooooooong_word" ) ;
79
79
editor . execCommand ( "insertstring" , " looooooooooooooooooooooooooooong_" ) ;
80
- checkInnerHTML ( '<d "ace_line ace_selected" role="option" aria-roledescription="item" aria-label="alooooooooooooooooooooooooooooong_word, local" aria- setsize="1" aria-describedby="doc-tooltip" aria-posinset="1" id="suggest-aria-id:0" aria-selected="true"><s "ace_">a</s><s "ace_completion-highlight" role="mark">looooooooooooooooooooooooooooong_</s><s "ace_">word</s><s "ace_completion-spacer"> </s><s "ace_completion-meta">local</s></d>' , function ( ) {
80
+ checkInnerHTML ( '<d "ace_line ace_selected" role="option" aria-roledescription="item" aria-setsize="1" aria-describedby="doc-tooltip" aria-posinset="1" aria-label="alooooooooooooooooooooooooooooong_word, local" id="suggest-aria-id:0" aria-selected="true"><s "ace_">a</s><s "ace_completion-highlight" role="mark">looooooooooooooooooooooooooooong_</s><s "ace_">word</s><s "ace_completion-spacer"> </s><s "ace_completion-meta">local</s></d>' , function ( ) {
81
81
sendKey ( "Return" ) ;
82
82
editor . destroy ( ) ;
83
83
editor . container . remove ( ) ;
@@ -86,15 +86,15 @@ module.exports = {
86
86
} ) ;
87
87
} ) ;
88
88
} ) ;
89
-
89
+
90
90
var last ;
91
91
function checkInnerHTML ( expected , callback ) {
92
92
var popup = editor . completer . popup ;
93
-
93
+
94
94
popup . renderer . on ( "afterRender" , function wait ( ) {
95
95
var innerHTML = popup . renderer . $textLayer . element . innerHTML
96
96
. replace ( / \s * s t y l e = " [ ^ " ] + " | c l a s s = | ( d ) i v | ( s ) p a n / g, "$1$2" ) ;
97
- if ( innerHTML == last )
97
+ if ( innerHTML == last )
98
98
return ;
99
99
assert . equal ( innerHTML , expected ) ;
100
100
last = innerHTML ;
@@ -232,29 +232,29 @@ module.exports = {
232
232
sendKey ( 'Return' ) ;
233
233
var popup = editor . completer . popup ;
234
234
check ( function ( ) {
235
- assert . equal ( popup . data . length , 10 ) ;
236
- // check that the aria attributes have been set on all the elements of the popup and that aria selected attributes are set on the first item
237
- assert . ok ( checkAria ( popup . renderer . $textLayer . element . innerHTML , '<d role="option" aria-roledescription="item" aria-label="0" aria-setsize="10" aria-describedby="doc-tooltip" aria-posinset="1" id="suggest-aria-id:0" aria-selected="true"><s >0</s><s > </s></d>' +
238
- '<d role="option" aria-roledescription="item" aria-label="1" aria-setsize="10" aria-describedby="doc-tooltip" aria-posinset="2"><s >1</s><s > </s></d>' +
239
- '<d role="option" aria-roledescription="item" aria-label="2" aria-setsize="10" aria-describedby="doc-tooltip" aria-posinset="3"><s >2</s><s > </s></d>' +
240
- '<d role="option" aria-roledescription="item" aria-label="3" aria-setsize="10" aria-describedby="doc-tooltip" aria-posinset="4"><s >3</s><s > </s></d>' +
241
- '<d role="option" aria-roledescription="item" aria-label="4" aria-setsize="10" aria-describedby="doc-tooltip" aria-posinset="5"><s >4</s><s > </s></d>' +
242
- '<d role="option" aria-roledescription="item" aria-label="5" aria-setsize="10" aria-describedby="doc-tooltip" aria-posinset="6"><s >5</s><s > </s></d>' +
243
- '<d role="option" aria-roledescription="item" aria-label="6" aria-setsize="10" aria-describedby="doc-tooltip" aria-posinset="7"><s >6</s><s > </s></d>' +
244
- '<d role="option" aria-roledescription="item" aria-label="7" aria-setsize="10" aria-describedby="doc-tooltip" aria-posinset="8"><s >7</s><s > </s></d>' +
245
- '<d role="option" aria-roledescription="item" aria-label="8" aria-setsize="10" aria-describedby="doc-tooltip" aria-posinset="9"><s >8</s><s > </s></d>' ) ) ;
246
- const prevSelected = popup . selectedNode ;
247
- sendKey ( 'Down' ) ;
248
- check ( function ( ) {
249
- assert . ok ( checkAria ( popup . selectedNode . outerHTML , '<d role="option" aria-roledescription="item" aria-label="1" aria-setsize="10" aria-describedby="doc-tooltip" aria-posinset="2" id="suggest-aria-id:1" aria-selected="true"><s >1</s><s > </s></d>' ) ) ;
250
- // check that the aria selected attributes have been removed from the previously selected element
251
- assert . ok ( checkAria ( prevSelected . outerHTML , '<d role="option" aria-roledescription="item" aria-label="0" aria-setsize="10" aria-describedby="doc-tooltip" aria-posinset="1"><s >0</s><s > </s></d>' ) ) ;
235
+ assert . equal ( popup . data . length , 10 ) ;
236
+ // check that the aria attributes have been set on all the elements of the popup and that aria selected attributes are set on the first item
237
+ assert . ok ( checkAria ( popup . renderer . $textLayer . element . innerHTML , '<d role="option" aria-roledescription="item" aria-setsize="10" aria-describedby="doc-tooltip" aria-posinset="1" aria-label="0" id="suggest-aria-id:0" aria-selected="true"><s >0</s><s > </s></d>' +
238
+ '<d role="option" aria-roledescription="item" aria-setsize="10" aria-describedby="doc-tooltip" aria-posinset="2" aria-label="1"><s >1</s><s > </s></d>' +
239
+ '<d role="option" aria-roledescription="item" aria-setsize="10" aria-describedby="doc-tooltip" aria-posinset="3" aria-label="2"><s >2</s><s > </s></d>' +
240
+ '<d role="option" aria-roledescription="item" aria-setsize="10" aria-describedby="doc-tooltip" aria-posinset="4" aria-label="3"><s >3</s><s > </s></d>' +
241
+ '<d role="option" aria-roledescription="item" aria-setsize="10" aria-describedby="doc-tooltip" aria-posinset="5" aria-label="4"><s >4</s><s > </s></d>' +
242
+ '<d role="option" aria-roledescription="item" aria-setsize="10" aria-describedby="doc-tooltip" aria-posinset="6" aria-label="5"><s >5</s><s > </s></d>' +
243
+ '<d role="option" aria-roledescription="item" aria-setsize="10" aria-describedby="doc-tooltip" aria-posinset="7" aria-label="6"><s >6</s><s > </s></d>' +
244
+ '<d role="option" aria-roledescription="item" aria-setsize="10" aria-describedby="doc-tooltip" aria-posinset="8" aria-label="7"><s >7</s><s > </s></d>' +
245
+ '<d role="option" aria-roledescription="item" aria-setsize="10" aria-describedby="doc-tooltip" aria-posinset="9" aria-label="8"><s >8</s><s > </s></d>' ) ) ;
246
+ const prevSelected = popup . selectedNode ;
252
247
sendKey ( 'Down' ) ;
253
248
check ( function ( ) {
254
- assert . ok ( checkAria ( popup . selectedNode . outerHTML , '<d role="option" aria-roledescription="item" aria-label="2" aria-setsize="10" aria-describedby="doc-tooltip" aria-posinset="3" id="suggest-aria-id:2" aria-selected="true"><s >2</s><s > </s></d>' ) ) ;
255
- done ( ) ;
249
+ assert . ok ( checkAria ( popup . selectedNode . outerHTML , '<d role="option" aria-roledescription="item" aria-setsize="10" aria-describedby="doc-tooltip" aria-posinset="2" aria-label="1" id="suggest-aria-id:1" aria-selected="true"><s >1</s><s > </s></d>' ) ) ;
250
+ // check that the aria selected attributes have been removed from the previously selected element
251
+ assert . ok ( checkAria ( prevSelected . outerHTML , '<d role="option" aria-roledescription="item" aria-setsize="10" aria-describedby="doc-tooltip" aria-posinset="1" aria-label="0"><s >0</s><s > </s></d>' ) ) ;
252
+ sendKey ( 'Down' ) ;
253
+ check ( function ( ) {
254
+ assert . ok ( checkAria ( popup . selectedNode . outerHTML , '<d role="option" aria-roledescription="item" aria-setsize="10" aria-describedby="doc-tooltip" aria-posinset="3" aria-label="2" id="suggest-aria-id:2" aria-selected="true"><s >2</s><s > </s></d>' ) ) ;
255
+ done ( ) ;
256
+ } ) ;
256
257
} ) ;
257
- } ) ;
258
258
} ) ;
259
259
function check ( callback ) {
260
260
popup = editor . completer . popup ;
0 commit comments