mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-05-12 17:04:46 +00:00
[ACS-8782] list of frozen files under a hold (#4406)
* [ACS-8782] Exported content management service and hide drag and drop hint when files can not be uploaded * [ACS-8782] Unit tests * [ACS-8782] Fixed unit test issues * [ACS-8782] Fixed unit test issues
This commit is contained in:
parent
8e8b6c051d
commit
c799049790
@ -42,6 +42,7 @@
|
||||
[filterValue]="queryParams"
|
||||
[isResizingEnabled]="true"
|
||||
[blurOnResize]="false"
|
||||
[displayDragAndDropHint]="canUpload"
|
||||
(node-dblclick)="handleNodeClick($event)"
|
||||
(name-click)="handleNodeClick($event)"
|
||||
(selectedItemsCountChanged)="onSelectedItemsCountChanged($event)"
|
||||
|
@ -29,13 +29,15 @@ import { DocumentListService, FilterSearch, UploadService } from '@alfresco/adf-
|
||||
import { NodeActionsService } from '../../services/node-actions.service';
|
||||
import { FilesComponent } from './files.component';
|
||||
import { AppTestingModule } from '../../testing/app-testing.module';
|
||||
import { AppExtensionService, ContentApiService } from '@alfresco/aca-shared';
|
||||
import { AppExtensionService, ContentApiService, DocumentBasePageService, initialState } from '@alfresco/aca-shared';
|
||||
import { of, Subject, throwError } from 'rxjs';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { NodeEntry, NodePaging, Node, PathElement } from '@alfresco/js-api';
|
||||
import { DocumentListPresetRef } from '@alfresco/adf-extensions';
|
||||
import { MatSnackBarModule } from '@angular/material/snack-bar';
|
||||
import { testHeader } from '../../testing/document-base-page-utils';
|
||||
import { MockStore, provideMockStore } from '@ngrx/store/testing';
|
||||
import { getCurrentFolder } from '@alfresco/aca-shared/store';
|
||||
|
||||
describe('FilesComponent', () => {
|
||||
let node;
|
||||
@ -44,6 +46,7 @@ describe('FilesComponent', () => {
|
||||
let uploadService: UploadService;
|
||||
let extensions: AppExtensionService;
|
||||
let nodeActionsService: NodeActionsService;
|
||||
let store: MockStore;
|
||||
let contentApi: ContentApiService;
|
||||
let route: ActivatedRoute;
|
||||
let router: any = {
|
||||
@ -82,7 +85,8 @@ describe('FilesComponent', () => {
|
||||
queryParamMap: of({})
|
||||
}
|
||||
},
|
||||
AppExtensionService
|
||||
AppExtensionService,
|
||||
provideMockStore({ initialState })
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
});
|
||||
@ -102,6 +106,7 @@ describe('FilesComponent', () => {
|
||||
nodeActionsService = TestBed.inject(NodeActionsService);
|
||||
contentApi = TestBed.inject(ContentApiService);
|
||||
extensions = TestBed.inject(AppExtensionService);
|
||||
store = TestBed.inject(MockStore);
|
||||
spyContent = spyOn(contentApi, 'getNode');
|
||||
});
|
||||
|
||||
@ -475,5 +480,46 @@ describe('FilesComponent', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('Document list', () => {
|
||||
let documentBasePageService: DocumentBasePageService;
|
||||
|
||||
beforeEach(() => {
|
||||
documentBasePageService = TestBed.inject(DocumentBasePageService);
|
||||
});
|
||||
|
||||
it('should have assigned displayDragAndDropHint to false if currentFolder is selected and uploading is not allowable', () => {
|
||||
store.overrideSelector(getCurrentFolder, node);
|
||||
spyOn(documentBasePageService, 'canUploadContent').and.returnValue(false);
|
||||
fixture.detectChanges();
|
||||
|
||||
expect(component.documentList.displayDragAndDropHint).toBeFalse();
|
||||
});
|
||||
|
||||
it('should have assigned displayDragAndDropHint to true if currentFolder is selected and uploading is allowable', () => {
|
||||
store.overrideSelector(getCurrentFolder, node);
|
||||
spyOn(documentBasePageService, 'canUploadContent').and.returnValue(true);
|
||||
fixture.detectChanges();
|
||||
|
||||
expect(component.documentList.displayDragAndDropHint).toBeTrue();
|
||||
expect(documentBasePageService.canUploadContent).toHaveBeenCalledWith(node);
|
||||
});
|
||||
|
||||
it('should have assigned displayDragAndDropHint to falsy if currentFolder is not selected and uploading is not allowable', () => {
|
||||
store.overrideSelector(getCurrentFolder, undefined);
|
||||
spyOn(documentBasePageService, 'canUploadContent').and.returnValue(false);
|
||||
fixture.detectChanges();
|
||||
|
||||
expect(component.documentList.displayDragAndDropHint).toBeFalsy();
|
||||
});
|
||||
|
||||
it('should have assigned displayDragAndDropHint to falsy if currentFolder is not selected and uploading is allowable', () => {
|
||||
store.overrideSelector(getCurrentFolder, undefined);
|
||||
spyOn(documentBasePageService, 'canUploadContent').and.returnValue(true);
|
||||
fixture.detectChanges();
|
||||
|
||||
expect(component.documentList.displayDragAndDropHint).toBeFalsy();
|
||||
});
|
||||
});
|
||||
|
||||
testHeader(FilesComponent);
|
||||
});
|
||||
|
@ -31,5 +31,6 @@ export * from './lib/aca-content.routes';
|
||||
export * from './lib/extensions/core.extensions.module';
|
||||
export * from './lib/store/initial-state';
|
||||
export * from './lib/services/content-url.service';
|
||||
export * from './lib/services/content-management.service';
|
||||
export * from './lib/components/info-drawer/comments-tab/external-node-permission-comments-tab.service';
|
||||
export * from './lib/utils/aca-search-utils';
|
||||
|
Loading…
x
Reference in New Issue
Block a user