@@ -9,6 +9,9 @@ const getTokenizerPopoverId = async (inputId) => {
9
9
} , inputId ) ;
10
10
}
11
11
12
+ const isMacOS = process . platform === 'darwin' ;
13
+ const keyCtrlToPress = isMacOS ? 'Command' : 'Control' ;
14
+
12
15
describe ( "MultiInput general interaction" , ( ) => {
13
16
before ( async ( ) => {
14
17
await browser . url ( `test/pages/MultiInput.html` ) ;
@@ -563,6 +566,40 @@ describe("Keyboard handling", () => {
563
566
assert . ok ( await lastToken . getProperty ( "focused" ) , "The last token is focused on Backspace" ) ;
564
567
} ) ;
565
568
569
+ it ( "should focus token last token when caret is at the beginning of the value" , async ( ) => {
570
+ const input = await browser . $ ( "#two-tokens" ) ;
571
+ const innerInput = await input . shadow$ ( "input" ) ;
572
+ const lastToken = await browser . $ ( "#two-tokens ui5-token#secondToken" ) ;
573
+
574
+ // Act
575
+ await innerInput . click ( ) ;
576
+ await browser . keys ( "ArrowLeft" ) ;
577
+ await browser . keys ( "ArrowLeft" ) ;
578
+ await browser . keys ( "ArrowLeft" ) ;
579
+ await browser . keys ( "Backspace" ) ;
580
+
581
+ assert . ok ( await lastToken . getProperty ( "focused" ) , "The last token is focused on Backspace" ) ;
582
+ } ) ;
583
+
584
+ it ( "should delete value on backspace" , async ( ) => {
585
+ const input = await browser . $ ( "#two-tokens" ) ;
586
+ const innerInput = await input . shadow$ ( "input" ) ;
587
+ const lastToken = await browser . $ ( "#two-tokens ui5-token#secondToken" ) ;
588
+
589
+ // Act
590
+ await innerInput . click ( ) ;
591
+ await browser . keys ( [ keyCtrlToPress , "a" ] ) ;
592
+ await browser . keys ( "Backspace" ) ;
593
+
594
+ // Assert
595
+ assert . strictEqual ( await input . getProperty ( "value" ) , "" , "Value is deleted on Backspace" ) ;
596
+
597
+ await browser . keys ( "Backspace" ) ;
598
+
599
+ assert . notOk ( await input . getProperty ( "focused" ) , "The input loses focus on Backspace" ) ;
600
+ assert . ok ( await lastToken . getProperty ( "focused" ) , "The last token is focused on Backspace" ) ;
601
+ } ) ;
602
+
566
603
it ( "should delete token on backspace" , async ( ) => {
567
604
const input = await browser . $ ( "#two-tokens" ) ;
568
605
const innerInput = await input . shadow$ ( "input" ) ;
0 commit comments