@@ -1212,17 +1212,18 @@ describe('igxOverlay', () => {
1212
1212
spyOn ( scrollStrat , 'attach' ) . and . callThrough ( ) ;
1213
1213
spyOn ( scrollStrat , 'detach' ) . and . callThrough ( ) ;
1214
1214
const scrollSpy = spyOn < any > ( scrollStrat , 'onScroll' ) . and . callThrough ( ) ;
1215
- overlay . show ( overlay . attach ( SimpleDynamicComponent , overlaySettings ) ) ;
1215
+ const overlayId = overlay . attach ( SimpleDynamicComponent , overlaySettings ) ;
1216
+ overlay . show ( overlayId ) ;
1216
1217
tick ( ) ;
1217
1218
1218
1219
expect ( scrollStrat . attach ) . toHaveBeenCalledTimes ( 1 ) ;
1219
1220
expect ( scrollStrat . initialize ) . toHaveBeenCalledTimes ( 1 ) ;
1220
1221
expect ( scrollStrat . detach ) . toHaveBeenCalledTimes ( 0 ) ;
1221
- document . dispatchEvent ( new Event ( 'scroll' ) ) ;
1222
+ document . documentElement . dispatchEvent ( new Event ( 'scroll' ) ) ;
1222
1223
expect ( scrollSpy ) . toHaveBeenCalledTimes ( 1 ) ;
1223
1224
1224
- overlay . hide ( '0' ) ;
1225
- overlay . detach ( '0' ) ;
1225
+ overlay . hide ( overlayId ) ;
1226
+ overlay . detach ( overlayId ) ;
1226
1227
tick ( ) ;
1227
1228
expect ( scrollStrat . detach ) . toHaveBeenCalledTimes ( 1 ) ;
1228
1229
} ) ) ;
@@ -1258,7 +1259,7 @@ describe('igxOverlay', () => {
1258
1259
expect ( scrollStrat . attach ) . toHaveBeenCalledTimes ( 1 ) ;
1259
1260
expect ( scrollStrat . initialize ) . toHaveBeenCalledTimes ( 1 ) ;
1260
1261
expect ( scrollStrat . detach ) . toHaveBeenCalledTimes ( 0 ) ;
1261
- document . dispatchEvent ( new Event ( 'scroll' ) ) ;
1262
+ document . documentElement . dispatchEvent ( new Event ( 'scroll' ) ) ;
1262
1263
expect ( scrollSpy ) . toHaveBeenCalledTimes ( 1 ) ;
1263
1264
overlay . hide ( '0' ) ;
1264
1265
overlay . detach ( '0' ) ;
@@ -1299,7 +1300,7 @@ describe('igxOverlay', () => {
1299
1300
expect ( scrollSpy ) . toHaveBeenCalledTimes ( 1 ) ;
1300
1301
expect ( overlay . reposition ) . not . toHaveBeenCalled ( ) ;
1301
1302
1302
- document . dispatchEvent ( new Event ( 'scroll' ) ) ;
1303
+ document . documentElement . dispatchEvent ( new Event ( 'scroll' ) ) ;
1303
1304
expect ( scrollSpy ) . toHaveBeenCalledTimes ( 2 ) ;
1304
1305
expect ( overlay . reposition ) . toHaveBeenCalledTimes ( 1 ) ;
1305
1306
expect ( overlay . reposition ) . toHaveBeenCalledWith ( id ) ;
@@ -1795,12 +1796,12 @@ describe('igxOverlay', () => {
1795
1796
expect ( overlayChildPosition . y ) . toEqual ( 0 ) ;
1796
1797
expect ( buttonElement . getBoundingClientRect ( ) . y ) . toEqual ( 0 ) ;
1797
1798
1798
- document . dispatchEvent ( new Event ( 'scroll' ) ) ;
1799
+ document . documentElement . dispatchEvent ( new Event ( 'scroll' ) ) ;
1799
1800
tick ( ) ;
1800
1801
expect ( document . documentElement . scrollTop ) . toEqual ( 0 ) ;
1801
1802
1802
1803
document . documentElement . scrollTop += 25 ;
1803
- document . dispatchEvent ( new Event ( 'scroll' ) ) ;
1804
+ document . documentElement . dispatchEvent ( new Event ( 'scroll' ) ) ;
1804
1805
tick ( ) ;
1805
1806
expect ( document . documentElement . scrollTop ) . toEqual ( 25 ) ;
1806
1807
contentElement = ( fixture . nativeElement as HTMLElement )
@@ -1810,7 +1811,7 @@ describe('igxOverlay', () => {
1810
1811
expect ( buttonElement . getBoundingClientRect ( ) . y ) . toEqual ( - 25 ) ;
1811
1812
1812
1813
document . documentElement . scrollTop += 500 ;
1813
- document . dispatchEvent ( new Event ( 'scroll' ) ) ;
1814
+ document . documentElement . dispatchEvent ( new Event ( 'scroll' ) ) ;
1814
1815
tick ( ) ;
1815
1816
contentElement = ( fixture . nativeElement as HTMLElement )
1816
1817
. parentElement . getElementsByClassName ( CLASS_OVERLAY_CONTENT ) [ 0 ] as HTMLElement ;
@@ -2374,18 +2375,21 @@ describe('igxOverlay', () => {
2374
2375
2375
2376
const scrollSpy = spyOn < any > ( scrollStrategy , 'onScroll' ) . and . callThrough ( ) ;
2376
2377
2377
- overlay . show ( overlay . attach ( SimpleDynamicComponent , overlaySettings ) ) ;
2378
+ const overlayId = overlay . attach ( SimpleDynamicComponent , overlaySettings ) ;
2379
+ overlay . show ( overlayId ) ;
2378
2380
tick ( ) ;
2379
2381
expect ( scrollStrategy . initialize ) . toHaveBeenCalledTimes ( 1 ) ;
2380
2382
expect ( scrollStrategy . attach ) . toHaveBeenCalledTimes ( 1 ) ;
2381
2383
expect ( scrollStrategy . detach ) . toHaveBeenCalledTimes ( 0 ) ;
2382
2384
expect ( overlay . hide ) . toHaveBeenCalledTimes ( 0 ) ;
2383
2385
document . documentElement . scrollTop += scrollTolerance ;
2384
- document . dispatchEvent ( new Event ( 'scroll' ) ) ;
2386
+ document . documentElement . dispatchEvent ( new Event ( 'scroll' ) ) ;
2385
2387
tick ( ) ;
2386
2388
expect ( scrollSpy ) . toHaveBeenCalledTimes ( 1 ) ;
2387
2389
expect ( overlay . hide ) . toHaveBeenCalledTimes ( 0 ) ;
2388
2390
expect ( scrollStrategy . detach ) . toHaveBeenCalledTimes ( 0 ) ;
2391
+
2392
+ overlay . detach ( overlayId ) ;
2389
2393
} ) ) ;
2390
2394
2391
2395
it ( 'Should persist the component open state when scrolling and absolute scroll strategy is used.' , fakeAsync ( ( ) => {
@@ -2414,7 +2418,7 @@ describe('igxOverlay', () => {
2414
2418
expect ( scrollStrategy . attach ) . toHaveBeenCalledTimes ( 1 ) ;
2415
2419
2416
2420
document . documentElement . scrollTop += scrollTolerance ;
2417
- document . dispatchEvent ( new Event ( 'scroll' ) ) ;
2421
+ document . documentElement . dispatchEvent ( new Event ( 'scroll' ) ) ;
2418
2422
tick ( ) ;
2419
2423
expect ( scrollSpy ) . toHaveBeenCalledTimes ( 1 ) ;
2420
2424
expect ( scrollStrategy . detach ) . toHaveBeenCalledTimes ( 0 ) ;
@@ -2858,18 +2862,21 @@ describe('igxOverlay', () => {
2858
2862
2859
2863
const scrollSpy = spyOn < any > ( scrollStrategy , 'onScroll' ) . and . callThrough ( ) ;
2860
2864
2861
- overlay . show ( overlay . attach ( SimpleDynamicComponent , overlaySettings ) ) ;
2865
+ const overlayId = overlay . attach ( SimpleDynamicComponent , overlaySettings ) ;
2866
+ overlay . show ( overlayId ) ;
2862
2867
tick ( ) ;
2863
2868
expect ( scrollStrategy . initialize ) . toHaveBeenCalledTimes ( 1 ) ;
2864
2869
expect ( scrollStrategy . attach ) . toHaveBeenCalledTimes ( 1 ) ;
2865
2870
expect ( scrollStrategy . detach ) . toHaveBeenCalledTimes ( 0 ) ;
2866
2871
expect ( overlay . hide ) . toHaveBeenCalledTimes ( 0 ) ;
2867
2872
document . documentElement . scrollTop += scrollTolerance ;
2868
- document . dispatchEvent ( new Event ( 'scroll' ) ) ;
2873
+ document . documentElement . dispatchEvent ( new Event ( 'scroll' ) ) ;
2869
2874
tick ( ) ;
2870
2875
expect ( scrollSpy ) . toHaveBeenCalledTimes ( 1 ) ;
2871
2876
expect ( overlay . hide ) . toHaveBeenCalledTimes ( 0 ) ;
2872
2877
expect ( scrollStrategy . detach ) . toHaveBeenCalledTimes ( 0 ) ;
2878
+
2879
+ overlay . detach ( overlayId ) ;
2873
2880
} ) ) ;
2874
2881
2875
2882
it ( 'Should persist the component open state when scrolling and absolute scroll strategy is used.' , fakeAsync ( ( ) => {
@@ -2898,7 +2905,7 @@ describe('igxOverlay', () => {
2898
2905
expect ( scrollStrategy . attach ) . toHaveBeenCalledTimes ( 1 ) ;
2899
2906
2900
2907
document . documentElement . scrollTop += scrollTolerance ;
2901
- document . dispatchEvent ( new Event ( 'scroll' ) ) ;
2908
+ document . documentElement . dispatchEvent ( new Event ( 'scroll' ) ) ;
2902
2909
tick ( ) ;
2903
2910
expect ( scrollSpy ) . toHaveBeenCalledTimes ( 1 ) ;
2904
2911
expect ( scrollStrategy . detach ) . toHaveBeenCalledTimes ( 0 ) ;
@@ -3273,7 +3280,7 @@ describe('igxOverlay', () => {
3273
3280
3274
3281
document . documentElement . scrollTop = 100 ;
3275
3282
document . documentElement . scrollLeft = 50 ;
3276
- document . dispatchEvent ( new Event ( 'scroll' ) ) ;
3283
+ document . documentElement . dispatchEvent ( new Event ( 'scroll' ) ) ;
3277
3284
tick ( ) ;
3278
3285
3279
3286
expect ( componentRect ) . toEqual ( componentElement . getBoundingClientRect ( ) ) ;
@@ -3285,7 +3292,7 @@ describe('igxOverlay', () => {
3285
3292
it ( 'Should retain the component state when scrolling and block scroll strategy is used.' , fakeAsync ( async ( ) => {
3286
3293
TestBed . overrideComponent ( EmptyPageComponent , {
3287
3294
set : {
3288
- styles : [ `button { position: absolute, bottom: -2000px; } ` ]
3295
+ styles : [ `button { position: absolute; bottom: -2000px; } ` ]
3289
3296
}
3290
3297
} ) ;
3291
3298
await TestBed . compileComponents ( ) ;
@@ -3305,17 +3312,17 @@ describe('igxOverlay', () => {
3305
3312
overlay . show ( overlayId ) ;
3306
3313
tick ( ) ;
3307
3314
expect ( document . documentElement . scrollTop ) . toEqual ( 0 ) ;
3308
- document . dispatchEvent ( new Event ( 'scroll' ) ) ;
3315
+ document . documentElement . dispatchEvent ( new Event ( 'scroll' ) ) ;
3309
3316
tick ( ) ;
3310
3317
expect ( document . documentElement . scrollTop ) . toEqual ( 0 ) ;
3311
3318
3312
3319
document . documentElement . scrollTop += 25 ;
3313
- document . dispatchEvent ( new Event ( 'scroll' ) ) ;
3320
+ document . documentElement . dispatchEvent ( new Event ( 'scroll' ) ) ;
3314
3321
tick ( ) ;
3315
3322
expect ( document . documentElement . scrollTop ) . toEqual ( 0 ) ;
3316
3323
3317
3324
document . documentElement . scrollTop += 1000 ;
3318
- document . dispatchEvent ( new Event ( 'scroll' ) ) ;
3325
+ document . documentElement . dispatchEvent ( new Event ( 'scroll' ) ) ;
3319
3326
tick ( ) ;
3320
3327
3321
3328
const wrapperElement = ( fixture . nativeElement as HTMLElement )
@@ -3695,7 +3702,7 @@ describe('igxOverlay', () => {
3695
3702
3696
3703
document . documentElement . scrollTop = 100 ;
3697
3704
document . documentElement . scrollLeft = 50 ;
3698
- document . dispatchEvent ( new Event ( 'scroll' ) ) ;
3705
+ document . documentElement . dispatchEvent ( new Event ( 'scroll' ) ) ;
3699
3706
tick ( ) ;
3700
3707
3701
3708
expect ( componentRect ) . toEqual ( componentElement . getBoundingClientRect ( ) ) ;
@@ -3733,7 +3740,7 @@ describe('igxOverlay', () => {
3733
3740
3734
3741
document . documentElement . scrollTop = 40 ;
3735
3742
document . documentElement . scrollLeft = 30 ;
3736
- document . dispatchEvent ( new Event ( 'scroll' ) ) ;
3743
+ document . documentElement . dispatchEvent ( new Event ( 'scroll' ) ) ;
3737
3744
tick ( ) ;
3738
3745
3739
3746
expect ( componentRect ) . toEqual ( componentElement . getBoundingClientRect ( ) ) ;
@@ -3818,7 +3825,7 @@ describe('igxOverlay', () => {
3818
3825
expect ( document . documentElement . scrollTop ) . toEqual ( 0 ) ;
3819
3826
3820
3827
document . documentElement . scrollTop += scrollTolerance ;
3821
- document . dispatchEvent ( new Event ( 'scroll' ) ) ;
3828
+ document . documentElement . dispatchEvent ( new Event ( 'scroll' ) ) ;
3822
3829
tick ( ) ;
3823
3830
expect ( document . documentElement . scrollTop ) . toEqual ( scrollTolerance ) ;
3824
3831
const wrapperElement = ( fixture . nativeElement as HTMLElement )
@@ -3905,7 +3912,7 @@ describe('igxOverlay', () => {
3905
3912
const componentRect = componentElement . getBoundingClientRect ( ) ;
3906
3913
3907
3914
document . documentElement . scrollTop += scrollTolerance ;
3908
- document . dispatchEvent ( new Event ( 'scroll' ) ) ;
3915
+ document . documentElement . dispatchEvent ( new Event ( 'scroll' ) ) ;
3909
3916
tick ( ) ;
3910
3917
expect ( document . documentElement . scrollTop ) . toEqual ( scrollTolerance ) ;
3911
3918
expect ( document . getElementsByClassName ( CLASS_OVERLAY_WRAPPER ) . length ) . toEqual ( 1 ) ;
@@ -3946,7 +3953,7 @@ describe('igxOverlay', () => {
3946
3953
const componentRect = componentElement . getBoundingClientRect ( ) ;
3947
3954
3948
3955
document . documentElement . scrollTop += scrollTolerance ;
3949
- document . dispatchEvent ( new Event ( 'scroll' ) ) ;
3956
+ document . documentElement . dispatchEvent ( new Event ( 'scroll' ) ) ;
3950
3957
tick ( ) ;
3951
3958
const newElementRect = componentElement . getBoundingClientRect ( ) ;
3952
3959
expect ( document . documentElement . scrollTop ) . toEqual ( scrollTolerance ) ;
0 commit comments