@@ -504,9 +504,9 @@ describe("Slots", () => {
504
504
cy . mount (
505
505
< ShellBar id = "shellbar" primaryTitle = "Product Title" showNotifications = { true } > </ ShellBar >
506
506
) ;
507
-
507
+
508
508
cy . get ( "#shellbar" ) . as ( "shellbar" ) ;
509
-
509
+
510
510
// Add search field after a timeout (simulating real-world scenario)
511
511
cy . get ( "@shellbar" ) . then ( shellbar => {
512
512
setTimeout ( ( ) => {
@@ -516,15 +516,15 @@ describe("Slots", () => {
516
516
shellbar . get ( 0 ) . appendChild ( searchField ) ;
517
517
} , 100 ) ;
518
518
} ) ;
519
-
519
+
520
520
// Wait for the search field to be added
521
521
cy . get ( "#delayed-search" , { timeout : 1000 } ) . should ( "exist" ) ;
522
-
522
+
523
523
// Search should now be visible and collapsed
524
524
cy . get ( "#shellbar [slot='searchField']" )
525
525
. should ( "exist" )
526
526
. should ( "have.prop" , "collapsed" , true ) ;
527
-
527
+
528
528
// click the searchField to expand it
529
529
cy . get ( "#shellbar [slot='searchField']" )
530
530
. click ( )
@@ -788,6 +788,30 @@ describe("Keyboard Navigation", () => {
788
788
cy . get ( "@nativeInput" ) . type ( "{rightArrow}" ) ;
789
789
cy . get ( "@nativeInput" ) . should ( "be.focused" ) ;
790
790
} ) ;
791
+
792
+ it ( "Should focus the last ShellBar item on End key press" , ( ) => {
793
+ cy . mount (
794
+ < ShellBar id = "shellbar" showSearchField = { true } >
795
+ < Button slot = "content" > Test Button 1</ Button >
796
+ < Button id = "button" slot = "content" > Test Button 2</ Button >
797
+ < ShellBarSearch id = "sbSearch" slot = "searchField" value = "test value" > </ ShellBarSearch >
798
+ </ ShellBar >
799
+ ) ;
800
+ cy . get ( "#button" ) . shadow ( ) . find ( "button" ) . focus ( ) . type ( '{end}' ) ;
801
+ cy . get ( "#sbSearch" ) . should ( "be.focused" ) ;
802
+ } ) ;
803
+
804
+ it ( "Should focus the first ShellBar item on Home key press" , ( ) => {
805
+ cy . mount (
806
+ < ShellBar id = "shellbar" showSearchField = { true } >
807
+ < Button id = "button1" slot = "content" > Test Button 1</ Button >
808
+ < Button id = "button2" slot = "content" > Test Button 2</ Button >
809
+ < ShellBarSearch slot = "searchField" value = "test value" > </ ShellBarSearch >
810
+ </ ShellBar >
811
+ ) ;
812
+ cy . get ( "#button2" ) . shadow ( ) . find ( "button" ) . focus ( ) . type ( '{home}' ) ;
813
+ cy . get ( "#button1" ) . shadow ( ) . find ( "button" ) . should ( "be.focused" ) ;
814
+ } ) ;
791
815
} ) ;
792
816
793
817
describe ( "Branding slot" , ( ) => {
@@ -796,7 +820,8 @@ describe("Branding slot", () => {
796
820
< ShellBar id = "shellbar" primaryTitle = "Primary Title" >
797
821
< img id = "mainLogo" slot = "logo" src = "https://upload.wikimedia.org/wikipedia/commons/5/59/SAP_2011_logo.svg" />
798
822
799
- < ShellBarBranding brandingTitle = "Branding Comp" href = "https://www.w3schools.com" target = "_blank" slot = "branding" >
823
+ < ShellBarBranding href = "https://www.w3schools.com" target = "_blank" slot = "branding" >
824
+ Branding Comp
800
825
< img id = "brandingLogo" src = "https://upload.wikimedia.org/wikipedia/commons/5/59/SAP_2011_logo.svg" slot = "logo" />
801
826
</ ShellBarBranding >
802
827
</ ShellBar >
0 commit comments