mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
AAE-12245: Migrated from event cancelBubble to stopPropagation (#8311)
This commit is contained in:
@@ -1306,10 +1306,12 @@ describe('retrieve metadata on submit', () => {
|
||||
expect(formContentClicked).toHaveBeenCalledWith(contentLinkModel);
|
||||
});
|
||||
|
||||
it('should cancel bubbling a keydown event', () => {
|
||||
const escapeKeyboardEvent = new KeyboardEvent('keydown', { keyCode: ESCAPE } as any);
|
||||
it('should stop propagation on keydown event', () => {
|
||||
const escapeKeyboardEvent = new KeyboardEvent('keydown', { key: ESCAPE.toString() });
|
||||
const stopPropagationSpy = spyOn(escapeKeyboardEvent, 'stopPropagation');
|
||||
|
||||
fixture.debugElement.triggerEventHandler('keydown', escapeKeyboardEvent);
|
||||
|
||||
expect(escapeKeyboardEvent.cancelBubble).toBe(true);
|
||||
expect(stopPropagationSpy).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
@@ -133,8 +133,8 @@ export class FormCloudComponent extends FormBaseComponent implements OnChanges,
|
||||
}
|
||||
|
||||
@HostListener('keydown', ['$event'])
|
||||
onKeyDown(event: KeyboardEvent) {
|
||||
event.cancelBubble = true;
|
||||
onKeyDown(event: KeyboardEvent): void {
|
||||
event.stopPropagation();
|
||||
}
|
||||
|
||||
ngOnChanges(changes: SimpleChanges) {
|
||||
|
@@ -929,11 +929,13 @@ describe('StartProcessCloudComponent', () => {
|
||||
component.ngOnChanges({ appName: change });
|
||||
});
|
||||
|
||||
it('should cancel bubbling a keydown event ()', () => {
|
||||
const escapeKeyboardEvent = new KeyboardEvent('keydown', { keyCode: ESCAPE } as any);
|
||||
it('should stop propagation on keydown event', () => {
|
||||
const escapeKeyboardEvent = new KeyboardEvent('keydown', { key: ESCAPE.toString() });
|
||||
const stopPropagationSpy = spyOn(escapeKeyboardEvent, 'stopPropagation');
|
||||
|
||||
fixture.debugElement.triggerEventHandler('keydown', escapeKeyboardEvent);
|
||||
|
||||
expect(escapeKeyboardEvent.cancelBubble).toBe(true);
|
||||
expect(stopPropagationSpy).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should hide title', () => {
|
||||
|
@@ -147,8 +147,8 @@ export class StartProcessCloudComponent implements OnChanges, OnInit, OnDestroy
|
||||
}
|
||||
|
||||
@HostListener('keydown', ['$event'])
|
||||
onKeyDown(event: KeyboardEvent) {
|
||||
event.cancelBubble = true;
|
||||
onKeyDown(event: KeyboardEvent): void {
|
||||
event.stopPropagation();
|
||||
}
|
||||
|
||||
hasForm(): boolean {
|
||||
|
Reference in New Issue
Block a user