[ADF-5007] Comments - textarea Escape event cannot be canceled (#5266)

* use keydown event

* cancel event propagation

* update tests
This commit is contained in:
Cilibiu Bogdan
2019-12-03 16:11:22 +02:00
committed by Eugenio Romano
parent f2cbd0cd9a
commit 79eb9365c8
3 changed files with 5 additions and 4 deletions

View File

@@ -277,7 +277,7 @@ describe('CommentsComponent', () => {
}));
it('should clear comment when escape key is pressed', async(() => {
const event = new KeyboardEvent('keyup', {'key': 'Escape'});
const event = new KeyboardEvent('keydown', {'key': 'Escape'});
let element = fixture.nativeElement.querySelector('#comment-input');
element.dispatchEvent(event);
fixture.detectChanges();
@@ -365,7 +365,7 @@ describe('CommentsComponent', () => {
}));
it('should clear comment when escape key is pressed', async(() => {
const event = new KeyboardEvent('keyup', {'key': 'Escape'});
const event = new KeyboardEvent('keydown', {'key': 'Escape'});
let element = fixture.nativeElement.querySelector('#comment-input');
element.dispatchEvent(event);
fixture.detectChanges();