@@ -1119,6 +1119,110 @@ describe('FlexibleConnectedPositionStrategy', () => {
1119
1119
expect ( Math . floor ( overlayRect . height ) ) . toBe ( OVERLAY_HEIGHT ) ;
1120
1120
} ) ;
1121
1121
1122
+ it ( 'should set the proper styles when the `bottom` value is exactly zero' , ( ) => {
1123
+ originElement . style . position = 'fixed' ;
1124
+ originElement . style . bottom = '0' ;
1125
+ originElement . style . left = '200px' ;
1126
+
1127
+ positionStrategy
1128
+ . withFlexibleWidth ( )
1129
+ . withFlexibleHeight ( )
1130
+ . withPositions ( [ {
1131
+ overlayY : 'bottom' ,
1132
+ overlayX : 'start' ,
1133
+ originY : 'bottom' ,
1134
+ originX : 'start'
1135
+ } ] ) ;
1136
+
1137
+ attachOverlay ( { positionStrategy} ) ;
1138
+
1139
+ const boundingBox = overlayContainer
1140
+ . getContainerElement ( )
1141
+ . querySelector ( '.cdk-overlay-connected-position-bounding-box' ) as HTMLElement ;
1142
+
1143
+ // Ensure that `0px` is set explicitly, rather than the
1144
+ // property being left blank due to zero being falsy.
1145
+ expect ( boundingBox . style . bottom ) . toBe ( '0px' ) ;
1146
+ } ) ;
1147
+
1148
+ it ( 'should set the proper styles when the `top` value is exactly zero' , ( ) => {
1149
+ originElement . style . position = 'fixed' ;
1150
+ originElement . style . top = '0' ;
1151
+ originElement . style . left = '200px' ;
1152
+
1153
+ positionStrategy
1154
+ . withFlexibleWidth ( )
1155
+ . withFlexibleHeight ( )
1156
+ . withPositions ( [ {
1157
+ overlayY : 'top' ,
1158
+ overlayX : 'start' ,
1159
+ originY : 'top' ,
1160
+ originX : 'start'
1161
+ } ] ) ;
1162
+
1163
+ attachOverlay ( { positionStrategy} ) ;
1164
+
1165
+ const boundingBox = overlayContainer
1166
+ . getContainerElement ( )
1167
+ . querySelector ( '.cdk-overlay-connected-position-bounding-box' ) as HTMLElement ;
1168
+
1169
+ // Ensure that `0px` is set explicitly, rather than the
1170
+ // property being left blank due to zero being falsy.
1171
+ expect ( boundingBox . style . top ) . toBe ( '0px' ) ;
1172
+ } ) ;
1173
+
1174
+ it ( 'should set the proper styles when the `left` value is exactly zero' , ( ) => {
1175
+ originElement . style . position = 'fixed' ;
1176
+ originElement . style . left = '0' ;
1177
+ originElement . style . top = '200px' ;
1178
+
1179
+ positionStrategy
1180
+ . withFlexibleWidth ( )
1181
+ . withFlexibleHeight ( )
1182
+ . withPositions ( [ {
1183
+ overlayY : 'top' ,
1184
+ overlayX : 'start' ,
1185
+ originY : 'top' ,
1186
+ originX : 'start'
1187
+ } ] ) ;
1188
+
1189
+ attachOverlay ( { positionStrategy} ) ;
1190
+
1191
+ const boundingBox = overlayContainer
1192
+ . getContainerElement ( )
1193
+ . querySelector ( '.cdk-overlay-connected-position-bounding-box' ) as HTMLElement ;
1194
+
1195
+ // Ensure that `0px` is set explicitly, rather than the
1196
+ // property being left blank due to zero being falsy.
1197
+ expect ( boundingBox . style . left ) . toBe ( '0px' ) ;
1198
+ } ) ;
1199
+
1200
+ it ( 'should set the proper styles when the `right` value is exactly zero' , ( ) => {
1201
+ originElement . style . position = 'fixed' ;
1202
+ originElement . style . right = '0' ;
1203
+ originElement . style . top = '200px' ;
1204
+
1205
+ positionStrategy
1206
+ . withFlexibleWidth ( )
1207
+ . withFlexibleHeight ( )
1208
+ . withPositions ( [ {
1209
+ overlayY : 'top' ,
1210
+ overlayX : 'end' ,
1211
+ originY : 'top' ,
1212
+ originX : 'end'
1213
+ } ] ) ;
1214
+
1215
+ attachOverlay ( { positionStrategy} ) ;
1216
+
1217
+ const boundingBox = overlayContainer
1218
+ . getContainerElement ( )
1219
+ . querySelector ( '.cdk-overlay-connected-position-bounding-box' ) as HTMLElement ;
1220
+
1221
+ // Ensure that `0px` is set explicitly, rather than the
1222
+ // property being left blank due to zero being falsy.
1223
+ expect ( boundingBox . style . right ) . toBe ( '0px' ) ;
1224
+ } ) ;
1225
+
1122
1226
} ) ;
1123
1227
1124
1228
describe ( 'onPositionChange with scrollable view properties' , ( ) => {
0 commit comments