fix test and coverage Angular2 Final release uploader component #749

This commit is contained in:
Eugenio Romano
2016-10-06 16:18:03 +01:00
parent 94b89fa43d
commit 362e2e32ea
13 changed files with 351 additions and 399 deletions

View File

@@ -60,7 +60,7 @@ export class UploadDragAreaComponent {
constructor(private _uploaderService: UploadService, translate: AlfrescoTranslationService) {
this.translate = translate;
this.translate.addTranslationFolder('node_modules/ng2-alfresco-upload/dist/src');
translate.addTranslationFolder('node_modules/ng2-alfresco-upload/dist/src');
}
ngOnChanges(changes) {
@@ -240,9 +240,11 @@ export class UploadDragAreaComponent {
* @returns {string} - The message without placeholder
*/
private formatString(message: string, keys: any []) {
let i = keys.length;
while (i--) {
message = message.replace(new RegExp('\\{' + i + '\\}', 'gm'), keys[i]);
if (message) {
let i = keys.length;
while (i--) {
message = message.replace(new RegExp('\\{' + i + '\\}', 'gm'), keys[i]);
}
}
return message;
}