File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -1597,10 +1597,12 @@ describe('MatSelect', () => {
1597
1597
const overlayPane = overlayContainerElement . querySelector ( '.cdk-overlay-pane' ) ! ;
1598
1598
const triggerBottom = trigger . getBoundingClientRect ( ) . bottom ;
1599
1599
const overlayBottom = overlayPane . getBoundingClientRect ( ) . bottom ;
1600
+ const difference = Math . floor ( overlayBottom ) - Math . floor ( triggerBottom ) ;
1600
1601
1601
- expect ( Math . floor ( overlayBottom ) )
1602
- . toEqual ( Math . floor ( triggerBottom ) ,
1603
- `Expected trigger bottom to align with overlay bottom.` ) ;
1602
+ // Check that the values are within a pixel of each other. This avoids sub-pixel
1603
+ // deviations between OS and browser versions.
1604
+ expect ( Math . abs ( difference ) < 2 )
1605
+ . toEqual ( true , `Expected trigger bottom to align with overlay bottom.` ) ;
1604
1606
} ) ;
1605
1607
} ) ) ;
1606
1608
You can’t perform that action at this time.
0 commit comments