@@ -1187,6 +1187,109 @@ describe('FlexibleConnectedPositionStrategy', () => {
11871187 window . scroll ( 0 , 0 ) ;
11881188 document . body . removeChild ( veryLargeElement ) ;
11891189 } ) ;
1190+ it ( 'should set the proper styles when the `bottom` value is exactly zero' , ( ) => {
1191+ originElement . style . position = 'fixed' ;
1192+ originElement . style . bottom = '0' ;
1193+ originElement . style . left = '200px' ;
1194+
1195+ positionStrategy
1196+ . withFlexibleWidth ( )
1197+ . withFlexibleHeight ( )
1198+ . withPositions ( [ {
1199+ overlayY : 'bottom' ,
1200+ overlayX : 'start' ,
1201+ originY : 'bottom' ,
1202+ originX : 'start'
1203+ } ] ) ;
1204+
1205+ attachOverlay ( { positionStrategy} ) ;
1206+
1207+ const boundingBox = overlayContainer
1208+ . getContainerElement ( )
1209+ . querySelector ( '.cdk-overlay-connected-position-bounding-box' ) as HTMLElement ;
1210+
1211+ // Ensure that `0px` is set explicitly, rather than the
1212+ // property being left blank due to zero being falsy.
1213+ expect ( boundingBox . style . bottom ) . toBe ( '0px' ) ;
1214+ } ) ;
1215+
1216+ it ( 'should set the proper styles when the `top` value is exactly zero' , ( ) => {
1217+ originElement . style . position = 'fixed' ;
1218+ originElement . style . top = '0' ;
1219+ originElement . style . left = '200px' ;
1220+
1221+ positionStrategy
1222+ . withFlexibleWidth ( )
1223+ . withFlexibleHeight ( )
1224+ . withPositions ( [ {
1225+ overlayY : 'top' ,
1226+ overlayX : 'start' ,
1227+ originY : 'top' ,
1228+ originX : 'start'
1229+ } ] ) ;
1230+
1231+ attachOverlay ( { positionStrategy} ) ;
1232+
1233+ const boundingBox = overlayContainer
1234+ . getContainerElement ( )
1235+ . querySelector ( '.cdk-overlay-connected-position-bounding-box' ) as HTMLElement ;
1236+
1237+ // Ensure that `0px` is set explicitly, rather than the
1238+ // property being left blank due to zero being falsy.
1239+ expect ( boundingBox . style . top ) . toBe ( '0px' ) ;
1240+ } ) ;
1241+
1242+ it ( 'should set the proper styles when the `left` value is exactly zero' , ( ) => {
1243+ originElement . style . position = 'fixed' ;
1244+ originElement . style . left = '0' ;
1245+ originElement . style . top = '200px' ;
1246+
1247+ positionStrategy
1248+ . withFlexibleWidth ( )
1249+ . withFlexibleHeight ( )
1250+ . withPositions ( [ {
1251+ overlayY : 'top' ,
1252+ overlayX : 'start' ,
1253+ originY : 'top' ,
1254+ originX : 'start'
1255+ } ] ) ;
1256+
1257+ attachOverlay ( { positionStrategy} ) ;
1258+
1259+ const boundingBox = overlayContainer
1260+ . getContainerElement ( )
1261+ . querySelector ( '.cdk-overlay-connected-position-bounding-box' ) as HTMLElement ;
1262+
1263+ // Ensure that `0px` is set explicitly, rather than the
1264+ // property being left blank due to zero being falsy.
1265+ expect ( boundingBox . style . left ) . toBe ( '0px' ) ;
1266+ } ) ;
1267+
1268+ it ( 'should set the proper styles when the `right` value is exactly zero' , ( ) => {
1269+ originElement . style . position = 'fixed' ;
1270+ originElement . style . right = '0' ;
1271+ originElement . style . top = '200px' ;
1272+
1273+ positionStrategy
1274+ . withFlexibleWidth ( )
1275+ . withFlexibleHeight ( )
1276+ . withPositions ( [ {
1277+ overlayY : 'top' ,
1278+ overlayX : 'end' ,
1279+ originY : 'top' ,
1280+ originX : 'end'
1281+ } ] ) ;
1282+
1283+ attachOverlay ( { positionStrategy} ) ;
1284+
1285+ const boundingBox = overlayContainer
1286+ . getContainerElement ( )
1287+ . querySelector ( '.cdk-overlay-connected-position-bounding-box' ) as HTMLElement ;
1288+
1289+ // Ensure that `0px` is set explicitly, rather than the
1290+ // property being left blank due to zero being falsy.
1291+ expect ( boundingBox . style . right ) . toBe ( '0px' ) ;
1292+ } ) ;
11901293
11911294 } ) ;
11921295
0 commit comments