[ACA-2835] Favorites list - incorrect viewer actions when opened via link (#1279)

* stop event propagation

* tests
This commit is contained in:
Cilibiu Bogdan
2019-12-16 16:26:56 +02:00
committed by GitHub
parent d3dd752920
commit db2a6a7ef7
3 changed files with 23 additions and 1 deletions

View File

@@ -17,7 +17,7 @@
" "
class="adf-datatable-cell-value" class="adf-datatable-cell-value"
title="{{ node | adfNodeNameTooltip }}" title="{{ node | adfNodeNameTooltip }}"
(click)="onClick()" (click)="onLinkClick($event)"
> >
{{ displayText$ | async }} {{ displayText$ | async }}
</span> </span>

View File

@@ -105,4 +105,21 @@ describe('CustomNameColumnComponent', () => {
fixture.debugElement.nativeElement.querySelector('aca-locked-by') fixture.debugElement.nativeElement.querySelector('aca-locked-by')
).not.toBe(null); ).not.toBe(null);
}); });
it('should call parent component onClick method', () => {
const event = new MouseEvent('click');
spyOn(component, 'onClick');
component.onLinkClick(event);
expect(component.onClick).toHaveBeenCalled();
});
it('should prevent event propagation', () => {
const event = new MouseEvent('click');
spyOn(event, 'stopPropagation');
component.onLinkClick(event);
expect(event.stopPropagation).toHaveBeenCalled();
});
}); });

View File

@@ -94,6 +94,11 @@ export class CustomNameColumnComponent extends NameColumnComponent
}); });
} }
onLinkClick(event: Event) {
event.stopPropagation();
this.onClick();
}
ngOnDestroy() { ngOnDestroy() {
super.ngOnDestroy(); super.ngOnDestroy();