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
parent
commit
6f82b6bd21
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      npm/ng-packs/packages/theme-shared/src/lib/components/modal/modal.component.ts
  2. 3
      npm/ng-packs/packages/theme-shared/src/lib/tests/modal.component.spec.ts

2
npm/ng-packs/packages/theme-shared/src/lib/components/modal/modal.component.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());
} }

3
npm/ng-packs/packages/theme-shared/src/lib/tests/modal.component.spec.ts

@ -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 () => {

Loading…
Cancel
Save