@@ -219,8 +219,10 @@ describe("MultiComboBox RTL/LTR Arrow Navigation", () => {
219
219
. find ( "[ui5-tokenizer]" )
220
220
. find ( "[ui5-token]" )
221
221
. last ( )
222
- . should ( "be.visible" )
223
- . should ( "be.focused" ) ;
222
+ . as ( "lastToken" ) ;
223
+
224
+ cy . get ( "@lastToken" ) . should ( "be.visible" ) ;
225
+ cy . get ( "@lastToken" ) . should ( "be.focused" ) ;
224
226
} ) ;
225
227
226
228
it ( "should focus last token on arrow left in LTR mode when input is at start" , ( ) => {
@@ -263,8 +265,10 @@ describe("MultiComboBox RTL/LTR Arrow Navigation", () => {
263
265
. find ( "[ui5-tokenizer]" )
264
266
. find ( "[ui5-token]" )
265
267
. last ( )
266
- . should ( "be.visible" )
267
- . should ( "be.focused" ) ;
268
+ . as ( "lastToken" ) ;
269
+
270
+ cy . get ( "@lastToken" ) . should ( "be.visible" ) ;
271
+ cy . get ( "@lastToken" ) . should ( "be.focused" ) ;
268
272
} ) ;
269
273
270
274
it ( "should not focus token when cursor is not at start of input in RTL mode" , ( ) => {
@@ -283,7 +287,6 @@ describe("MultiComboBox RTL/LTR Arrow Navigation", () => {
283
287
. realClick ( ) ;
284
288
285
289
cy . get ( "@mcb" ) . should ( "be.focused" ) ;
286
-
287
290
288
291
cy . get ( "@mcb" )
289
292
. shadow ( )
@@ -297,23 +300,14 @@ describe("MultiComboBox RTL/LTR Arrow Navigation", () => {
297
300
298
301
cy . get ( "@mcb" ) . realPress ( "ArrowRight" ) ;
299
302
300
- cy . get ( "@mcb" )
301
- . shadow ( )
302
- . find ( "input" )
303
- . as ( "input" )
304
- . realClick ( ) ;
305
-
306
- cy . get ( "@input" )
307
- . should ( "be.focused" )
308
- . should ( ( $input ) => {
309
- expect ( ( $input [ 0 ] as HTMLInputElement ) . selectionStart ) . to . equal ( 3 ) ;
310
- } ) ;
311
-
312
303
cy . get ( "@mcb" )
313
304
. shadow ( )
314
305
. find ( "[ui5-tokenizer]" )
315
306
. find ( "[ui5-token]" )
316
- . should ( "not.be.focused" ) ;
307
+ . as ( "lastToken" ) ;
308
+
309
+ cy . get ( "@lastToken" ) . should ( "be.visible" ) ;
310
+ cy . get ( "@lastToken" ) . should ( "not.be.focused" ) ;
317
311
} ) ;
318
312
319
313
it ( "should not focus token when text is selected in RTL mode" , ( ) => {
@@ -350,7 +344,11 @@ describe("MultiComboBox RTL/LTR Arrow Navigation", () => {
350
344
. shadow ( )
351
345
. find ( "[ui5-tokenizer]" )
352
346
. find ( "[ui5-token]" )
353
- . should ( "not.have.focus" ) ;
347
+ . as ( "lastToken" ) ;
348
+
349
+ cy . get ( "@lastToken" ) . should ( "be.visible" ) ;
350
+ cy . get ( "@lastToken" ) . should ( "not.be.focused" ) ;
351
+
354
352
} ) ;
355
353
356
354
it ( "should navigate from last token back to input with arrow left in RTL mode" , ( ) => {
@@ -378,17 +376,13 @@ describe("MultiComboBox RTL/LTR Arrow Navigation", () => {
378
376
. find ( "[ui5-tokenizer]" )
379
377
. find ( "[ui5-token]" )
380
378
. last ( )
381
- . as ( "lastToken" )
382
- . should ( "have.focus" ) ;
379
+ . as ( "lastToken" ) ;
383
380
384
- cy . get ( "@lastToken" )
385
- . should ( "be.focused" )
386
- . realPress ( "ArrowLeft" ) ;
381
+ cy . get ( "@lastToken" ) . should ( "be.visible" ) ;
382
+ cy . get ( "@lastToken" ) . should ( "be.focused" ) ;
383
+ cy . get ( "@lastToken" ) . realPress ( "ArrowLeft" ) ;
387
384
388
- cy . get ( "@mcb" )
389
- . shadow ( )
390
- . find ( "input" )
391
- . should ( "be.focused" ) ;
385
+ cy . get ( "@mcb" ) . should ( "be.focused" ) ;
392
386
} ) ;
393
387
394
388
it ( "should navigate from last token back to input with arrow right in LTR mode" , ( ) => {
@@ -416,15 +410,14 @@ describe("MultiComboBox RTL/LTR Arrow Navigation", () => {
416
410
. find ( "[ui5-tokenizer]" )
417
411
. find ( "[ui5-token]" )
418
412
. last ( )
419
- . as ( "lastToken" )
420
- . should ( "be.focused" ) ;
413
+ . as ( "lastToken" ) ;
421
414
415
+ cy . get ( "@lastToken" ) . should ( "be.visible" ) ;
416
+ cy . get ( "@lastToken" ) . should ( "be.focused" ) ;
422
417
cy . get ( "@lastToken" ) . realPress ( "ArrowRight" ) ;
423
418
424
- cy . get ( "@mcb" )
425
- . shadow ( )
426
- . find ( "input" )
427
- . should ( "be.focused" ) ;
419
+ cy . get ( "@mcb" ) . should ( "be.visible" ) ;
420
+ cy . get ( "@mcb" ) . should ( "be.focused" ) ;
428
421
} ) ;
429
422
430
423
it ( "should handle empty input case in RTL mode" , ( ) => {
@@ -464,7 +457,11 @@ describe("MultiComboBox RTL/LTR Arrow Navigation", () => {
464
457
. find ( "[ui5-tokenizer]" )
465
458
. find ( "[ui5-token]" )
466
459
. last ( )
467
- . should ( "have.focus" ) ;
460
+ . as ( "lastToken" ) ;
461
+
462
+ cy . get ( "@lastToken" ) . should ( "be.visible" ) ;
463
+ cy . get ( "@lastToken" ) . should ( "be.focused" ) ;
464
+
468
465
} ) ;
469
466
} ) ;
470
467
0 commit comments