[ACS-5308] cleanup content common module and move to standalone components (#3234)

* language picker

* location link

* logout component

* logout: fix tests

* toggle shared component

* user info component

* cleanup common module

* migrate generic error to standalone

* thumbnail column component

* name column component

* tags column component

* locked by component

* cleanup module dependencies

* comments tab component

* info drawer and details

* cleanup infodrawer module

* remove useless test

* reduce useless imports

* info drawer module

* context menu component
This commit is contained in:
Denys Vuika
2023-05-29 10:28:26 +01:00
committed by GitHub
parent 40c4740b3a
commit 251b6a0ec7
52 changed files with 291 additions and 384 deletions

View File

@@ -25,24 +25,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { AppTestingModule } from '../../testing/app-testing.module';
import { DetailsComponent } from './details.component';
import { MetadataTabComponent } from '../info-drawer/metadata-tab/metadata-tab.component';
import { CommentsTabComponent } from '../info-drawer/comments-tab/comments-tab.component';
import { ActivatedRoute } from '@angular/router';
import { of, Subject } from 'rxjs';
import { NO_ERRORS_SCHEMA } from '@angular/core';
import { Store } from '@ngrx/store';
import { ContentManagementService } from '../../services/content-management.service';
import { AppExtensionService } from '@alfresco/adf-extensions';
import { ContentApiService } from '@alfresco/aca-shared';
import { SetSelectedNodesAction } from '@alfresco/aca-shared/store';
import { STORE_INITIAL_APP_DATA, SetSelectedNodesAction } from '@alfresco/aca-shared/store';
import { NodeEntry } from '@alfresco/js-api';
import { RouterTestingModule } from '@angular/router/testing';
import { AuthenticationService, PageTitleService } from '@alfresco/adf-core';
import { SearchQueryBuilderService } from '@alfresco/adf-content-services';
describe('DetailsComponent', () => {
let component: DetailsComponent;
let fixture: ComponentFixture<DetailsComponent>;
let contentApiService: ContentApiService;
let store: Store;
let node: NodeEntry;
const mockStream = new Subject();
const storeMock = {
@@ -52,12 +51,10 @@ describe('DetailsComponent', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [AppTestingModule],
declarations: [DetailsComponent, CommentsTabComponent, MetadataTabComponent],
imports: [AppTestingModule, DetailsComponent],
providers: [
ContentManagementService,
AppExtensionService,
RouterTestingModule,
SearchQueryBuilderService,
{ provide: Store, useValue: storeMock },
{
provide: ActivatedRoute,
@@ -65,6 +62,22 @@ describe('DetailsComponent', () => {
snapshot: { data: { preferencePrefix: 'prefix' } },
params: of({ nodeId: 'someId', activeTab: 'permissions' })
}
},
{
provide: PageTitleService,
useValue: {}
},
{
provide: STORE_INITIAL_APP_DATA,
useValue: {}
},
{
provide: AuthenticationService,
useValue: {
onLogin: new Subject<any>(),
onLogout: new Subject<any>(),
isLoggedIn: () => true
}
}
],
schemas: [NO_ERRORS_SCHEMA]
@@ -74,7 +87,22 @@ describe('DetailsComponent', () => {
component = fixture.componentInstance;
contentApiService = TestBed.inject(ContentApiService);
store = TestBed.inject(Store);
spyOn(contentApiService, 'getNode').and.returnValue(of({ entry: { id: 'libraryId' } } as NodeEntry));
node = {
entry: {
id: 'libraryId',
name: 'my library',
isFile: false,
isFolder: false,
modifiedAt: new Date(),
createdAt: new Date(),
nodeType: '',
createdByUser: { id: '', displayName: '' },
modifiedByUser: { id: '', displayName: '' },
aspectNames: []
}
};
spyOn(contentApiService, 'getNode').and.returnValue(of(node));
});
afterEach(() => {
@@ -98,6 +126,6 @@ describe('DetailsComponent', () => {
it('should dispatch node selection', () => {
fixture.detectChanges();
expect(store.dispatch).toHaveBeenCalledWith(new SetSelectedNodesAction([{ entry: { id: 'libraryId' } } as NodeEntry]));
expect(store.dispatch).toHaveBeenCalledWith(new SetSelectedNodesAction([node]));
});
});