@@ -155,13 +155,13 @@ describe('MdMenu', () => {
155155 // In "before" position, the right sides of the overlay and the origin are aligned.
156156 // To find the overlay left, subtract the menu width from the origin's right side.
157157 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 ) ,
160160 `Expected menu to open in "before" position if "after" position wouldn't fit.` ) ;
161161
162162 // 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 ) ,
165165 `Expected menu top position to be unchanged if it can fit in the viewport.` ) ;
166166 } ) ;
167167
@@ -184,13 +184,13 @@ describe('MdMenu', () => {
184184 // In "above" position, the bottom edges of the overlay and the origin are aligned.
185185 // To find the overlay top, subtract the menu height from the origin's bottom edge.
186186 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 ) ,
189189 `Expected menu to open in "above" position if "below" position wouldn't fit.` ) ;
190190
191191 // 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 ) ,
194194 `Expected menu x position to be unchanged if it can fit in the viewport.` ) ;
195195 } ) ;
196196
@@ -214,12 +214,12 @@ describe('MdMenu', () => {
214214 const expectedLeft = triggerRect . right - overlayRect . width ;
215215 const expectedTop = triggerRect . bottom - overlayRect . height ;
216216
217- expect ( overlayRect . left . toFixed ( 2 ) )
218- . toEqual ( expectedLeft . toFixed ( 2 ) ,
217+ expect ( overlayRect . left )
218+ . toBe ( Math . round ( expectedLeft ) ,
219219 `Expected menu to open in "before" position if "after" position wouldn't fit.` ) ;
220220
221- expect ( overlayRect . top . toFixed ( 2 ) )
222- . toEqual ( expectedTop . toFixed ( 2 ) ,
221+ expect ( overlayRect . top )
222+ . toBe ( Math . round ( expectedTop ) ,
223223 `Expected menu to open in "above" position if "below" position wouldn't fit.` ) ;
224224 } ) ;
225225
@@ -236,14 +236,14 @@ describe('MdMenu', () => {
236236
237237 // As designated "before" position won't fit on screen, the menu should fall back
238238 // 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 ) ,
241241 `Expected menu to open in "after" position if "before" position wouldn't fit.` ) ;
242242
243243 // As designated "above" position won't fit on screen, the menu should fall back
244244 // 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 ) ,
247247 `Expected menu to open in "below" position if "above" position wouldn't fit.` ) ;
248248 } ) ;
249249
0 commit comments