@@ -97,7 +97,7 @@ describe("Testing Range Slider interactions", () => {
97
97
rangeSlider . setProperty ( "endValue" , 30 ) ;
98
98
99
99
rangeSlider . dragAndDrop ( { x : - 500 , y : 1 } ) ;
100
-
100
+
101
101
assert . strictEqual ( rangeSlider . getProperty ( "startValue" ) , 0 , "startValue should be 0 as the selected range has reached the start of the Range Slider" ) ;
102
102
assert . strictEqual ( rangeSlider . getProperty ( "endValue" ) , 21 , "endValue should be 21 and no less, the initially selected range should be preserved" ) ;
103
103
@@ -203,7 +203,7 @@ describe("Properties synchronization and normalization", () => {
203
203
rangeSlider . setProperty ( "endValue" , 300 ) ;
204
204
205
205
assert . strictEqual ( rangeSlider . getProperty ( "endValue" ) , 200 , "value prop should always be lower than the max value" ) ;
206
-
206
+
207
207
rangeSlider . setProperty ( "startValue" , 99 ) ;
208
208
209
209
assert . strictEqual ( rangeSlider . getProperty ( "startValue" ) , 100 , "value prop should always be greater than the min value" ) ;
@@ -220,7 +220,7 @@ describe("Properties synchronization and normalization", () => {
220
220
221
221
assert . strictEqual ( rangeSlider . getProperty ( "startValue" ) , 14 , "startValue should not be stepped to the next step (15)" ) ;
222
222
assert . strictEqual ( rangeSlider . getProperty ( "endValue" ) , 24 , "endValue should not be stepped to the next step (25)" ) ;
223
- } ) ;
223
+ } ) ;
224
224
225
225
it ( "If the step property or the labelInterval are changed, the tickmarks and labels must be updated also" , ( ) => {
226
226
const rangeSlider = browser . $ ( "#range-slider-tickmarks-labels" ) ;
@@ -234,7 +234,7 @@ describe("Properties synchronization and normalization", () => {
234
234
rangeSlider . setProperty ( "step" , 2 ) ;
235
235
236
236
assert . strictEqual ( rangeSlider . getProperty ( "_labels" ) . length , 11 , "Labels must be 12 - 1 for every 2 tickmarks (and 4 current value points)" ) ;
237
-
237
+
238
238
rangeSlider . setProperty ( "labelInterval" , 4 ) ;
239
239
240
240
assert . strictEqual ( rangeSlider . getProperty ( "_labels" ) . length , 6 , "Labels must be 6 - 1 for every 4 tickmarks (and 8 current value points)" ) ;
@@ -263,7 +263,66 @@ describe("Testing events", () => {
263
263
} ) ;
264
264
265
265
266
- describe ( "Accessibility: Testing focus" , ( ) => {
266
+ describe ( "Accessibility" , ( ) => {
267
+ it ( "Aria attributes of the progress bar are set correctly" , ( ) => {
268
+ const rangeSlider = browser . $ ( "#range-slider-tickmarks" ) ;
269
+ const rangeSliderProgressBar = rangeSlider . shadow$ ( ".ui5-slider-progress" ) ;
270
+ const rangeSliderId = rangeSlider . getProperty ( "_id" ) ;
271
+
272
+ assert . strictEqual ( rangeSliderProgressBar . getAttribute ( "aria-labelledby" ) ,
273
+ `${ rangeSliderId } -sliderDesc` , "aria-labelledby is set correctly" ) ;
274
+ assert . strictEqual ( rangeSliderProgressBar . getAttribute ( "aria-valuemin" ) ,
275
+ `${ rangeSlider . getProperty ( "min" ) } ` , "aria-valuemin is set correctly" ) ;
276
+ assert . strictEqual ( rangeSliderProgressBar . getAttribute ( "aria-valuemax" ) ,
277
+ `${ rangeSlider . getProperty ( "max" ) } ` , "aria-valuemax is set correctly" ) ;
278
+ assert . strictEqual ( rangeSliderProgressBar . getAttribute ( "aria-valuetext" ) ,
279
+ `From ${ rangeSlider . getProperty ( "startValue" ) } to ${ rangeSlider . getProperty ( "endValue" ) } ` , "aria-valuetext is set correctly" ) ;
280
+ } ) ;
281
+
282
+ it ( "Aria attributes of the start handle are set correctly" , ( ) => {
283
+ const rangeSlider = browser . $ ( "#range-slider-tickmarks" ) ;
284
+ const startHandle = rangeSlider . shadow$ ( ".ui5-slider-handle--start" ) ;
285
+ const rangeSliderId = rangeSlider . getProperty ( "_id" ) ;
286
+
287
+ assert . strictEqual ( startHandle . getAttribute ( "aria-labelledby" ) ,
288
+ `${ rangeSliderId } -startHandleDesc` , "aria-labelledby is set correctly" ) ;
289
+ assert . strictEqual ( startHandle . getAttribute ( "aria-valuemin" ) ,
290
+ `${ rangeSlider . getProperty ( "min" ) } ` , "aria-valuemin is set correctly" ) ;
291
+ assert . strictEqual ( startHandle . getAttribute ( "aria-valuemax" ) ,
292
+ `${ rangeSlider . getProperty ( "max" ) } ` , "aria-valuemax is set correctly" ) ;
293
+ assert . strictEqual ( startHandle . getAttribute ( "aria-valuenow" ) ,
294
+ `${ rangeSlider . getProperty ( "startValue" ) } ` , "aria-valuenow is set correctly" ) ;
295
+ } ) ;
296
+
297
+ it ( "Aria attributes of the end handle are set correctly" , ( ) => {
298
+ const rangeSlider = browser . $ ( "#range-slider-tickmarks" ) ;
299
+ const endHandle = rangeSlider . shadow$ ( ".ui5-slider-handle--end" ) ;
300
+ const rangeSliderId = rangeSlider . getProperty ( "_id" ) ;
301
+
302
+ assert . strictEqual ( endHandle . getAttribute ( "aria-labelledby" ) ,
303
+ `${ rangeSliderId } -endHandleDesc` , "aria-labelledby is set correctly" ) ;
304
+ assert . strictEqual ( endHandle . getAttribute ( "aria-valuemin" ) ,
305
+ `${ rangeSlider . getProperty ( "min" ) } ` , "aria-valuemin is set correctly" ) ;
306
+ assert . strictEqual ( endHandle . getAttribute ( "aria-valuemax" ) ,
307
+ `${ rangeSlider . getProperty ( "max" ) } ` , "aria-valuemax is set correctly" ) ;
308
+ assert . strictEqual ( endHandle . getAttribute ( "aria-valuenow" ) ,
309
+ `${ rangeSlider . getProperty ( "endValue" ) } ` , "aria-valuenow is set correctly" ) ;
310
+ } ) ;
311
+
312
+ it ( "Aria-labelledby text is mapped correctly when values are swapped" , ( ) => {
313
+ const rangeSlider = browser . $ ( "#range-slider-tickmarks" ) ;
314
+ const rangeSliderId = rangeSlider . getProperty ( "_id" ) ;
315
+ const startHandle = rangeSlider . shadow$ ( ".ui5-slider-handle--start" ) ;
316
+ const rangeSliderStartHandleSpan = rangeSlider . shadow$ ( `#${ rangeSliderId } -startHandleDesc` ) ;
317
+ const rangeSliderEndHandleSpan = rangeSlider . shadow$ ( `#${ rangeSliderId } -endHandleDesc` ) ;
318
+
319
+ rangeSlider . setProperty ( "endValue" , 9 ) ;
320
+ startHandle . dragAndDrop ( { x : 100 , y : 1 } ) ;
321
+
322
+ assert . strictEqual ( rangeSliderStartHandleSpan . getText ( ) , "Left handle" , "Start Handle text is correct after swap" ) ;
323
+ assert . strictEqual ( rangeSliderEndHandleSpan . getText ( ) , "Right handle" , "End Handle text is correct after swap" ) ;
324
+ } ) ;
325
+
267
326
it ( "Click anywhere in the Range Slider should focus the closest handle" , ( ) => {
268
327
browser . url ( "http://localhost:8080/test-resources/pages/RangeSlider.html" ) ;
269
328
@@ -321,7 +380,7 @@ describe("Accessibility: Testing focus", () => {
321
380
assert . strictEqual ( rangeSlider . isFocused ( ) , true , "Range Slider component is focused" ) ;
322
381
assert . strictEqual ( $ ( innerFocusedElement ) . getAttribute ( "class" ) , rangeSliderSelection . getAttribute ( "class" ) , "Range Slider progress tracker has the shadowDom focus" ) ;
323
382
} ) ;
324
-
383
+
325
384
it ( "When progress bar has the focus, 'Tab' should move the focus to the first handle" , ( ) => {
326
385
const rangeSlider = browser . $ ( "#basic-range-slider" ) ;
327
386
const rangeSliderStartHandle = rangeSlider . shadow$ ( ".ui5-slider-handle--start" ) ;
0 commit comments