@@ -645,23 +645,21 @@ describe('igxOverlay', () => {
645
645
}
646
646
} ) ) ;
647
647
648
- it ( 'The shown component is in the center of igx-overlay (visible window) - default.' , ( ) => {
648
+ it ( 'The shown component is in the center of igx-overlay (visible window) - default.' , fakeAsync ( ( ) => {
649
649
const fixture = TestBed . createComponent ( EmptyPageComponent ) ;
650
650
fixture . detectChanges ( ) ;
651
651
fixture . componentInstance . overlay . show ( SimpleDynamicComponent ) ;
652
- fixture . whenStable ( ) . then ( ( ) => {
653
- fixture . detectChanges ( ) ;
654
- const overlayDiv = document . getElementsByClassName ( CLASS_OVERLAY_MAIN ) [ 0 ] ;
655
- const overlayWrapper = overlayDiv . children [ 0 ] as HTMLElement ;
656
- const componentEl = overlayWrapper . children [ 0 ] . children [ 0 ] ;
657
- const wrapperRect = overlayWrapper . getBoundingClientRect ( ) ;
658
- const componentRect = componentEl . getBoundingClientRect ( ) ;
659
- expect ( wrapperRect . width / 2 ) . toEqual ( componentRect . left ) ;
660
- expect ( wrapperRect . height / 2 ) . toEqual ( componentRect . top ) ;
661
- expect ( componentRect . left ) . toEqual ( componentRect . right - componentRect . width ) ;
662
- expect ( componentRect . top ) . toEqual ( componentRect . bottom - componentRect . height ) ;
663
- } ) ;
664
- } ) ;
652
+ tick ( ) ;
653
+ const overlayDiv = document . getElementsByClassName ( CLASS_OVERLAY_MAIN ) [ 0 ] ;
654
+ const overlayWrapper = overlayDiv . children [ 0 ] as HTMLElement ;
655
+ const componentEl = overlayWrapper . children [ 0 ] . children [ 0 ] ;
656
+ const wrapperRect = overlayWrapper . getBoundingClientRect ( ) ;
657
+ const componentRect = componentEl . getBoundingClientRect ( ) ;
658
+ expect ( wrapperRect . width / 2 - componentRect . width / 2 ) . toEqual ( componentRect . left ) ;
659
+ expect ( wrapperRect . height / 2 - componentRect . height / 2 ) . toEqual ( componentRect . top ) ;
660
+ expect ( componentRect . left ) . toEqual ( componentRect . right - componentRect . width ) ;
661
+ expect ( componentRect . top ) . toEqual ( componentRect . bottom - componentRect . height ) ;
662
+ } ) ) ;
665
663
666
664
it ( 'When adding a new instance of a component with the same options, it is rendered exactly on top of the previous one.' , ( ) => {
667
665
const fixture = TestBed . createComponent ( EmptyPageComponent ) ;
@@ -1748,24 +1746,24 @@ describe('igxOverlay', () => {
1748
1746
} ) ;
1749
1747
1750
1748
it ( 'Components with 100% width/height should use their initial container\'s properties when placed inside of the overlay element' ,
1751
- fakeAsync ( ( ) => {
1752
- const fixture = TestBed . createComponent ( WidthTestOverlayComponent ) ;
1753
- fixture . detectChanges ( ) ;
1754
- expect ( fixture . componentInstance . customComponent ) . toBeDefined ( ) ;
1755
- expect ( fixture . componentInstance . customComponent . nativeElement . style . width ) . toEqual ( '100%' ) ;
1756
- expect ( fixture . componentInstance . customComponent . nativeElement . getBoundingClientRect ( ) . width ) . toEqual ( 420 ) ;
1757
- expect ( fixture . componentInstance . customComponent . nativeElement . style . height ) . toEqual ( '100%' ) ;
1758
- expect ( fixture . componentInstance . customComponent . nativeElement . getBoundingClientRect ( ) . height ) . toEqual ( 280 ) ;
1759
- fixture . componentInstance . buttonElement . nativeElement . click ( ) ;
1760
- tick ( ) ;
1761
- const overlayContent = document . getElementsByClassName ( CLASS_OVERLAY_CONTENT ) [ 0 ] as HTMLElement ;
1762
- const overlayChild = overlayContent . lastElementChild as HTMLElement ;
1763
- expect ( overlayChild ) . toBeDefined ( ) ;
1764
- expect ( overlayChild . style . width ) . toEqual ( '100%' ) ;
1765
- expect ( overlayChild . getBoundingClientRect ( ) . width ) . toEqual ( 420 ) ;
1766
- expect ( overlayChild . style . height ) . toEqual ( '100%' ) ;
1767
- expect ( overlayChild . getBoundingClientRect ( ) . height ) . toEqual ( 280 ) ;
1768
- } ) ) ;
1749
+ fakeAsync ( ( ) => {
1750
+ const fixture = TestBed . createComponent ( WidthTestOverlayComponent ) ;
1751
+ fixture . detectChanges ( ) ;
1752
+ expect ( fixture . componentInstance . customComponent ) . toBeDefined ( ) ;
1753
+ expect ( fixture . componentInstance . customComponent . nativeElement . style . width ) . toEqual ( '100%' ) ;
1754
+ expect ( fixture . componentInstance . customComponent . nativeElement . getBoundingClientRect ( ) . width ) . toEqual ( 420 ) ;
1755
+ expect ( fixture . componentInstance . customComponent . nativeElement . style . height ) . toEqual ( '100%' ) ;
1756
+ expect ( fixture . componentInstance . customComponent . nativeElement . getBoundingClientRect ( ) . height ) . toEqual ( 280 ) ;
1757
+ fixture . componentInstance . buttonElement . nativeElement . click ( ) ;
1758
+ tick ( ) ;
1759
+ const overlayContent = document . getElementsByClassName ( CLASS_OVERLAY_CONTENT ) [ 0 ] as HTMLElement ;
1760
+ const overlayChild = overlayContent . lastElementChild as HTMLElement ;
1761
+ expect ( overlayChild ) . toBeDefined ( ) ;
1762
+ expect ( overlayChild . style . width ) . toEqual ( '100%' ) ;
1763
+ expect ( overlayChild . getBoundingClientRect ( ) . width ) . toEqual ( 420 ) ;
1764
+ expect ( overlayChild . style . height ) . toEqual ( '100%' ) ;
1765
+ expect ( overlayChild . getBoundingClientRect ( ) . height ) . toEqual ( 280 ) ;
1766
+ } ) ) ;
1769
1767
} ) ;
1770
1768
} ) ;
1771
1769
0 commit comments