mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-09-17 14:21:14 +00:00
committed by
DominikIwanek
parent
a666ae45e7
commit
7cb18bc19a
@@ -57,14 +57,7 @@ describe('DetailsComponent', () => {
|
||||
select: () => mockStream
|
||||
};
|
||||
|
||||
const extensionsServiceMock = {
|
||||
getAllowedSidebarActions: jasmine.createSpy('getAllowedSidebarActions')
|
||||
};
|
||||
|
||||
const mockAspectActions: ContentActionRef[] = [];
|
||||
|
||||
const mockAspectActionsSubject$ = new BehaviorSubject(mockAspectActions);
|
||||
extensionsServiceMock.getAllowedSidebarActions.and.returnValue(mockAspectActionsSubject$.asObservable());
|
||||
const mockAspectActionsSubject$ = new BehaviorSubject<Array<ContentActionRef>>([]);
|
||||
|
||||
const getBreadcrumb = (): BreadcrumbComponent => fixture.debugElement.query(By.directive(BreadcrumbComponent)).componentInstance;
|
||||
|
||||
@@ -99,6 +92,9 @@ describe('DetailsComponent', () => {
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
});
|
||||
|
||||
const appExtensionService = TestBed.inject(AppExtensionService);
|
||||
spyOn(appExtensionService, 'getAllowedSidebarActions').and.returnValue(mockAspectActionsSubject$.asObservable());
|
||||
|
||||
fixture = TestBed.createComponent(DetailsComponent);
|
||||
component = fixture.componentInstance;
|
||||
contentApiService = TestBed.inject(ContentApiService);
|
||||
@@ -130,6 +126,34 @@ describe('DetailsComponent', () => {
|
||||
fixture.destroy();
|
||||
});
|
||||
|
||||
it('should set aspectActions from extension mock', () => {
|
||||
const extensionMock = [
|
||||
{
|
||||
id: 'app.sidebar.close',
|
||||
order: 100,
|
||||
title: 'close',
|
||||
icon: 'highlight_off'
|
||||
} as ContentActionRef
|
||||
];
|
||||
|
||||
mockAspectActionsSubject$.next(extensionMock);
|
||||
|
||||
fixture.detectChanges();
|
||||
expect(component.aspectActions).toEqual([
|
||||
{
|
||||
id: 'app.sidebar.close',
|
||||
order: 100,
|
||||
title: 'close',
|
||||
icon: 'highlight_off'
|
||||
} as ContentActionRef
|
||||
]);
|
||||
});
|
||||
|
||||
describe('', () => {
|
||||
beforeEach(() => {
|
||||
mockAspectActionsSubject$.next([]);
|
||||
});
|
||||
|
||||
it('should get node id from router', () => {
|
||||
fixture.detectChanges();
|
||||
expect(component.nodeId).toBe('someId');
|
||||
@@ -175,10 +199,9 @@ describe('DetailsComponent', () => {
|
||||
});
|
||||
|
||||
it('should set aspectActions from extensions', async () => {
|
||||
extensionsServiceMock.getAllowedSidebarActions.and.returnValue(of(mockAspectActions));
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable().then(() => {
|
||||
expect(component.aspectActions).toEqual(mockAspectActions);
|
||||
expect(component.aspectActions).toEqual([]);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -191,38 +214,6 @@ describe('DetailsComponent', () => {
|
||||
expect(component.nodeIcon).toContain(expectedIcon);
|
||||
});
|
||||
|
||||
it('should set aspectActions from extension mock', () => {
|
||||
const extensionMock = {
|
||||
getAllowedSidebarActions: () =>
|
||||
of([
|
||||
{
|
||||
id: 'app.sidebar.close',
|
||||
order: 100,
|
||||
title: 'close',
|
||||
icon: 'highlight_off'
|
||||
}
|
||||
])
|
||||
};
|
||||
|
||||
extensionsServiceMock.getAllowedSidebarActions.and.returnValue(of(extensionMock));
|
||||
fixture.detectChanges();
|
||||
fixture
|
||||
.whenStable()
|
||||
.then(() => {
|
||||
expect(component.aspectActions).toEqual([
|
||||
{
|
||||
id: 'app.sidebar.close',
|
||||
order: 100,
|
||||
title: 'close',
|
||||
icon: 'highlight_off'
|
||||
} as ContentActionRef
|
||||
]);
|
||||
})
|
||||
.catch((error) => {
|
||||
fail(`An error occurred: ${error}`);
|
||||
});
|
||||
});
|
||||
|
||||
it('should disable the permissions tab for smart folders based on aspects', () => {
|
||||
node.entry.isFolder = true;
|
||||
node.entry.aspectNames = ['smf:customConfigSmartFolder'];
|
||||
@@ -263,6 +254,7 @@ describe('DetailsComponent', () => {
|
||||
component.setActiveTab('permissions');
|
||||
expect(component.activeTab).not.toBe(2);
|
||||
});
|
||||
});
|
||||
|
||||
it('should navigate back when nodesDeleted event is triggered', () => {
|
||||
const locationSpy = spyOn(location, 'back');
|
||||
|
Reference in New Issue
Block a user