diff --git a/ng2-components/ng2-activiti-form/src/components/widgets/upload/upload.widget.html b/ng2-components/ng2-activiti-form/src/components/widgets/upload/upload.widget.html
index c95723bd76..6bde04e6c0 100644
--- a/ng2-components/ng2-activiti-form/src/components/widgets/upload/upload.widget.html
+++ b/ng2-components/ng2-activiti-form/src/components/widgets/upload/upload.widget.html
@@ -7,6 +7,7 @@
{
type: FormFieldTypes.UPLOAD,
readOnly: false
});
-
- fixture.detectChanges();
- inputElement = element.querySelector('#upload-id');
});
it('should be disabled on readonly forms', async(() => {
uploadWidget.field.form.readOnly = true;
+ fixture.detectChanges();
+ inputElement = element.querySelector('#upload-id');
fixture.whenStable().then(() => {
fixture.detectChanges();
@@ -136,6 +135,32 @@ describe('UploadWidget', () => {
});
}));
+ it('should have the multiple attribute when is selected in parameters', async(() => {
+ uploadWidget.field.params.multiple = true;
+ fixture.detectChanges();
+ inputElement = element.querySelector('#upload-id');
+
+ fixture.whenStable().then(() => {
+ fixture.detectChanges();
+ expect(inputElement).toBeDefined();
+ expect(inputElement).not.toBeNull();
+ expect(inputElement.getAttributeNode('multiple')).toBeTruthy();
+ });
+ }));
+
+ it('should not have the multiple attribute if multiple is false', async(() => {
+ uploadWidget.field.params.multiple = false;
+ fixture.detectChanges();
+ inputElement = element.querySelector('#upload-id');
+
+ fixture.whenStable().then(() => {
+ fixture.detectChanges();
+ expect(inputElement).toBeDefined();
+ expect(inputElement).not.toBeNull();
+ expect(inputElement.getAttributeNode('multiple')).toBeFalsy();
+ });
+ }));
+
});
});
diff --git a/ng2-components/ng2-activiti-form/src/components/widgets/upload/upload.widget.ts b/ng2-components/ng2-activiti-form/src/components/widgets/upload/upload.widget.ts
index ea1a120f84..c23fde666d 100644
--- a/ng2-components/ng2-activiti-form/src/components/widgets/upload/upload.widget.ts
+++ b/ng2-components/ng2-activiti-form/src/components/widgets/upload/upload.widget.ts
@@ -18,7 +18,7 @@
import { Component, OnInit } from '@angular/core';
import { LogService } from 'ng2-alfresco-core';
import { FormService } from '../../../services/form.service';
-import { baseHost , WidgetComponent } from './../widget.component';
+import { baseHost, WidgetComponent } from './../widget.component';
@Component({
selector: 'upload-widget',
@@ -31,10 +31,11 @@ export class UploadWidget extends WidgetComponent implements OnInit {
hasFile: boolean;
fileName: string;
displayText: string;
+ multipleOption: string = '';
constructor(public formService: FormService,
private logService: LogService) {
- super(formService);
+ super(formService);
}
ngOnInit() {
@@ -46,6 +47,7 @@ export class UploadWidget extends WidgetComponent implements OnInit {
this.fileName = file.name;
this.displayText = decodeURI(file.name);
}
+ this.getMultipleFileParam();
}
reset() {
@@ -74,4 +76,12 @@ export class UploadWidget extends WidgetComponent implements OnInit {
}
}
+ private getMultipleFileParam() {
+ if (this.field &&
+ this.field.params &&
+ this.field.params.multiple) {
+ this.multipleOption = this.field.params.multiple ? 'multiple' : '';
+ }
+ }
+
}