@@ -1261,6 +1261,9 @@ describe('FlexibleConnectedPositionStrategy', () => {
1261
1261
] ) ;
1262
1262
1263
1263
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' ,
1264
1267
width : viewport . getViewportRect ( ) . width + 100 ,
1265
1268
positionStrategy
1266
1269
} ) ;
@@ -1292,6 +1295,9 @@ describe('FlexibleConnectedPositionStrategy', () => {
1292
1295
] ) ;
1293
1296
1294
1297
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' ,
1295
1301
width : viewport . getViewportRect ( ) . width + 100 ,
1296
1302
positionStrategy
1297
1303
} ) ;
@@ -1869,6 +1875,58 @@ describe('FlexibleConnectedPositionStrategy', () => {
1869
1875
document . body . removeChild ( veryLargeElement ) ;
1870
1876
} ) ;
1871
1877
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
+
1872
1930
} ) ;
1873
1931
1874
1932
describe ( 'onPositionChange with scrollable view properties' , ( ) => {
0 commit comments