@@ -1261,6 +1261,9 @@ describe('FlexibleConnectedPositionStrategy', () => {
12611261 ] ) ;
12621262
12631263 attachOverlay ( {
1264+ // Set a large max-width to override the one that comes from the
1265+ // overlay structural styles. Otherwise the `width` will stop at the viewport width.
1266+ maxWidth : '200vw' ,
12641267 width : viewport . getViewportRect ( ) . width + 100 ,
12651268 positionStrategy
12661269 } ) ;
@@ -1292,6 +1295,9 @@ describe('FlexibleConnectedPositionStrategy', () => {
12921295 ] ) ;
12931296
12941297 attachOverlay ( {
1298+ // Set a large max-width to override the one that comes from the
1299+ // overlay structural styles. Otherwise the `width` will stop at the viewport width.
1300+ maxWidth : '200vw' ,
12951301 width : viewport . getViewportRect ( ) . width + 100 ,
12961302 positionStrategy
12971303 } ) ;
@@ -1869,6 +1875,58 @@ describe('FlexibleConnectedPositionStrategy', () => {
18691875 document . body . removeChild ( veryLargeElement ) ;
18701876 } ) ;
18711877
1878+ it ( 'should not push the overlay if it is exactly as wide as the viewport' , ( ) => {
1879+ originElement . style . position = 'fixed' ;
1880+ originElement . style . top = '100px' ;
1881+ originElement . style . right = '0' ;
1882+
1883+ positionStrategy
1884+ . withFlexibleDimensions ( )
1885+ . withPush ( true )
1886+ . withPositions ( [ {
1887+ originX : 'center' ,
1888+ originY : 'bottom' ,
1889+ overlayX : 'center' ,
1890+ overlayY : 'top' ,
1891+ } ] ) ;
1892+
1893+ attachOverlay ( {
1894+ width : viewport . getViewportRect ( ) . width ,
1895+ positionStrategy
1896+ } ) ;
1897+
1898+ const originRect = originElement . getBoundingClientRect ( ) ;
1899+ const overlayRect = overlayRef . overlayElement . getBoundingClientRect ( ) ;
1900+
1901+ expect ( Math . floor ( overlayRect . right ) ) . toBe ( Math . floor ( originRect . right ) ) ;
1902+ } ) ;
1903+
1904+ it ( 'should not push the overlay if it is exactly as tall as the viewport' , ( ) => {
1905+ originElement . style . position = 'fixed' ;
1906+ originElement . style . left = '100px' ;
1907+ originElement . style . bottom = '0' ;
1908+
1909+ positionStrategy
1910+ . withFlexibleDimensions ( )
1911+ . withPush ( true )
1912+ . withPositions ( [ {
1913+ originX : 'start' ,
1914+ originY : 'bottom' ,
1915+ overlayX : 'start' ,
1916+ overlayY : 'bottom' ,
1917+ } ] ) ;
1918+
1919+ attachOverlay ( {
1920+ width : viewport . getViewportRect ( ) . height ,
1921+ positionStrategy
1922+ } ) ;
1923+
1924+ const originRect = originElement . getBoundingClientRect ( ) ;
1925+ const overlayRect = overlayRef . overlayElement . getBoundingClientRect ( ) ;
1926+
1927+ expect ( Math . floor ( overlayRect . bottom ) ) . toBe ( Math . floor ( originRect . bottom ) ) ;
1928+ } ) ;
1929+
18721930 } ) ;
18731931
18741932 describe ( 'onPositionChange with scrollable view properties' , ( ) => {
0 commit comments