@@ -5,7 +5,7 @@ describe("Select general interaction", () => {
5
5
6
6
it ( "fires change on selection" , ( ) => {
7
7
const select = $ ( "#mySelect" ) ;
8
- const selectText = browser . $ ( "#mySelect" ) . shadow$ ( "ui5-label" ) ;
8
+ const selectText = browser . $ ( "#mySelect" ) . shadow$ ( ". ui5-select- label-root " ) ;
9
9
const inputResult = browser . $ ( "#inputResult" ) . shadow$ ( "input" ) ;
10
10
const EXPECTED_SELECTION_TEXT = "Cozy" ;
11
11
@@ -34,7 +34,7 @@ describe("Select general interaction", () => {
34
34
35
35
it ( "fires change on selection with keyboard handling" , ( ) => {
36
36
const select = $ ( "#mySelect2" ) . shadow$ ( ".ui5-select-root" ) ;
37
- const selectText = browser . $ ( "#mySelect2" ) . shadow$ ( "ui5-label" ) ;
37
+ const selectText = browser . $ ( "#mySelect2" ) . shadow$ ( ". ui5-select- label-root " ) ;
38
38
const inputResult = browser . $ ( "#inputResult" ) ;
39
39
const EXPECTED_SELECTION_TEXT1 = "Compact" ;
40
40
const EXPECTED_SELECTION_TEXT2 = "Condensed" ;
@@ -57,7 +57,7 @@ describe("Select general interaction", () => {
57
57
it ( "changes selection while closed with Arrow Up/Down" , ( ) => {
58
58
const inputResult = browser . $ ( "#inputResult" ) . shadow$ ( "input" ) ;
59
59
const select = $ ( "#mySelect2" ) ;
60
- const selectText = browser . $ ( "#mySelect2" ) . shadow$ ( "ui5-label" ) ;
60
+ const selectText = browser . $ ( "#mySelect2" ) . shadow$ ( ". ui5-select- label-root " ) ;
61
61
const EXPECTED_SELECTION_TEXT1 = "Compact" ;
62
62
const EXPECTED_SELECTION_TEXT2 = "Condensed" ;
63
63
@@ -74,6 +74,39 @@ describe("Select general interaction", () => {
74
74
assert . strictEqual ( inputResult . getProperty ( "value" ) , "5" , "Change event should have fired twice" ) ;
75
75
} ) ;
76
76
77
+ it ( "changes selection sync with selection announcement" , ( ) => {
78
+ const btn = $ ( "#myBtn2" ) ;
79
+ const inputResult = browser . $ ( "#inputResult" ) . shadow$ ( "input" ) ;
80
+ const select = $ ( "#mySelect2" ) ;
81
+ const selectId = select . getProperty ( "_id" )
82
+ const selectText = browser . $ ( "#mySelect2" ) . shadow$ ( ".ui5-select-label-root" ) ;
83
+ const selectionText = browser . $ ( "#mySelect2" ) . shadow$ ( `#${ selectId } -selectionText` ) ;
84
+ const EXPECTED_SELECTION_TEXT1 = "Compact" ;
85
+ const EXPECTED_SELECTION_TEXT2 = "Condensed" ;
86
+
87
+ select . click ( ) ;
88
+ select . keys ( "Escape" ) ;
89
+
90
+ assert . strictEqual ( selectionText . getHTML ( false ) , "" , "Selection announcement text should be clear if there is no interaction" ) ;
91
+
92
+ select . keys ( "ArrowUp" ) ;
93
+ assert . ok ( selectText . getHTML ( false ) . indexOf ( EXPECTED_SELECTION_TEXT1 ) , "Arrow Up should change selected item" ) ;
94
+ assert . strictEqual ( selectionText . getHTML ( false ) , EXPECTED_SELECTION_TEXT1 , "Selection announcement text should be equalt to the current selected item's text" ) ;
95
+
96
+ select . click ( ) ;
97
+ select . keys ( "Escape" ) ;
98
+ assert . strictEqual ( selectionText . getHTML ( false ) , "" , "Selection announcement text should be cleared if the picker is opened" ) ;
99
+
100
+ select . keys ( "ArrowDown" ) ;
101
+ assert . ok ( selectText . getHTML ( false ) . indexOf ( EXPECTED_SELECTION_TEXT2 ) , "Arrow Up should change selected item" ) ;
102
+ assert . strictEqual ( selectionText . getHTML ( false ) , EXPECTED_SELECTION_TEXT2 , "Selection announcement text should be equalt to the current selected item's text" ) ;
103
+
104
+ btn . click ( ) ;
105
+ assert . strictEqual ( selectionText . getHTML ( false ) , "" , "Selection announcement text should be cleared on focusout" ) ;
106
+
107
+ assert . strictEqual ( inputResult . getProperty ( "value" ) , "7" , "Change event should have fired twice" ) ;
108
+ } ) ;
109
+
77
110
it ( "changes selection on Tab" , ( ) => {
78
111
const select = browser . $ ( "#keyboardHandling" ) ;
79
112
const EXPECTED_SELECTION_TEXT = "Banana" ;
@@ -84,7 +117,7 @@ describe("Select general interaction", () => {
84
117
85
118
select . keys ( "ArrowUp" ) ;
86
119
select . keys ( "Tab" ) ;
87
- const selectText = select . shadow$ ( "ui5-label" ) ;
120
+ const selectText = select . shadow$ ( ". ui5-select- label-root " ) ;
88
121
89
122
assert . ok ( selectText . getHTML ( false ) . indexOf ( EXPECTED_SELECTION_TEXT ) > - 1 , "Arrow Up should change selected item" ) ;
90
123
@@ -105,7 +138,7 @@ describe("Select general interaction", () => {
105
138
106
139
select . keys ( "ArrowDown" ) ;
107
140
browser . keys ( [ "Shift" , "Tab" ] ) ;
108
- const selectText = select . shadow$ ( "ui5-label" ) ;
141
+ const selectText = select . shadow$ ( ". ui5-select- label-root " ) ;
109
142
110
143
assert . ok ( selectText . getHTML ( false ) . indexOf ( EXPECTED_SELECTION_TEXT ) > - 1 , "Arrow Down should change selected item" ) ;
111
144
@@ -119,7 +152,7 @@ describe("Select general interaction", () => {
119
152
it ( "tests selection does not cycle with ArrowDown" , ( ) => {
120
153
const select = $ ( "#selectionNotCycling" ) ;
121
154
const EXPECTED_SELECTION_TEXT = "Opt3" ;
122
- const selectOptionText = select . shadow$ ( "ui5-label" ) ;
155
+ const selectOptionText = select . shadow$ ( ". ui5-select- label-root " ) ;
123
156
124
157
select . click ( ) ;
125
158
assert . ok ( selectOptionText . getHTML ( false ) . indexOf ( EXPECTED_SELECTION_TEXT ) > - 1 , "Selected option text is " + EXPECTED_SELECTION_TEXT ) ;
@@ -135,7 +168,7 @@ describe("Select general interaction", () => {
135
168
it ( "tests selection does not cycle with ArrowUp" , ( ) => {
136
169
const select = $ ( "#selectionNotCycling2" ) ;
137
170
const EXPECTED_SELECTION_TEXT = "Opt1" ;
138
- const selectOptionText = select . shadow$ ( "ui5-label" ) ;
171
+ const selectOptionText = select . shadow$ ( ". ui5-select- label-root " ) ;
139
172
140
173
select . click ( ) ;
141
174
assert . ok ( selectOptionText . getHTML ( false ) . indexOf ( EXPECTED_SELECTION_TEXT ) > - 1 , "Selected option text is " + EXPECTED_SELECTION_TEXT ) ;
@@ -223,18 +256,18 @@ describe("Select general interaction", () => {
223
256
224
257
it ( "reverts value before open after clicking on escape" , ( ) => {
225
258
const select = $ ( "#mySelect" ) ;
226
- const selectText = browser . $ ( "#mySelect" ) . shadow$ ( "ui5-label" ) . getHTML ( false ) ;
259
+ const selectText = browser . $ ( "#mySelect" ) . shadow$ ( ". ui5-select- label-root " ) . getHTML ( false ) ;
227
260
const inputResult = browser . $ ( "#inputResult" ) . shadow$ ( "input" ) ;
228
261
229
262
select . click ( ) ;
230
263
select . keys ( "ArrowDown" ) ;
231
264
select . keys ( "Escape" ) ;
232
265
233
266
const selectedOption = browser . $ ( "#mySelect ui5-option[selected]" ) ;
234
- const selectTextAfterEscape = browser . $ ( "#mySelect" ) . shadow$ ( "ui5-label" ) . getHTML ( false ) ;
267
+ const selectTextAfterEscape = browser . $ ( "#mySelect" ) . shadow$ ( ". ui5-select- label-root " ) . getHTML ( false ) ;
235
268
236
269
assert . ok ( selectedOption . getProperty ( "selected" ) , "Initially selected item should remain selected" ) ;
237
- assert . strictEqual ( inputResult . getProperty ( "value" ) , "5 " , "Change event should not be fired" ) ;
270
+ assert . strictEqual ( inputResult . getProperty ( "value" ) , "7 " , "Change event should not be fired" ) ;
238
271
assert . strictEqual ( selectTextAfterEscape , selectText , "Initially selected item should remain selected" ) ;
239
272
} ) ;
240
273
@@ -250,7 +283,7 @@ describe("Select general interaction", () => {
250
283
// focus out select
251
284
btn . click ( ) ;
252
285
253
- assert . strictEqual ( inputResult . getProperty ( "value" ) , "6 " , "Change event should be fired" ) ;
286
+ assert . strictEqual ( inputResult . getProperty ( "value" ) , "8 " , "Change event should be fired" ) ;
254
287
} ) ;
255
288
256
289
it ( "fires change event after selecting a previewed item" , ( ) => {
@@ -268,12 +301,12 @@ describe("Select general interaction", () => {
268
301
269
302
firstItem . click ( ) ;
270
303
271
- assert . strictEqual ( inputResult . getProperty ( "value" ) , "7 " , "Change event should be fired" ) ;
304
+ assert . strictEqual ( inputResult . getProperty ( "value" ) , "9 " , "Change event should be fired" ) ;
272
305
} ) ;
273
306
274
307
it ( "tests ESC on closed picker" , ( ) => {
275
308
const select = $ ( "#mySelectEsc" ) ;
276
- const selectText = browser . $ ( "#mySelectEsc" ) . shadow$ ( "ui5-label" ) ;
309
+ const selectText = browser . $ ( "#mySelectEsc" ) . shadow$ ( ". ui5-select- label-root " ) ;
277
310
const EXPECTED_SELECTION_TEXT = "Cozy" ;
278
311
const EXPECTED_SELECTION_TEXT2 = "Condensed" ;
279
312
@@ -294,10 +327,9 @@ describe("Select general interaction", () => {
294
327
assert . ok ( selectText . getHTML ( false ) . indexOf ( EXPECTED_SELECTION_TEXT2 ) !== - 1 , "Select label is correct." ) ;
295
328
} ) ;
296
329
297
-
298
330
it ( "Tests aria-label and aria-labelledby" , ( ) => {
299
- const select1 = browser . $ ( "#textAreaAriaLabel" ) . shadow$ ( ".ui5-select-root" ) ;
300
- const select2 = browser . $ ( "#textAreaAriaLabelledBy" ) . shadow$ ( ".ui5-select-root" ) ;
331
+ const select1 = browser . $ ( "#textAreaAriaLabel" ) . shadow$ ( ".ui5-select-label- root" ) ;
332
+ const select2 = browser . $ ( "#textAreaAriaLabelledBy" ) . shadow$ ( ".ui5-select-label- root" ) ;
301
333
const EXPECTED_ARIA_LABEL1 = "Hello World" ;
302
334
const EXPECTED_ARIA_LABEL2 = "info text" ;
303
335
0 commit comments