@@ -155,13 +155,13 @@ describe('MdMenu', () => {
155
155
// In "before" position, the right sides of the overlay and the origin are aligned.
156
156
// To find the overlay left, subtract the menu width from the origin's right side.
157
157
const expectedLeft = triggerRect . right - overlayRect . width ;
158
- expect ( overlayRect . left . toFixed ( 2 ) )
159
- . toEqual ( expectedLeft . toFixed ( 2 ) ,
158
+ expect ( overlayRect . left )
159
+ . toBe ( Math . round ( expectedLeft ) ,
160
160
`Expected menu to open in "before" position if "after" position wouldn't fit.` ) ;
161
161
162
162
// The y-position of the overlay should be unaffected, as it can already fit vertically
163
- expect ( overlayRect . top . toFixed ( 2 ) )
164
- . toEqual ( triggerRect . top . toFixed ( 2 ) ,
163
+ expect ( overlayRect . top )
164
+ . toBe ( Math . round ( triggerRect . top ) ,
165
165
`Expected menu top position to be unchanged if it can fit in the viewport.` ) ;
166
166
} ) ;
167
167
@@ -184,13 +184,13 @@ describe('MdMenu', () => {
184
184
// In "above" position, the bottom edges of the overlay and the origin are aligned.
185
185
// To find the overlay top, subtract the menu height from the origin's bottom edge.
186
186
const expectedTop = triggerRect . bottom - overlayRect . height ;
187
- expect ( overlayRect . top . toFixed ( 2 ) )
188
- . toEqual ( expectedTop . toFixed ( 2 ) ,
187
+ expect ( overlayRect . top )
188
+ . toBe ( Math . round ( expectedTop ) ,
189
189
`Expected menu to open in "above" position if "below" position wouldn't fit.` ) ;
190
190
191
191
// The x-position of the overlay should be unaffected, as it can already fit horizontally
192
- expect ( overlayRect . left . toFixed ( 2 ) )
193
- . toEqual ( triggerRect . left . toFixed ( 2 ) ,
192
+ expect ( overlayRect . left )
193
+ . toBe ( Math . round ( triggerRect . left ) ,
194
194
`Expected menu x position to be unchanged if it can fit in the viewport.` ) ;
195
195
} ) ;
196
196
@@ -214,12 +214,12 @@ describe('MdMenu', () => {
214
214
const expectedLeft = triggerRect . right - overlayRect . width ;
215
215
const expectedTop = triggerRect . bottom - overlayRect . height ;
216
216
217
- expect ( overlayRect . left . toFixed ( 2 ) )
218
- . toEqual ( expectedLeft . toFixed ( 2 ) ,
217
+ expect ( overlayRect . left )
218
+ . toBe ( Math . round ( expectedLeft ) ,
219
219
`Expected menu to open in "before" position if "after" position wouldn't fit.` ) ;
220
220
221
- expect ( overlayRect . top . toFixed ( 2 ) )
222
- . toEqual ( expectedTop . toFixed ( 2 ) ,
221
+ expect ( overlayRect . top )
222
+ . toBe ( Math . round ( expectedTop ) ,
223
223
`Expected menu to open in "above" position if "below" position wouldn't fit.` ) ;
224
224
} ) ;
225
225
@@ -236,14 +236,14 @@ describe('MdMenu', () => {
236
236
237
237
// As designated "before" position won't fit on screen, the menu should fall back
238
238
// to "after" mode, where the left sides of the overlay and trigger are aligned.
239
- expect ( overlayRect . left . toFixed ( 2 ) )
240
- . toEqual ( triggerRect . left . toFixed ( 2 ) ,
239
+ expect ( overlayRect . left )
240
+ . toBe ( Math . round ( triggerRect . left ) ,
241
241
`Expected menu to open in "after" position if "before" position wouldn't fit.` ) ;
242
242
243
243
// As designated "above" position won't fit on screen, the menu should fall back
244
244
// to "below" mode, where the top edges of the overlay and trigger are aligned.
245
- expect ( overlayRect . top . toFixed ( 2 ) )
246
- . toEqual ( triggerRect . top . toFixed ( 2 ) ,
245
+ expect ( overlayRect . top )
246
+ . toBe ( Math . round ( triggerRect . top ) ,
247
247
`Expected menu to open in "below" position if "above" position wouldn't fit.` ) ;
248
248
} ) ;
249
249
0 commit comments