mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-08-07 17:48:54 +00:00
support for toggling custom context menu (#1683)
* support for toggling custom context menu * fix unit tests
This commit is contained in:
committed by
Mario Romano
parent
4ca18bc8f9
commit
2e44550d7f
@@ -10,6 +10,7 @@
|
||||
[actionsPosition]="contentActionsPosition"
|
||||
[multiselect]="multiselect"
|
||||
[fallbackThumbnail]="fallbackThumbnail"
|
||||
[contextMenu]="contextMenuActions"
|
||||
(showRowContextMenu)="onShowRowContextMenu($event)"
|
||||
(showRowActionsMenu)="onShowRowActionsMenu($event)"
|
||||
(executeRowAction)="onExecuteRowAction($event)"
|
||||
|
@@ -217,11 +217,19 @@ describe('DocumentList', () => {
|
||||
});
|
||||
|
||||
it('should suppress default context menu', () => {
|
||||
documentList.contextMenuActions = true;
|
||||
spyOn(eventMock, 'preventDefault').and.stub();
|
||||
documentList.onShowContextMenu(eventMock);
|
||||
expect(eventMock.preventDefault).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should not suppress default context menu', () => {
|
||||
documentList.contextMenuActions = false;
|
||||
spyOn(eventMock, 'preventDefault').and.stub();
|
||||
documentList.onShowContextMenu(eventMock);
|
||||
expect(eventMock.preventDefault).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should emit file preview event on single click', (done) => {
|
||||
let file = new FileNode();
|
||||
documentList.preview.subscribe(e => {
|
||||
|
@@ -272,7 +272,7 @@ export class DocumentListComponent implements OnInit, OnChanges, AfterContentIni
|
||||
|
||||
@HostListener('contextmenu', ['$event'])
|
||||
onShowContextMenu(e?: Event) {
|
||||
if (e) {
|
||||
if (e && this.contextMenuActions) {
|
||||
e.preventDefault();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user