@@ -303,30 +303,29 @@ describe('igxOverlay', () => {
303
303
const overlay = fixture . componentInstance . overlay ;
304
304
fixture . detectChanges ( ) ;
305
305
306
- overlay . show ( overlay . attach ( SimpleDynamicComponent , {
307
- outlet : button ,
308
- modal : false
309
- } ) ) ;
306
+ let id = overlay . attach ( SimpleDynamicComponent , { outlet : button , modal : false } ) ;
307
+ overlay . show ( id ) ;
310
308
tick ( ) ;
311
309
let wrapper = document . getElementsByClassName ( CLASS_OVERLAY_WRAPPER ) [ 0 ] ;
312
310
expect ( wrapper ) . toBeDefined ( ) ;
313
311
expect ( wrapper . parentNode ) . toBe ( button . nativeElement ) ;
314
- overlay . detachAll ( ) ;
312
+ overlay . detach ( id ) ;
313
+ tick ( ) ;
315
314
316
- overlay . show ( overlay . attach ( SimpleDynamicComponent , { modal : false } ) ) ;
315
+ id = overlay . attach ( SimpleDynamicComponent , { modal : false } ) ;
316
+ overlay . show ( id ) ;
317
317
tick ( ) ;
318
318
wrapper = document . getElementsByClassName ( CLASS_OVERLAY_WRAPPER ) [ 0 ] ;
319
319
expect ( wrapper ) . toBeDefined ( ) ;
320
320
expect ( wrapper . parentElement . classList ) . toContain ( 'igx-overlay' ) ;
321
321
expect ( wrapper . parentElement . parentElement ) . toBe ( document . body ) ;
322
- overlay . detachAll ( ) ;
322
+ overlay . detach ( id ) ;
323
+ tick ( ) ;
323
324
324
325
const outlet = document . createElement ( 'div' ) ;
325
326
fixture . debugElement . nativeElement . appendChild ( outlet ) ;
326
- overlay . show ( overlay . attach ( SimpleDynamicComponent , {
327
- modal : false ,
328
- outlet : new IgxOverlayOutletDirective ( new ElementRef ( outlet ) )
329
- } ) ) ;
327
+ id = overlay . attach ( SimpleDynamicComponent , { modal : false , outlet : new IgxOverlayOutletDirective ( new ElementRef ( outlet ) ) } ) ;
328
+ overlay . show ( id ) ;
330
329
tick ( ) ;
331
330
wrapper = document . getElementsByClassName ( CLASS_OVERLAY_WRAPPER ) [ 0 ] ;
332
331
expect ( wrapper ) . toBeDefined ( ) ;
@@ -1324,14 +1323,16 @@ describe('igxOverlay', () => {
1324
1323
for ( let j = 0 ; j < verAl . length ; j ++ ) {
1325
1324
positionSettings . verticalDirection = VerticalAlignment [ verAl [ j ] ] ;
1326
1325
overlaySettings . positionStrategy = new GlobalPositionStrategy ( positionSettings ) ;
1327
- overlay . show ( overlay . attach ( SimpleDynamicComponent , overlaySettings ) ) ;
1326
+ const id = overlay . attach ( SimpleDynamicComponent , overlaySettings ) ;
1327
+ overlay . show ( id ) ;
1328
1328
tick ( ) ;
1329
1329
1330
1330
const overlayDiv = document . getElementsByClassName ( CLASS_OVERLAY_MAIN ) [ 0 ] ;
1331
1331
const overlayWrapper = overlayDiv . children [ 0 ] as HTMLDivElement ;
1332
1332
expect ( overlayWrapper . style . justifyContent ) . toBe ( cssStyles [ i ] ) ;
1333
1333
expect ( overlayWrapper . style . alignItems ) . toBe ( cssStyles [ j ] ) ;
1334
- overlay . detachAll ( ) ;
1334
+ overlay . detach ( id ) ;
1335
+ tick ( ) ;
1335
1336
}
1336
1337
}
1337
1338
} ) ) ;
@@ -2097,7 +2098,8 @@ describe('igxOverlay', () => {
2097
2098
positionSettings . horizontalStartPoint = horizontalAlignment ;
2098
2099
positionSettings . verticalStartPoint = verticalAlignment ;
2099
2100
overlaySettings . positionStrategy = new AutoPositionStrategy ( positionSettings ) ;
2100
- overlay . show ( overlay . attach ( SimpleDynamicComponent , overlaySettings ) ) ;
2101
+ const id = overlay . attach ( SimpleDynamicComponent , overlaySettings ) ;
2102
+ overlay . show ( id ) ;
2101
2103
tick ( ) ;
2102
2104
fix . detectChanges ( ) ;
2103
2105
const overlayWrapper = document . getElementsByClassName ( CLASS_OVERLAY_WRAPPER ) [ 0 ] ;
@@ -2109,7 +2111,9 @@ describe('igxOverlay', () => {
2109
2111
expect ( wrapperMargin ) . toEqual ( expectedMargin ) ;
2110
2112
expect ( contentMargin ) . toEqual ( expectedMargin ) ;
2111
2113
expect ( elementMargin ) . toEqual ( expectedMargin ) ;
2112
- overlay . detachAll ( ) ;
2114
+ overlay . detach ( id ) ;
2115
+ tick ( ) ;
2116
+ fix . detectChanges ( ) ;
2113
2117
}
2114
2118
} ) ) ;
2115
2119
@@ -2584,7 +2588,8 @@ describe('igxOverlay', () => {
2584
2588
positionSettings . horizontalStartPoint = horizontalAlignment ;
2585
2589
positionSettings . verticalStartPoint = verticalAlignment ;
2586
2590
overlaySettings . positionStrategy = new ElasticPositionStrategy ( positionSettings ) ;
2587
- overlay . show ( overlay . attach ( SimpleDynamicComponent , overlaySettings ) ) ;
2591
+ const id = overlay . attach ( SimpleDynamicComponent , overlaySettings ) ;
2592
+ overlay . show ( id ) ;
2588
2593
tick ( ) ;
2589
2594
fix . detectChanges ( ) ;
2590
2595
const overlayWrapper = document . getElementsByClassName ( CLASS_OVERLAY_WRAPPER ) [ 0 ] ;
@@ -2596,7 +2601,9 @@ describe('igxOverlay', () => {
2596
2601
expect ( wrapperMargin ) . toEqual ( expectedMargin ) ;
2597
2602
expect ( contentMargin ) . toEqual ( expectedMargin ) ;
2598
2603
expect ( elementMargin ) . toEqual ( expectedMargin ) ;
2599
- overlay . hideAll ( ) ;
2604
+ overlay . hide ( id ) ;
2605
+ tick ( ) ;
2606
+ fix . detectChanges ( ) ;
2600
2607
}
2601
2608
} ) ) ;
2602
2609
0 commit comments