@@ -71,6 +71,45 @@ describe("Toolbar general interaction", () => {
7171 . should ( "exist" , "hidden class attached to tb button, meaning it's not shown as expected" ) ;
7272 } ) ;
7373
74+ it ( "Should apply fixed spacer widths without enabling flexible full-width layout" , ( ) => {
75+ cy . mount (
76+ < Toolbar id = "otb_fixed_spacers" >
77+ < ToolbarSpacer width = "50px" > </ ToolbarSpacer >
78+ < ToolbarButton text = "Left" > </ ToolbarButton >
79+ < ToolbarSpacer width = "100px" > </ ToolbarSpacer >
80+ < ToolbarButton text = "Right" > </ ToolbarButton >
81+ </ Toolbar >
82+ ) ;
83+
84+ cy . get ( "#otb_fixed_spacers" )
85+ . as ( "toolbar" ) ;
86+
87+ cy . get ( "@toolbar" )
88+ . shadow ( )
89+ . find ( ".ui5-tb-items" )
90+ . should ( "not.have.class" , "ui5-tb-items-full-width" ) ;
91+
92+ cy . get ( "@toolbar" )
93+ . then ( $toolbar => {
94+ const toolbar = $toolbar [ 0 ] as Toolbar ;
95+ const fixedSpacers = Array . from ( toolbar . querySelectorAll ( "ui5-toolbar-spacer" ) ) as ToolbarSpacer [ ] ;
96+
97+ expect ( fixedSpacers ) . to . have . length ( 2 ) ;
98+ expect ( fixedSpacers [ 0 ] . hasFlexibleWidth ) . to . be . false ;
99+ expect ( fixedSpacers [ 1 ] . hasFlexibleWidth ) . to . be . false ;
100+
101+ cy . get ( "@toolbar" )
102+ . shadow ( )
103+ . find ( `#${ fixedSpacers [ 0 ] . _individualSlot } ` )
104+ . should ( "have.css" , "width" , "50px" ) ;
105+
106+ cy . get ( "@toolbar" )
107+ . shadow ( )
108+ . find ( `#${ fixedSpacers [ 1 ] . _individualSlot } ` )
109+ . should ( "have.css" , "width" , "100px" ) ;
110+ } ) ;
111+ } ) ;
112+
74113 it ( "shouldn't show overflow button if there is enough space" , ( ) => {
75114 cy . mount (
76115 < Toolbar style = { { width : "fit-content" , " max-width" : "100%;" } } >
0 commit comments