@@ -1896,3 +1896,77 @@ describe("Opener visibility in scrollable containers", () => {
18961896 cy . get ( "[ui5-popover]" ) . should ( "have.prop" , "open" , false ) ;
18971897 } ) ;
18981898} ) ;
1899+
1900+ describe ( "Min Width via CSS" , ( ) => {
1901+ it ( "should apply min-width when set via style attribute" , ( ) => {
1902+ cy . mount (
1903+ < >
1904+ < Button id = "btnMinWidth" > Open Popover</ Button >
1905+ < Popover id = "popMinWidth" opener = "btnMinWidth" style = { { minWidth : "300px" } } headerText = "Min Width Test" >
1906+ < div > Small content</ div >
1907+ </ Popover >
1908+ </ >
1909+ ) ;
1910+
1911+ cy . get ( "[ui5-popover]" ) . invoke ( "prop" , "open" , true ) ;
1912+
1913+ cy . get ( "[ui5-popover]" )
1914+ . should ( "have.css" , "min-width" , "300px" ) ;
1915+ } ) ;
1916+
1917+ it ( "should allow content wider than minWidth" , ( ) => {
1918+ cy . mount (
1919+ < >
1920+ < Button id = "btnMinWidthWide" > Open Popover</ Button >
1921+ < Popover id = "popMinWidthWide" opener = "btnMinWidthWide" style = { { minWidth : "200px" } } >
1922+ < div style = { { width : "400px" , padding : "10px" } } >
1923+ This content is wider than the minWidth setting, and the popover should expand to fit it.
1924+ </ div >
1925+ </ Popover >
1926+ </ >
1927+ ) ;
1928+
1929+ cy . get ( "[ui5-popover]" ) . invoke ( "prop" , "open" , true ) ;
1930+
1931+ cy . get ( "[ui5-popover]" )
1932+ . then ( $popover => {
1933+ const width = $popover [ 0 ] . getBoundingClientRect ( ) . width ;
1934+ // Content is 400px + padding, popover should be wider than minWidth
1935+ expect ( width ) . to . be . greaterThan ( 200 ) ;
1936+ } ) ;
1937+ } ) ;
1938+
1939+ it ( "should work with resizable popover" , ( ) => {
1940+ cy . mount (
1941+ < >
1942+ < Button id = "btnMinWidthResizable" > Open Resizable Popover</ Button >
1943+ < Popover id = "popMinWidthResizable" opener = "btnMinWidthResizable" style = { { minWidth : "400px" } } resizable headerText = "Resizable with Min Width" >
1944+ < div > Content that can be resized but not below 400px</ div >
1945+ </ Popover >
1946+ </ >
1947+ ) ;
1948+
1949+ cy . get ( "[ui5-popover]" ) . invoke ( "prop" , "open" , true ) ;
1950+
1951+ cy . get ( "[ui5-popover]" )
1952+ . should ( "have.css" , "min-width" , "400px" ) ;
1953+
1954+ cy . get ( "[ui5-popover]" )
1955+ . shadow ( )
1956+ . find ( ".ui5-popover-resize-handle" )
1957+ . should ( "be.visible" ) ;
1958+
1959+ cy . get ( "[ui5-popover]" )
1960+ . shadow ( )
1961+ . find ( ".ui5-popover-resize-handle" )
1962+ . trigger ( "mousedown" , { button : 0 } )
1963+ . trigger ( "mousemove" , { clientX : - 200 , clientY : 0 } )
1964+ . trigger ( "mouseup" ) ;
1965+
1966+ cy . get ( "[ui5-popover]" )
1967+ . then ( $popover => {
1968+ const currentWidth = $popover [ 0 ] . getBoundingClientRect ( ) . width ;
1969+ expect ( currentWidth ) . to . be . at . least ( 400 ) ;
1970+ } ) ;
1971+ } ) ;
1972+ } ) ;
0 commit comments