Browse Source
Merge pull request #15995 from abpframework/bug/15990
abp-modal closing even keyboard:false solved
pull/15997/head
Mahmut Gundogdu
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
3 additions and
2 deletions
-
npm/ng-packs/packages/theme-shared/src/lib/components/modal/modal.component.ts
-
npm/ng-packs/packages/theme-shared/src/lib/tests/modal.component.spec.ts
|
|
@ -196,7 +196,7 @@ export class ModalComponent implements OnInit, OnDestroy, DismissableModal { |
|
|
.pipe( |
|
|
.pipe( |
|
|
takeUntil(this.destroy$), |
|
|
takeUntil(this.destroy$), |
|
|
debounceTime(150), |
|
|
debounceTime(150), |
|
|
filter((key: KeyboardEvent) => key && key.key === 'Escape'), |
|
|
filter((key: KeyboardEvent) => key && key.key === 'Escape' && this.options.keyboard), |
|
|
) |
|
|
) |
|
|
.subscribe(() => this.close()); |
|
|
.subscribe(() => this.close()); |
|
|
} |
|
|
} |
|
|
|
|
|
@ -158,8 +158,9 @@ describe('ModalComponent', () => { |
|
|
spectator.dispatchKeyboardEvent(spectator.component.modalWindowRef, 'keyup', 'Escape'); |
|
|
spectator.dispatchKeyboardEvent(spectator.component.modalWindowRef, 'keyup', 'Escape'); |
|
|
|
|
|
|
|
|
await wait300ms(); |
|
|
await wait300ms(); |
|
|
|
|
|
const { keyboard } = spectator.component.options; |
|
|
|
|
|
|
|
|
expect(spectator.component.visible).toBe(false); |
|
|
expect(spectator.component.visible).toBe(!keyboard); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
it('should not close when busy is true', async () => { |
|
|
it('should not close when busy is true', async () => { |
|
|
|