mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
[ADF-4794] Not able to attach a second file to a form after one has already been attached (#5058)
This commit is contained in:
@@ -80,6 +80,20 @@ const fakeMinimalNode: Node = <Node> {
|
||||
}
|
||||
};
|
||||
|
||||
const fakePngUpload = {
|
||||
'id': 1166,
|
||||
'name': 'fake-png.png',
|
||||
'created': '2017-07-25T17:17:37.099Z',
|
||||
'createdBy': {'id': 1001, 'firstName': 'Admin', 'lastName': 'admin', 'email': 'admin'},
|
||||
'relatedContent': false,
|
||||
'contentAvailable': true,
|
||||
'link': false,
|
||||
'mimeType': 'image/png',
|
||||
'simpleType': 'image',
|
||||
'previewStatus': 'queued',
|
||||
'thumbnailStatus': 'queued'
|
||||
};
|
||||
|
||||
const fakePngAnswer = {
|
||||
'id': 1155,
|
||||
'name': 'a_png_file.png',
|
||||
@@ -194,6 +208,38 @@ describe('AttachFileWidgetComponent', () => {
|
||||
});
|
||||
}));
|
||||
|
||||
it('should be able to upload more than one file from content node selector', async(() => {
|
||||
const clickAttachFile = () => {
|
||||
const attachButton: HTMLButtonElement = element.querySelector('#attach-file-attach');
|
||||
expect(attachButton).not.toBeNull();
|
||||
attachButton.click();
|
||||
fixture.detectChanges();
|
||||
};
|
||||
spyOn(activitiContentService, 'getAlfrescoRepositories').and.returnValue(of(fakeRepositoryListAnswer));
|
||||
spyOn(activitiContentService, 'applyAlfrescoNode').and.returnValues(of(fakePngAnswer), of(fakePngUpload));
|
||||
spyOn(contentNodeDialogService, 'openFileBrowseDialogBySite').and.returnValue(of([fakeMinimalNode]));
|
||||
widget.field = new FormFieldModel(new FormModel(), {
|
||||
type: FormFieldTypes.UPLOAD,
|
||||
value: []
|
||||
});
|
||||
widget.field.id = 'attach-file-attach';
|
||||
widget.field.params = <FormFieldMetadata> allSourceParams;
|
||||
widget.field.params.multiple = true;
|
||||
fixture.detectChanges();
|
||||
fixture.whenStable().then(() => {
|
||||
clickAttachFile();
|
||||
fixture.debugElement.query(By.css('#attach-SHAREME')).nativeElement.click();
|
||||
fixture.detectChanges();
|
||||
clickAttachFile();
|
||||
fixture.debugElement.query(By.css('#attach-GOKUSHARE')).nativeElement.click();
|
||||
fixture.detectChanges();
|
||||
fixture.whenStable().then(() => {
|
||||
expect(element.querySelector('#file-1155')).not.toBeNull();
|
||||
expect(element.querySelector('#file-1166')).not.toBeNull();
|
||||
});
|
||||
});
|
||||
}));
|
||||
|
||||
it('should be able to upload files when a defined folder is selected', async(() => {
|
||||
widget.field = new FormFieldModel(new FormModel(), {
|
||||
type: FormFieldTypes.UPLOAD,
|
||||
|
Reference in New Issue
Block a user