@@ -633,4 +633,76 @@ describe("Wizard inside Dialog", () => {
633633 . find ( "[ui5-responsive-popover]" )
634634 . should ( "be.visible" ) ;
635635 } ) ;
636+ } ) ;
637+
638+ describe ( "Wizard - getFocusDomRef Method" , ( ) => {
639+ it ( "should focus the last focused wizard tab on wizard focus" , ( ) => {
640+ const onButtonClick = ( ) => {
641+ document . getElementById ( "wizard" ) . focus ( ) ;
642+ }
643+ cy . mount (
644+ < >
645+ < Wizard id = "wizard" >
646+ < WizardStep icon = "sap-icon://product" titleText = "Product type" >
647+ < MessageStrip >
648+ The Wizard control is supposed to break down large tasks.
649+ </ MessageStrip >
650+ </ WizardStep >
651+ < WizardStep titleText = "Product Information" selected />
652+ < WizardStep titleText = "Product Text" />
653+ </ Wizard >
654+ < Button > Dummy Btn</ Button >
655+ < Button onClick = { onButtonClick } > Focus Wizard</ Button >
656+ </ >
657+ ) ;
658+
659+ cy . get ( "[ui5-wizard]" )
660+ . shadow ( )
661+ . find ( "[ui5-wizard-tab]" )
662+ . eq ( 2 )
663+ . realClick ( ) ;
664+
665+ cy . get ( "[ui5-button]" )
666+ . eq ( 0 )
667+ . realClick ( ) ;
668+
669+ cy . get ( "[ui5-button]" )
670+ . eq ( 1 )
671+ . realClick ( ) ;
672+
673+ cy . get ( "[ui5-wizard]" )
674+ . shadow ( )
675+ . find ( "[ui5-wizard-tab]" )
676+ . eq ( 2 )
677+ . shadow ( )
678+ . find ( ".ui5-wiz-step-root" )
679+ . should ( "be.focused" ) ;
680+ } ) ;
681+
682+ it ( "should focus the first wizard tab if no tab was focused before " , ( ) => {
683+ const onButtonClick = ( ) => {
684+ document . getElementById ( "wizard" ) . focus ( ) ;
685+ }
686+ cy . mount (
687+ < >
688+ < Wizard id = "wizard" >
689+ < WizardStep icon = "sap-icon://product" titleText = "Product type" > </ WizardStep >
690+ < WizardStep titleText = "Product Information" />
691+ < WizardStep titleText = "Product Text" />
692+ </ Wizard >
693+ < Button onClick = { onButtonClick } > Focus Wizard</ Button >
694+ </ >
695+ ) ;
696+
697+ cy . get ( "[ui5-button]" )
698+ . realClick ( ) ;
699+
700+ cy . get ( "[ui5-wizard]" )
701+ . shadow ( )
702+ . find ( "[ui5-wizard-tab]" )
703+ . eq ( 0 )
704+ . shadow ( )
705+ . find ( ".ui5-wiz-step-root" )
706+ . should ( "be.focused" ) ;
707+ } ) ;
636708} ) ;
0 commit comments