mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-31 17:38:28 +00:00
[ACA-2193] Lock node - unlock after new version is uploaded (#924)
* unlock node api call * unlock action and effect * unlock node after version upload * check if locked * clear version input on dialog cancel event * update viewer on node version upload * update viewer on file upload delete * test * update tests * update tests * rename evaluators * update docs
This commit is contained in:
committed by
Denys Vuika
parent
65e0a1138c
commit
894a928187
@@ -25,11 +25,19 @@
|
||||
|
||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
import { Router, ActivatedRoute } from '@angular/router';
|
||||
import { TestBed, ComponentFixture } from '@angular/core/testing';
|
||||
import {
|
||||
TestBed,
|
||||
ComponentFixture,
|
||||
async,
|
||||
fakeAsync,
|
||||
tick
|
||||
} from '@angular/core/testing';
|
||||
import {
|
||||
UserPreferencesService,
|
||||
AppConfigPipe,
|
||||
NodeFavoriteDirective
|
||||
NodeFavoriteDirective,
|
||||
UploadService,
|
||||
AlfrescoApiService
|
||||
} from '@alfresco/adf-core';
|
||||
import { PreviewComponent } from './preview.component';
|
||||
import { of, throwError } from 'rxjs';
|
||||
@@ -38,6 +46,7 @@ import { ExperimentalDirective } from '../../directives/experimental.directive';
|
||||
import { NodeEffects } from '../../store/effects/node.effects';
|
||||
import { AppTestingModule } from '../../testing/app-testing.module';
|
||||
import { ContentApiService } from '../../services/content-api.service';
|
||||
import { ContentManagementService } from '../../services/content-management.service';
|
||||
|
||||
describe('PreviewComponent', () => {
|
||||
let fixture: ComponentFixture<PreviewComponent>;
|
||||
@@ -46,10 +55,14 @@ describe('PreviewComponent', () => {
|
||||
let route: ActivatedRoute;
|
||||
let preferences: UserPreferencesService;
|
||||
let contentApi: ContentApiService;
|
||||
let uploadService: UploadService;
|
||||
let alfrescoApiService: AlfrescoApiService;
|
||||
let contentManagementService: ContentManagementService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [AppTestingModule, EffectsModule.forRoot([NodeEffects])],
|
||||
providers: [AlfrescoApiService, ContentManagementService],
|
||||
declarations: [
|
||||
AppConfigPipe,
|
||||
PreviewComponent,
|
||||
@@ -66,6 +79,9 @@ describe('PreviewComponent', () => {
|
||||
route = TestBed.get(ActivatedRoute);
|
||||
preferences = TestBed.get(UserPreferencesService);
|
||||
contentApi = TestBed.get(ContentApiService);
|
||||
uploadService = TestBed.get(UploadService);
|
||||
alfrescoApiService = TestBed.get(AlfrescoApiService);
|
||||
contentManagementService = TestBed.get(ContentManagementService);
|
||||
});
|
||||
|
||||
it('should extract the property path root', () => {
|
||||
@@ -697,4 +713,29 @@ describe('PreviewComponent', () => {
|
||||
const ids = await component.getFileIds('recent-files');
|
||||
expect(ids).toEqual(['node2', 'node1']);
|
||||
});
|
||||
|
||||
it('should return to parent folder on nodesDeleted event', async(() => {
|
||||
spyOn(component, 'navigateToFileLocation');
|
||||
fixture.detectChanges();
|
||||
contentManagementService.nodesDeleted.next();
|
||||
|
||||
expect(component.navigateToFileLocation).toHaveBeenCalled();
|
||||
}));
|
||||
|
||||
it('should return to parent folder on fileUploadDeleted event', async(() => {
|
||||
spyOn(component, 'navigateToFileLocation');
|
||||
fixture.detectChanges();
|
||||
uploadService.fileUploadDeleted.next();
|
||||
|
||||
expect(component.navigateToFileLocation).toHaveBeenCalled();
|
||||
}));
|
||||
|
||||
it('should emit nodeUpdated event on fileUploadComplete event', fakeAsync(() => {
|
||||
spyOn(alfrescoApiService.nodeUpdated, 'next');
|
||||
fixture.detectChanges();
|
||||
uploadService.fileUploadComplete.next(<any>{ data: { entry: {} } });
|
||||
tick(300);
|
||||
|
||||
expect(alfrescoApiService.nodeUpdated.next).toHaveBeenCalled();
|
||||
}));
|
||||
});
|
||||
|
Reference in New Issue
Block a user