[ACS-6106] Breadcrumb navigation fix on Details tab (#3482)

This commit is contained in:
Mykyta Maliarchuk
2023-10-19 09:26:41 +02:00
committed by GitHub
parent 99c27a88f7
commit 1c222bdd36
3 changed files with 23 additions and 6 deletions

View File

@@ -30,11 +30,12 @@ import { of, Subject } from 'rxjs';
import { NO_ERRORS_SCHEMA } from '@angular/core';
import { Store } from '@ngrx/store';
import { ContentApiService } from '@alfresco/aca-shared';
import { STORE_INITIAL_APP_DATA, SetSelectedNodesAction } from '@alfresco/aca-shared/store';
import { NodeEntry } from '@alfresco/js-api';
import { STORE_INITIAL_APP_DATA, SetSelectedNodesAction, NavigateToFolder } from '@alfresco/aca-shared/store';
import { NodeEntry, PathElement } from '@alfresco/js-api';
import { RouterTestingModule } from '@angular/router/testing';
import { AuthenticationService, PageTitleService } from '@alfresco/adf-core';
import { SearchQueryBuilderService } from '@alfresco/adf-content-services';
import { BreadcrumbComponent, SearchQueryBuilderService } from '@alfresco/adf-content-services';
import { By } from '@angular/platform-browser';
describe('DetailsComponent', () => {
let component: DetailsComponent;
@@ -45,7 +46,7 @@ describe('DetailsComponent', () => {
const mockStream = new Subject();
const storeMock = {
dispatch: jasmine.createSpy('dispatch'),
dispatch: jasmine.createSpy('dispatch').and.stub(),
select: () => mockStream
};
@@ -124,6 +125,17 @@ describe('DetailsComponent', () => {
expect(contentApiService.getNode).toHaveBeenCalled();
});
it('should dispatch navigation to a given folder', () => {
const breadcrumbComponent: BreadcrumbComponent = fixture.debugElement.query(By.directive(BreadcrumbComponent)).componentInstance;
const pathElement: PathElement = {
id: 'fake-id'
};
breadcrumbComponent.navigate.emit(pathElement);
fixture.detectChanges();
expect(store.dispatch).toHaveBeenCalledWith(new NavigateToFolder({ entry: pathElement } as NodeEntry));
});
it('should dispatch node selection', () => {
fixture.detectChanges();
expect(store.dispatch).toHaveBeenCalledWith(new SetSelectedNodesAction([node]));