mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-10-01 14:41:14 +00:00
reload active doclist via NgRx actions (#978)
* doclist reload action and effect * deprecate folderEdited event * deprecate "favoriteToggle" event * deprecate "favoriteRemoved" event * update docs * unified reload function * deprecate "nodesRestored" event * deprecate "nodesPurged" event * test fixes * deprecate "nodesMoved" event * reduce the use of "nodesDeleted"
This commit is contained in:
@@ -41,7 +41,6 @@ import {
|
||||
AppConfigPipe
|
||||
} from '@alfresco/adf-core';
|
||||
import { DocumentListComponent } from '@alfresco/adf-content-services';
|
||||
import { ContentManagementService } from '../../services/content-management.service';
|
||||
import { NodeActionsService } from '../../services/node-actions.service';
|
||||
import { FilesComponent } from './files.component';
|
||||
import { AppTestingModule } from '../../testing/app-testing.module';
|
||||
@@ -52,7 +51,6 @@ describe('FilesComponent', () => {
|
||||
let node;
|
||||
let fixture: ComponentFixture<FilesComponent>;
|
||||
let component: FilesComponent;
|
||||
let contentManagementService: ContentManagementService;
|
||||
let uploadService: UploadService;
|
||||
let router: Router;
|
||||
let nodeActionsService: NodeActionsService;
|
||||
@@ -86,7 +84,6 @@ describe('FilesComponent', () => {
|
||||
fixture = TestBed.createComponent(FilesComponent);
|
||||
component = fixture.componentInstance;
|
||||
|
||||
contentManagementService = TestBed.get(ContentManagementService);
|
||||
uploadService = TestBed.get(UploadService);
|
||||
router = TestBed.get(Router);
|
||||
nodeActionsService = TestBed.get(NodeActionsService);
|
||||
@@ -145,7 +142,7 @@ describe('FilesComponent', () => {
|
||||
describe('refresh on events', () => {
|
||||
beforeEach(() => {
|
||||
spyOn(contentApi, 'getNode').and.returnValue(of({ entry: node }));
|
||||
spyOn(component.documentList, 'reload');
|
||||
spyOn(component, 'reload');
|
||||
|
||||
fixture.detectChanges();
|
||||
});
|
||||
@@ -160,7 +157,7 @@ describe('FilesComponent', () => {
|
||||
|
||||
nodeActionsService.contentCopied.next(nodes);
|
||||
|
||||
expect(component.documentList.reload).toHaveBeenCalled();
|
||||
expect(component.reload).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should not call refresh onContentCopied event when parent mismatch', () => {
|
||||
@@ -173,37 +170,7 @@ describe('FilesComponent', () => {
|
||||
|
||||
nodeActionsService.contentCopied.next(nodes);
|
||||
|
||||
expect(component.documentList.reload).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should call refresh onCreateFolder event', () => {
|
||||
contentManagementService.folderCreated.next();
|
||||
|
||||
expect(component.documentList.reload).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should call refresh editFolder event', () => {
|
||||
contentManagementService.folderEdited.next();
|
||||
|
||||
expect(component.documentList.reload).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should call refresh deleteNode event', () => {
|
||||
contentManagementService.nodesDeleted.next();
|
||||
|
||||
expect(component.documentList.reload).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should call refresh moveNode event', () => {
|
||||
contentManagementService.nodesMoved.next();
|
||||
|
||||
expect(component.documentList.reload).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should call refresh restoreNode event', () => {
|
||||
contentManagementService.nodesRestored.next();
|
||||
|
||||
expect(component.documentList.reload).toHaveBeenCalled();
|
||||
expect(component.reload).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should call refresh on fileUploadComplete event if parent node match', fakeAsync(() => {
|
||||
@@ -214,7 +181,7 @@ describe('FilesComponent', () => {
|
||||
|
||||
tick(500);
|
||||
|
||||
expect(component.documentList.reload).toHaveBeenCalled();
|
||||
expect(component.reload).toHaveBeenCalled();
|
||||
}));
|
||||
|
||||
it('should not call refresh on fileUploadComplete event if parent mismatch', fakeAsync(() => {
|
||||
@@ -225,7 +192,7 @@ describe('FilesComponent', () => {
|
||||
|
||||
tick(500);
|
||||
|
||||
expect(component.documentList.reload).not.toHaveBeenCalled();
|
||||
expect(component.reload).not.toHaveBeenCalled();
|
||||
}));
|
||||
|
||||
it('should call refresh on fileUploadDeleted event if parent node match', fakeAsync(() => {
|
||||
@@ -236,7 +203,7 @@ describe('FilesComponent', () => {
|
||||
|
||||
tick(500);
|
||||
|
||||
expect(component.documentList.reload).toHaveBeenCalled();
|
||||
expect(component.reload).toHaveBeenCalled();
|
||||
}));
|
||||
|
||||
it('should not call refresh on fileUploadDeleted event if parent mismatch', fakeAsync(() => {
|
||||
@@ -247,7 +214,7 @@ describe('FilesComponent', () => {
|
||||
|
||||
tick(500);
|
||||
|
||||
expect(component.documentList.reload).not.toHaveBeenCalled();
|
||||
expect(component.reload).not.toHaveBeenCalled();
|
||||
}));
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user