[ADF-2726] fixed save content for external repository (#3341)

* [ADF-2726] start fixing the show of files loaded from CS

* [ADF-2726] start fixing the show of files loaded from CS

* [ADF-2726] fixed save content for external repository|

* [ADF-2726] fixed save content for external repository|

* [ADF-2726] reeanabled and fixed the tests

* [ADF-2726] reeanabled and fixed the tests

* [ADF-2726] added tests for attach file widget and activiti alfresco service

* [ADF-2726] added tests for attach file widget and activiti alfresco service

* [ADF-2726] fixed test
This commit is contained in:
Vito
2018-05-21 12:14:11 +01:00
committed by Eugenio Romano
parent b599e3a41a
commit 1c7f267c63
9 changed files with 344 additions and 29 deletions

View File

@@ -29,7 +29,7 @@ import {
ContentService,
setupTestBed
} from '@alfresco/adf-core';
import { ContentNodeDialogService } from '@alfresco/adf-content-services';
import { ContentNodeDialogService, ContentNodeSelectorModule } from '@alfresco/adf-content-services';
import { Observable } from 'rxjs/Observable';
import { MinimalNodeEntryEntity } from 'alfresco-js-api';
import { ProcessTestingModule } from '../testing/process.testing.module';
@@ -72,7 +72,10 @@ const definedSourceParams = {
const fakeMinimalNode: MinimalNodeEntryEntity = <MinimalNodeEntryEntity> {
id: 'fake',
name: 'fake-name'
name: 'fake-name',
content: {
mimeType: 'application/pdf'
}
};
const fakePngAnswer = {
@@ -89,9 +92,7 @@ const fakePngAnswer = {
'thumbnailStatus': 'queued'
};
/* tslint:disable */
// TODO: crashes because of LogService problem
xdescribe('AttachFileWidgetComponent', () => {
describe('AttachFileWidgetComponent', () => {
let widget: AttachFileWidgetComponent;
let fixture: ComponentFixture<AttachFileWidgetComponent>;
@@ -103,7 +104,7 @@ xdescribe('AttachFileWidgetComponent', () => {
let formService: FormService;
setupTestBed({
imports: [ProcessTestingModule]
imports: [ProcessTestingModule, ContentNodeSelectorModule]
});
beforeEach(async(() => {
@@ -165,15 +166,15 @@ xdescribe('AttachFileWidgetComponent', () => {
}));
it('should be able to upload files coming from content node selector', async(() => {
spyOn(activitiContentService, 'getAlfrescoRepositories').and.returnValue(Observable.of(fakeRepositoryListAnswer));
spyOn(activitiContentService, 'applyAlfrescoNode').and.returnValue(Observable.of(fakePngAnswer));
spyOn(contentNodeDialogService, 'openFileBrowseDialogBySite').and.returnValue(Observable.of([fakeMinimalNode]));
widget.field = new FormFieldModel(new FormModel(), {
type: FormFieldTypes.UPLOAD,
value: []
});
widget.field.id = 'attach-file-attach';
widget.field.params = <FormFieldMetadata> allSourceParams;
spyOn(activitiContentService, 'getAlfrescoRepositories').and.returnValue(Observable.of(fakeRepositoryListAnswer));
spyOn(activitiContentService, 'applyAlfrescoNode').and.returnValue(Observable.of(fakePngAnswer));
spyOn(contentNodeDialogService, 'openFileBrowseDialogBySite').and.returnValue(Observable.of([fakeMinimalNode]));
fixture.detectChanges();
fixture.whenStable().then(() => {
let attachButton: HTMLButtonElement = element.querySelector('#attach-file-attach');
@@ -182,8 +183,9 @@ xdescribe('AttachFileWidgetComponent', () => {
fixture.detectChanges();
fixture.debugElement.query(By.css('#attach-SHAREME')).nativeElement.click();
fixture.detectChanges();
expect(element.querySelector('#file-1155-icon')).not.toBeNull();
fixture.whenStable().then(() => {
expect(element.querySelector('#file-1155-icon')).not.toBeNull();
});
});
}));