mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-31 17:38:28 +00:00
[ACA-1574] DocumentList - single click navigation (#513)
* single click navigation * fix tests * allow action on row * use adf link class * update tests
This commit is contained in:
committed by
Denys Vuika
parent
36629adf99
commit
af4089ae74
@@ -49,7 +49,7 @@
|
||||
selectionMode="single"
|
||||
[navigate]="false"
|
||||
[sorting]="[ 'title', 'asc' ]"
|
||||
(node-dblclick)="onNodeDoubleClick($event)">
|
||||
(node-dblclick)="navigateTo($event.detail?.node)">
|
||||
|
||||
<empty-folder-content>
|
||||
<ng-template>
|
||||
@@ -70,13 +70,15 @@
|
||||
</data-column>
|
||||
|
||||
<data-column
|
||||
class="adf-data-table-cell--ellipsis__name"
|
||||
class="adf-data-table-cell--ellipsis__name adf-location-cell"
|
||||
key="title"
|
||||
title="APP.DOCUMENT_LIST.COLUMNS.TITLE">
|
||||
<ng-template let-context>
|
||||
<span class="adf-datatable-cell" title="{{ makeLibraryTooltip(context.row.obj.entry) }}">
|
||||
<a
|
||||
title="{{ makeLibraryTooltip(context.row.obj.entry) }}"
|
||||
(click)="navigateTo(context?.row?.obj)">
|
||||
{{ makeLibraryTitle(context.row.obj.entry) }}
|
||||
</span>
|
||||
</a>
|
||||
</ng-template>
|
||||
</data-column>
|
||||
|
||||
|
@@ -163,35 +163,23 @@ describe('LibrariesComponent', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('onNodeDoubleClick', () => {
|
||||
it('navigates to document', () => {
|
||||
describe('navigateTo', () => {
|
||||
it('navigates into library folder', () => {
|
||||
spyOn(component, 'navigate');
|
||||
|
||||
const event: any = {
|
||||
detail: {
|
||||
node: {
|
||||
entry: { guid: 'node-guid' }
|
||||
}
|
||||
}
|
||||
const site: any = {
|
||||
entry: { guid: 'node-guid' }
|
||||
};
|
||||
|
||||
component.onNodeDoubleClick(event);
|
||||
component.navigateTo(site);
|
||||
|
||||
expect(component.navigate).toHaveBeenCalledWith('node-guid');
|
||||
});
|
||||
|
||||
it(' does not navigate when document is not provided', () => {
|
||||
it(' does not navigate when library is not provided', () => {
|
||||
spyOn(component, 'navigate');
|
||||
|
||||
const event: any = {
|
||||
detail: {
|
||||
node: {
|
||||
entry: null
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
component.onNodeDoubleClick(event);
|
||||
component.navigateTo(null);
|
||||
|
||||
expect(component.navigate).not.toHaveBeenCalled();
|
||||
});
|
||||
|
@@ -84,11 +84,9 @@ export class LibrariesComponent extends PageComponent implements OnInit {
|
||||
return isDuplicate ? `${title} (${id})` : `${title}`;
|
||||
}
|
||||
|
||||
onNodeDoubleClick(e: CustomEvent) {
|
||||
const node: any = e.detail.node.entry;
|
||||
|
||||
if (node && node.guid) {
|
||||
this.navigate(node.guid);
|
||||
navigateTo(node: SiteEntry) {
|
||||
if (node && node.entry.guid) {
|
||||
this.navigate(node.entry.guid);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user