@@ -216,16 +216,15 @@ describe('igxOverlay', () => {
216
216
217
217
overlay . show ( overlay . attach ( SimpleDynamicComponent ) , {
218
218
outlet : button ,
219
- modal : false ,
220
- closeOnEsc : false
219
+ modal : false
221
220
} ) ;
222
221
tick ( ) ;
223
222
let wrapper = document . getElementsByClassName ( CLASS_OVERLAY_WRAPPER ) [ 0 ] ;
224
223
expect ( wrapper ) . toBeDefined ( ) ;
225
224
expect ( wrapper . parentNode ) . toBe ( button . nativeElement ) ;
226
225
overlay . hideAll ( ) ;
227
226
228
- overlay . show ( overlay . attach ( SimpleDynamicComponent ) , { modal : false , closeOnEsc : false } ) ;
227
+ overlay . show ( overlay . attach ( SimpleDynamicComponent ) , { modal : false } ) ;
229
228
tick ( ) ;
230
229
wrapper = document . getElementsByClassName ( CLASS_OVERLAY_WRAPPER ) [ 0 ] ;
231
230
expect ( wrapper ) . toBeDefined ( ) ;
@@ -237,7 +236,6 @@ describe('igxOverlay', () => {
237
236
fixture . debugElement . nativeElement . appendChild ( outlet ) ;
238
237
overlay . show ( overlay . attach ( SimpleDynamicComponent ) , {
239
238
modal : false ,
240
- closeOnEsc : false ,
241
239
outlet : new IgxOverlayOutletDirective ( new ElementRef ( outlet ) )
242
240
} ) ;
243
241
tick ( ) ;
@@ -688,7 +686,6 @@ describe('igxOverlay', () => {
688
686
tick ( ) ;
689
687
690
688
fix . componentInstance . overlaySettings . outlet = fix . componentInstance . elementRef ;
691
- fix . componentInstance . overlaySettings . closeOnEsc = false ;
692
689
693
690
const buttonElement : HTMLElement = fix . componentInstance . buttonElement . nativeElement ;
694
691
buttonElement . click ( ) ;
@@ -1078,7 +1075,6 @@ describe('igxOverlay', () => {
1078
1075
positionStrategy : new GlobalPositionStrategy ( ) ,
1079
1076
scrollStrategy : new NoOpScrollStrategy ( ) ,
1080
1077
modal : false ,
1081
- closeOnEsc : false ,
1082
1078
closeOnOutsideClick : false
1083
1079
} ;
1084
1080
const positionSettings : PositionSettings = {
@@ -1305,7 +1301,6 @@ describe('igxOverlay', () => {
1305
1301
positionStrategy : new GlobalPositionStrategy ( ) ,
1306
1302
scrollStrategy : new NoOpScrollStrategy ( ) ,
1307
1303
modal : false ,
1308
- closeOnEsc : false ,
1309
1304
closeOnOutsideClick : false
1310
1305
} ;
1311
1306
const positionSettings : PositionSettings = {
@@ -1332,7 +1327,6 @@ describe('igxOverlay', () => {
1332
1327
positionStrategy : new GlobalPositionStrategy ( ) ,
1333
1328
scrollStrategy : new NoOpScrollStrategy ( ) ,
1334
1329
modal : false ,
1335
- closeOnEsc : false ,
1336
1330
closeOnOutsideClick : false
1337
1331
} ;
1338
1332
overlaySettings . positionStrategy = new ConnectedPositioningStrategy ( ) ;
@@ -1460,7 +1454,6 @@ describe('igxOverlay', () => {
1460
1454
positionStrategy : new GlobalPositionStrategy ( ) ,
1461
1455
scrollStrategy : scrollStrat ,
1462
1456
modal : false ,
1463
- closeOnEsc : false ,
1464
1457
closeOnOutsideClick : false
1465
1458
} ;
1466
1459
const overlay = fixture . componentInstance . overlay ;
@@ -1490,7 +1483,6 @@ describe('igxOverlay', () => {
1490
1483
positionStrategy : new ConnectedPositioningStrategy ( ) ,
1491
1484
scrollStrategy : scrollStrat ,
1492
1485
modal : false ,
1493
- closeOnEsc : false ,
1494
1486
closeOnOutsideClick : false
1495
1487
} ;
1496
1488
const buttonElement = fixture . componentInstance . buttonElement . nativeElement ;
@@ -1668,7 +1660,6 @@ describe('igxOverlay', () => {
1668
1660
positionStrategy : new AutoPositionStrategy ( ) ,
1669
1661
scrollStrategy : new NoOpScrollStrategy ( ) ,
1670
1662
modal : false ,
1671
- closeOnEsc : false ,
1672
1663
closeOnOutsideClick : false
1673
1664
} ;
1674
1665
@@ -1697,7 +1688,6 @@ describe('igxOverlay', () => {
1697
1688
positionStrategy : new GlobalPositionStrategy ( ) ,
1698
1689
scrollStrategy : new NoOpScrollStrategy ( ) ,
1699
1690
modal : false ,
1700
- closeOnEsc : false ,
1701
1691
closeOnOutsideClick : false
1702
1692
} ;
1703
1693
const positionSettings : PositionSettings = {
@@ -1943,7 +1933,6 @@ describe('igxOverlay', () => {
1943
1933
positionStrategy : new AutoPositionStrategy ( positionSettings ) ,
1944
1934
scrollStrategy : new NoOpScrollStrategy ( ) ,
1945
1935
modal : false ,
1946
- closeOnEsc : false ,
1947
1936
closeOnOutsideClick : false
1948
1937
} ;
1949
1938
const hAlignmentArray = Object . keys ( HorizontalAlignment ) . filter ( key => ! isNaN ( Number ( HorizontalAlignment [ key ] ) ) ) ;
@@ -2000,7 +1989,6 @@ describe('igxOverlay', () => {
2000
1989
positionStrategy : new AutoPositionStrategy ( positionSettings ) ,
2001
1990
scrollStrategy : new NoOpScrollStrategy ( ) ,
2002
1991
modal : false ,
2003
- closeOnEsc : false ,
2004
1992
closeOnOutsideClick : false
2005
1993
} ;
2006
1994
overlay . show ( overlay . attach ( SimpleDynamicComponent ) , overlaySettings ) ;
@@ -2043,7 +2031,6 @@ describe('igxOverlay', () => {
2043
2031
positionStrategy : new AutoPositionStrategy ( positionSettings ) ,
2044
2032
scrollStrategy : new NoOpScrollStrategy ( ) ,
2045
2033
modal : false ,
2046
- closeOnEsc : false ,
2047
2034
closeOnOutsideClick : false
2048
2035
} ;
2049
2036
overlay . show ( overlay . attach ( SimpleDynamicComponent ) , overlaySettings ) ;
@@ -2145,7 +2132,6 @@ describe('igxOverlay', () => {
2145
2132
positionStrategy : new ElasticPositionStrategy ( ) ,
2146
2133
scrollStrategy : new NoOpScrollStrategy ( ) ,
2147
2134
modal : false ,
2148
- closeOnEsc : false ,
2149
2135
closeOnOutsideClick : false
2150
2136
} ;
2151
2137
@@ -2174,7 +2160,6 @@ describe('igxOverlay', () => {
2174
2160
positionStrategy : new GlobalPositionStrategy ( ) ,
2175
2161
scrollStrategy : new NoOpScrollStrategy ( ) ,
2176
2162
modal : false ,
2177
- closeOnEsc : false ,
2178
2163
closeOnOutsideClick : false
2179
2164
} ;
2180
2165
const positionSettings : PositionSettings = {
@@ -2438,7 +2423,6 @@ describe('igxOverlay', () => {
2438
2423
positionStrategy : new ElasticPositionStrategy ( positionSettings ) ,
2439
2424
scrollStrategy : new NoOpScrollStrategy ( ) ,
2440
2425
modal : false ,
2441
- closeOnEsc : false ,
2442
2426
closeOnOutsideClick : false
2443
2427
} ;
2444
2428
const hAlignmentArray = Object . keys ( HorizontalAlignment ) . filter ( key => ! isNaN ( Number ( HorizontalAlignment [ key ] ) ) ) ;
@@ -2495,7 +2479,6 @@ describe('igxOverlay', () => {
2495
2479
positionStrategy : new ElasticPositionStrategy ( positionSettings ) ,
2496
2480
scrollStrategy : new NoOpScrollStrategy ( ) ,
2497
2481
modal : false ,
2498
- closeOnEsc : false ,
2499
2482
closeOnOutsideClick : false
2500
2483
} ;
2501
2484
overlay . show ( overlay . attach ( SimpleDynamicComponent ) , overlaySettings ) ;
@@ -2539,7 +2522,6 @@ describe('igxOverlay', () => {
2539
2522
positionStrategy : new ElasticPositionStrategy ( positionSettings ) ,
2540
2523
scrollStrategy : new NoOpScrollStrategy ( ) ,
2541
2524
modal : false ,
2542
- closeOnEsc : false ,
2543
2525
closeOnOutsideClick : false
2544
2526
} ;
2545
2527
overlay . show ( overlay . attach ( SimpleDynamicComponent ) , overlaySettings ) ;
@@ -2766,7 +2748,6 @@ describe('igxOverlay', () => {
2766
2748
const overlay = fixture . componentInstance . overlay ;
2767
2749
const overlaySettings : OverlaySettings = {
2768
2750
modal : true ,
2769
- closeOnEsc : false ,
2770
2751
positionStrategy : new GlobalPositionStrategy ( )
2771
2752
} ;
2772
2753
const targetButton = 'Escape' ;
@@ -2790,6 +2771,27 @@ describe('igxOverlay', () => {
2790
2771
expect ( overlayWrapper ) . toBeTruthy ( ) ;
2791
2772
} ) ) ;
2792
2773
2774
+ it ( 'Should close the opened overlays consecutively on escape keypress' , fakeAsync ( ( ) => {
2775
+ const fixture = TestBed . createComponent ( EmptyPageComponent ) ;
2776
+ const overlay = fixture . componentInstance . overlay ;
2777
+ overlay . show ( overlay . attach ( SimpleDynamicComponent ) , { modal : false , closeOnEsc : true } ) ;
2778
+ tick ( ) ;
2779
+ overlay . show ( overlay . attach ( SimpleDynamicComponent ) , { modal : true , closeOnEsc : true } ) ;
2780
+ tick ( ) ;
2781
+
2782
+ const overlayWrapper = document . getElementsByClassName ( CLASS_OVERLAY_WRAPPER_MODAL ) [ 0 ] ;
2783
+ const escEvent = new KeyboardEvent ( 'keydown' , {
2784
+ key : 'Escape'
2785
+ } ) ;
2786
+ overlayWrapper . dispatchEvent ( escEvent ) ;
2787
+ tick ( ) ;
2788
+ expect ( document . getElementsByClassName ( CLASS_OVERLAY_WRAPPER_MODAL ) [ 0 ] ) . toBeFalsy ( ) ;
2789
+
2790
+ document . dispatchEvent ( escEvent ) ;
2791
+ tick ( ) ;
2792
+ expect ( document . getElementsByClassName ( CLASS_OVERLAY_WRAPPER ) [ 0 ] ) . toBeFalsy ( ) ;
2793
+ } ) ) ;
2794
+
2793
2795
// Test #1883 #1820
2794
2796
it ( 'It should close the component when esc key is pressed and there were other keys pressed prior to esc.' , fakeAsync ( ( ) => {
2795
2797
const fixture = TestBed . createComponent ( EmptyPageComponent ) ;
@@ -2837,8 +2839,7 @@ describe('igxOverlay', () => {
2837
2839
const fixture = TestBed . createComponent ( EmptyPageComponent ) ;
2838
2840
const overlay = fixture . componentInstance . overlay ;
2839
2841
const overlaySettings : OverlaySettings = {
2840
- modal : false ,
2841
- closeOnEsc : false
2842
+ modal : false
2842
2843
} ;
2843
2844
2844
2845
overlay . show ( overlay . attach ( SimpleDynamicComponent ) , overlaySettings ) ;
@@ -2867,7 +2868,6 @@ describe('igxOverlay', () => {
2867
2868
const overlay = fixture . componentInstance . overlay ;
2868
2869
const overlaySettings : OverlaySettings = {
2869
2870
modal : false ,
2870
- closeOnEsc : false ,
2871
2871
positionStrategy : new GlobalPositionStrategy ( )
2872
2872
} ;
2873
2873
const targetEvent = 'keydown' ;
@@ -2986,7 +2986,6 @@ describe('igxOverlay', () => {
2986
2986
positionStrategy : new ConnectedPositioningStrategy ( ) ,
2987
2987
scrollStrategy : scrollStrat ,
2988
2988
modal : false ,
2989
- closeOnEsc : false ,
2990
2989
closeOnOutsideClick : false
2991
2990
} ;
2992
2991
const overlay = fixture . componentInstance . overlay ;
@@ -3405,7 +3404,6 @@ describe('igxOverlay', () => {
3405
3404
3406
3405
const overlaySettings : OverlaySettings = {
3407
3406
modal : false ,
3408
- closeOnEsc : false
3409
3407
} ;
3410
3408
const overlay = fixture . componentInstance . overlay ;
3411
3409
@@ -3448,7 +3446,6 @@ describe('igxOverlay', () => {
3448
3446
positionStrategy : new GlobalPositionStrategy ( ) ,
3449
3447
scrollStrategy : scrollStrategy ,
3450
3448
modal : false ,
3451
- closeOnEsc : false
3452
3449
} ;
3453
3450
3454
3451
overlay . show ( overlay . attach ( SimpleDynamicComponent ) , overlaySettings ) ;
@@ -3489,7 +3486,6 @@ describe('igxOverlay', () => {
3489
3486
scrollStrategy : scrollStrategy ,
3490
3487
closeOnOutsideClick : false ,
3491
3488
modal : false ,
3492
- closeOnEsc : false
3493
3489
} ;
3494
3490
3495
3491
overlay . show ( overlay . attach ( SimpleDynamicComponent ) , overlaySettings ) ;
@@ -3524,7 +3520,6 @@ describe('igxOverlay', () => {
3524
3520
positionStrategy : new GlobalPositionStrategy ( ) ,
3525
3521
scrollStrategy : scrollStrategy ,
3526
3522
modal : false ,
3527
- closeOnEsc : false
3528
3523
} ;
3529
3524
3530
3525
overlay . show ( overlay . attach ( SimpleDynamicComponent ) , overlaySettings ) ;
@@ -3562,7 +3557,6 @@ describe('igxOverlay', () => {
3562
3557
const overlay = fixture . componentInstance . overlay ;
3563
3558
const overlaySettings : OverlaySettings = {
3564
3559
modal : false ,
3565
- closeOnEsc : false ,
3566
3560
scrollStrategy : scrollStrategy ,
3567
3561
positionStrategy : new GlobalPositionStrategy ( )
3568
3562
} ;
@@ -3604,7 +3598,6 @@ describe('igxOverlay', () => {
3604
3598
const overlaySettings : OverlaySettings = {
3605
3599
closeOnOutsideClick : false ,
3606
3600
modal : false ,
3607
- closeOnEsc : false ,
3608
3601
positionStrategy : new ConnectedPositioningStrategy ( ) ,
3609
3602
scrollStrategy : scrollStrategy
3610
3603
} ;
@@ -3879,16 +3872,16 @@ export class TopLeftOffsetComponent {
3879
3872
</div>`
3880
3873
} )
3881
3874
export class TwoButtonsComponent {
3882
- private _setting : OverlaySettings = { modal : false , closeOnEsc : false } ;
3875
+ public settings : OverlaySettings = { modal : false } ;
3883
3876
3884
3877
constructor ( @Inject ( IgxOverlayService ) public overlay : IgxOverlayService ) { }
3885
3878
3886
3879
clickOne ( ) {
3887
- this . overlay . show ( this . overlay . attach ( SimpleDynamicComponent ) , this . _setting ) ;
3880
+ this . overlay . show ( this . overlay . attach ( SimpleDynamicComponent ) , this . settings ) ;
3888
3881
}
3889
3882
3890
3883
clickTwo ( ) {
3891
- this . overlay . show ( this . overlay . attach ( SimpleDynamicComponent ) , this . _setting ) ;
3884
+ this . overlay . show ( this . overlay . attach ( SimpleDynamicComponent ) , this . settings ) ;
3892
3885
}
3893
3886
3894
3887
divClick ( ev : Event ) {
0 commit comments