enable prefer-const rule for tslint, fix issues (#4409)

* enable prefer-const rule for tslint, fix issues

* Update content-node-selector.component.spec.ts

* Update content-node-selector.component.spec.ts

* fix const

* fix lint issues

* update tests

* update tests

* update tests

* fix code

* fix page class
This commit is contained in:
Denys Vuika
2019-03-25 12:19:33 +00:00
committed by Eugenio Romano
parent 26c5982a1a
commit a7a48e8b2b
581 changed files with 5435 additions and 5402 deletions

View File

@@ -65,7 +65,7 @@ describe('AppsListComponent', () => {
component.loading = true;
fixture.detectChanges();
fixture.whenStable().then(() => {
let loadingSpinner = fixture.nativeElement.querySelector('mat-spinner');
const loadingSpinner = fixture.nativeElement.querySelector('mat-spinner');
expect(loadingSpinner).toBeDefined();
});
}));
@@ -124,7 +124,7 @@ describe('AppsListComponent', () => {
});
it('should emit an error when an error occurs loading apps', () => {
let emitSpy = spyOn(component.error, 'emit');
const emitSpy = spyOn(component.error, 'emit');
getAppsSpy.and.returnValue(throwError({}));
fixture.detectChanges();
expect(emitSpy).toHaveBeenCalled();
@@ -212,7 +212,7 @@ describe('AppsListComponent', () => {
});
it('should initially have no app selected', () => {
let selectedEls = debugElement.queryAll(By.css('.selectedIcon'));
const selectedEls = debugElement.queryAll(By.css('.selectedIcon'));
expect(selectedEls.length).toBe(0);
});
@@ -225,14 +225,14 @@ describe('AppsListComponent', () => {
it('should have one app shown as selected after app selected', () => {
component.selectApp(deployedApps[1]);
fixture.detectChanges();
let selectedEls = debugElement.queryAll(By.css('.adf-app-listgrid-item-card-actions-icon'));
const selectedEls = debugElement.queryAll(By.css('.adf-app-listgrid-item-card-actions-icon'));
expect(selectedEls.length).toBe(1);
});
it('should have the correct app shown as selected after app selected', () => {
component.selectApp(deployedApps[1]);
fixture.detectChanges();
let appEls = debugElement.queryAll(By.css('.adf-app-listgrid > div'));
const appEls = debugElement.queryAll(By.css('.adf-app-listgrid > div'));
expect(appEls[1].query(By.css('.adf-app-listgrid-item-card-actions-icon'))).not.toBeNull();
});
@@ -272,7 +272,7 @@ describe('Custom CustomEmptyAppListTemplateComponent', () => {
it('should render the custom no-apps template', async(() => {
fixture.detectChanges();
fixture.whenStable().then(() => {
let title: any = fixture.debugElement.queryAll(By.css('#custom-id'));
const title: any = fixture.debugElement.queryAll(By.css('#custom-id'));
expect(title.length).toBe(1);
expect(title[0].nativeElement.innerText).toBe('No Apps');
});

View File

@@ -147,7 +147,7 @@ export class AppsListComponent implements OnInit, AfterContentInit {
}
private filterApps(apps: AppDefinitionRepresentationModel []): AppDefinitionRepresentationModel[] {
let filteredApps: AppDefinitionRepresentationModel[] = [];
const filteredApps: AppDefinitionRepresentationModel[] = [];
if (this.filtersAppId) {
apps.filter((app: AppDefinitionRepresentationModel) => {
this.filtersAppId.forEach((filter) => {

View File

@@ -52,7 +52,7 @@ export class DialogSelectAppTestComponent {
describe('Select app dialog', () => {
let fixture: ComponentFixture<DialogSelectAppTestComponent>;
let component: DialogSelectAppTestComponent;
let dialogRef = {
const dialogRef = {
close: jasmine.createSpy('close')
};
let overlayContainerElement: HTMLElement;

View File

@@ -29,11 +29,11 @@ describe('CreateProcessAttachmentComponent', () => {
let fixture: ComponentFixture<CreateProcessAttachmentComponent>;
let element: HTMLElement;
let file = new File([new Blob()], 'Test');
let fileObj = { entry: null, file: file, relativeFolder: '/' };
let customEvent = { detail: { files: [fileObj] } };
const file = new File([new Blob()], 'Test');
const fileObj = { entry: null, file: file, relativeFolder: '/' };
const customEvent = { detail: { files: [fileObj] } };
let fakeUploadResponse = {
const fakeUploadResponse = {
id: 9999,
name: 'BANANA.jpeg',
created: '2017-06-12T12:52:11.109Z',
@@ -73,7 +73,7 @@ describe('CreateProcessAttachmentComponent', () => {
it('should update the processInstanceId when it is changed', () => {
component.processInstanceId = null;
let change = new SimpleChange(null, '123', true);
const change = new SimpleChange(null, '123', true);
component.ngOnChanges({ 'processInstanceId': change });
expect(component.processInstanceId).toBe('123');
@@ -96,7 +96,7 @@ describe('CreateProcessAttachmentComponent', () => {
}));
it('should allow user to upload files via button', async(() => {
let buttonUpload: HTMLElement = <HTMLElement> element.querySelector('#add_new_process_content_button');
const buttonUpload: HTMLElement = <HTMLElement> element.querySelector('#add_new_process_content_button');
expect(buttonUpload).toBeDefined();
expect(buttonUpload).not.toBeNull();
@@ -106,7 +106,7 @@ describe('CreateProcessAttachmentComponent', () => {
expect(res.id).toBe(9999);
});
let dropEvent = new CustomEvent('upload-files', customEvent);
const dropEvent = new CustomEvent('upload-files', customEvent);
buttonUpload.dispatchEvent(dropEvent);
fixture.detectChanges();

View File

@@ -51,11 +51,11 @@ export class CreateProcessAttachmentComponent implements OnChanges {
}
onFileUpload(event: any) {
let filesList: File[] = event.detail.files.map((obj) => obj.file);
const filesList: File[] = event.detail.files.map((obj) => obj.file);
for (let fileInfoObj of filesList) {
let file: File = fileInfoObj;
let opts = {
for (const fileInfoObj of filesList) {
const file: File = fileInfoObj;
const opts = {
isRelatedContent: true
};
this.activitiContentService.createProcessRelatedContent(this.processInstanceId, file, opts).subscribe(

View File

@@ -47,15 +47,15 @@ describe('AttachmentComponent', () => {
});
it('should not call createTaskRelatedContent service when taskId changed', () => {
let change = new SimpleChange(null, '123', true);
const change = new SimpleChange(null, '123', true);
component.ngOnChanges({'taskId': change});
expect(createTaskRelatedContentSpy).not.toHaveBeenCalled();
});
it('should not call createTaskRelatedContent service when there is no file uploaded', () => {
let change = new SimpleChange(null, '123', true);
const change = new SimpleChange(null, '123', true);
component.ngOnChanges({'taskId': change});
let customEvent: any = {
const customEvent: any = {
detail: {
files: []
}
@@ -65,10 +65,10 @@ describe('AttachmentComponent', () => {
});
it('should call createTaskRelatedContent service when there is a file uploaded', () => {
let change = new SimpleChange(null, '123', true);
const change = new SimpleChange(null, '123', true);
component.ngOnChanges({'taskId': change});
let file = new File([new Blob()], 'Test');
let customEvent = {
const file = new File([new Blob()], 'Test');
const customEvent = {
detail: {
files: [
file

View File

@@ -51,11 +51,11 @@ export class AttachmentComponent implements OnChanges {
}
onFileUpload(event: any) {
let filesList: File[] = event.detail.files.map((obj) => obj.file);
const filesList: File[] = event.detail.files.map((obj) => obj.file);
for (let fileInfoObj of filesList) {
let file: File = fileInfoObj;
let opts = {
for (const fileInfoObj of filesList) {
const file: File = fileInfoObj;
const opts = {
isRelatedContent: true
};
this.activitiContentService.createTaskRelatedContent(this.taskId, file, opts).subscribe(

View File

@@ -90,7 +90,7 @@ describe('ProcessAttachmentListComponent', () => {
getProcessRelatedContentSpy = spyOn(service, 'getProcessRelatedContent').and.returnValue(of(mockAttachment));
spyOn(service, 'deleteRelatedContent').and.returnValue(of({successCode: true}));
let blobObj = new Blob();
const blobObj = new Blob();
spyOn(service, 'getFileRawContent').and.returnValue(of(blobObj));
});
@@ -104,21 +104,21 @@ describe('ProcessAttachmentListComponent', () => {
});
it('should load attachments when processInstanceId specified', () => {
let change = new SimpleChange(null, '123', true);
const change = new SimpleChange(null, '123', true);
component.ngOnChanges({ 'processInstanceId': change });
expect(getProcessRelatedContentSpy).toHaveBeenCalled();
});
it('should emit an error when an error occurs loading attachments', () => {
let emitSpy = spyOn(component.error, 'emit');
const emitSpy = spyOn(component.error, 'emit');
getProcessRelatedContentSpy.and.returnValue(throwError({}));
let change = new SimpleChange(null, '123', true);
const change = new SimpleChange(null, '123', true);
component.ngOnChanges({ 'processInstanceId': change });
expect(emitSpy).toHaveBeenCalled();
});
it('should emit a success event when the attachments are loaded', () => {
let change = new SimpleChange(null, '123', true);
const change = new SimpleChange(null, '123', true);
component.success.subscribe((attachments) => {
expect(attachments[0].name).toEqual(mockAttachment.data[0].name);
expect(attachments[0].id).toEqual(mockAttachment.data[0].id);
@@ -133,7 +133,7 @@ describe('ProcessAttachmentListComponent', () => {
});
it('should display attachments when the process has attachments', async(() => {
let change = new SimpleChange(null, '123', true);
const change = new SimpleChange(null, '123', true);
component.ngOnChanges({ 'processInstanceId': change });
fixture.detectChanges();
@@ -143,15 +143,15 @@ describe('ProcessAttachmentListComponent', () => {
}));
it('should display all actions if attachments are not read only', async(() => {
let change = new SimpleChange(null, '123', true);
const change = new SimpleChange(null, '123', true);
component.ngOnChanges({ 'processInstanceId': change });
fixture.detectChanges();
let actionButton = fixture.debugElement.nativeElement.querySelector('[data-automation-id="action_menu_0"]');
const actionButton = fixture.debugElement.nativeElement.querySelector('[data-automation-id="action_menu_0"]');
actionButton.click();
fixture.whenStable().then(() => {
fixture.detectChanges();
let actionMenu = window.document.querySelectorAll('button.mat-menu-item').length;
const actionMenu = window.document.querySelectorAll('button.mat-menu-item').length;
expect(window.document.querySelector('[data-automation-id="ADF_PROCESS_LIST.MENU_ACTIONS.VIEW_CONTENT"]')).not.toBeNull();
expect(window.document.querySelector('[data-automation-id="ADF_PROCESS_LIST.MENU_ACTIONS.REMOVE_CONTENT"]')).not.toBeNull();
expect(window.document.querySelector('[data-automation-id="ADF_PROCESS_LIST.MENU_ACTIONS.DOWNLOAD_CONTENT"]')).not.toBeNull();
@@ -160,16 +160,16 @@ describe('ProcessAttachmentListComponent', () => {
}));
it('should not display remove action if attachments are read only', async(() => {
let change = new SimpleChange(null, '123', true);
const change = new SimpleChange(null, '123', true);
component.ngOnChanges({ 'processInstanceId': change });
component.disabled = true;
fixture.detectChanges();
let actionButton = fixture.debugElement.nativeElement.querySelector('[data-automation-id="action_menu_0"]');
const actionButton = fixture.debugElement.nativeElement.querySelector('[data-automation-id="action_menu_0"]');
actionButton.click();
fixture.whenStable().then(() => {
fixture.detectChanges();
let actionMenu = window.document.querySelectorAll('button.mat-menu-item').length;
const actionMenu = window.document.querySelectorAll('button.mat-menu-item').length;
expect(window.document.querySelector('[data-automation-id="ADF_PROCESS_LIST.MENU_ACTIONS.VIEW_CONTENT"]')).not.toBeNull();
expect(window.document.querySelector('[data-automation-id="ADF_PROCESS_LIST.MENU_ACTIONS.DOWNLOAD_CONTENT"]')).not.toBeNull();
expect(window.document.querySelector('[data-automation-id="ADF_PROCESS_LIST.MENU_ACTIONS.REMOVE_CONTENT"]')).toBeNull();
@@ -184,7 +184,7 @@ describe('ProcessAttachmentListComponent', () => {
'start': 0,
'data': []
}));
let change = new SimpleChange(null, '123', true);
const change = new SimpleChange(null, '123', true);
component.ngOnChanges({'processInstanceId': change});
fixture.whenStable().then(() => {
fixture.detectChanges();
@@ -199,7 +199,7 @@ describe('ProcessAttachmentListComponent', () => {
'start': 0,
'data': []
}));
let change = new SimpleChange(null, '123', true);
const change = new SimpleChange(null, '123', true);
component.ngOnChanges({'processInstanceId': change});
component.disabled = true;
@@ -217,7 +217,7 @@ describe('ProcessAttachmentListComponent', () => {
'start': 0,
'data': []
}));
let change = new SimpleChange(null, '123', true);
const change = new SimpleChange(null, '123', true);
component.ngOnChanges({'processInstanceId': change});
component.disabled = true;
@@ -230,7 +230,7 @@ describe('ProcessAttachmentListComponent', () => {
it('should not show the empty list component when the attachments list is not empty for completed process', async(() => {
getProcessRelatedContentSpy.and.returnValue(of(mockAttachment));
let change = new SimpleChange(null, '123', true);
const change = new SimpleChange(null, '123', true);
component.ngOnChanges({'processInstanceId': change});
component.disabled = true;
@@ -251,8 +251,8 @@ describe('ProcessAttachmentListComponent', () => {
describe('change detection', () => {
let change = new SimpleChange('123', '456', true);
let nullChange = new SimpleChange('123', null, true);
const change = new SimpleChange('123', '456', true);
const nullChange = new SimpleChange('123', null, true);
beforeEach(async(() => {
component.processInstanceId = '123';
@@ -325,7 +325,7 @@ describe('Custom CustomEmptyTemplateComponent', () => {
it('should render the custom template', async(() => {
fixture.whenStable().then(() => {
fixture.detectChanges();
let title: any = fixture.debugElement.queryAll(By.css('[adf-empty-list-header]'));
const title: any = fixture.debugElement.queryAll(By.css('[adf-empty-list-header]'));
expect(title.length).toBe(1);
expect(title[0].nativeElement.innerText).toBe('Custom header');
});

View File

@@ -152,17 +152,17 @@ export class ProcessAttachmentListComponent implements OnChanges, AfterContentIn
}
onShowRowActionsMenu(event: any) {
let viewAction = {
const viewAction = {
title: 'ADF_PROCESS_LIST.MENU_ACTIONS.VIEW_CONTENT',
name: 'view'
};
let removeAction = {
const removeAction = {
title: 'ADF_PROCESS_LIST.MENU_ACTIONS.REMOVE_CONTENT',
name: 'remove'
};
let downloadAction = {
const downloadAction = {
title: 'ADF_PROCESS_LIST.MENU_ACTIONS.DOWNLOAD_CONTENT',
name: 'download'
};
@@ -178,8 +178,8 @@ export class ProcessAttachmentListComponent implements OnChanges, AfterContentIn
}
onExecuteRowAction(event: any) {
let args = event.value;
let action = args.action;
const args = event.value;
const action = args.action;
if (action.name === 'view') {
this.emitDocumentContent(args.row.obj);
} else if (action.name === 'remove') {
@@ -190,7 +190,7 @@ export class ProcessAttachmentListComponent implements OnChanges, AfterContentIn
}
openContent(event: any): void {
let content = event.value.obj;
const content = event.value.obj;
this.emitDocumentContent(content);
}

View File

@@ -86,7 +86,7 @@ describe('TaskAttachmentList', () => {
deleteContentSpy = spyOn(service, 'deleteRelatedContent').and.returnValue(of({ successCode: true }));
let blobObj = new Blob();
const blobObj = new Blob();
getFileRawContentSpy = spyOn(service, 'getFileRawContent').and.returnValue(of(blobObj));
});
@@ -102,21 +102,21 @@ describe('TaskAttachmentList', () => {
});
it('should load attachments when taskId specified', () => {
let change = new SimpleChange(null, '123', true);
const change = new SimpleChange(null, '123', true);
component.ngOnChanges({ 'taskId': change });
expect(getTaskRelatedContentSpy).toHaveBeenCalled();
});
it('should emit an error when an error occurs loading attachments', () => {
let emitSpy = spyOn(component.error, 'emit');
const emitSpy = spyOn(component.error, 'emit');
getTaskRelatedContentSpy.and.returnValue(throwError({}));
let change = new SimpleChange(null, '123', true);
const change = new SimpleChange(null, '123', true);
component.ngOnChanges({ 'taskId': change });
expect(emitSpy).toHaveBeenCalled();
});
it('should emit a success event when the attachments are loaded', () => {
let change = new SimpleChange(null, '123', true);
const change = new SimpleChange(null, '123', true);
disposableSuccess = component.success.subscribe((attachments) => {
expect(attachments[0].name).toEqual(mockAttachment.data[0].name);
expect(attachments[0].id).toEqual(mockAttachment.data[0].id);
@@ -131,7 +131,7 @@ describe('TaskAttachmentList', () => {
});
it('should display attachments when the task has attachments', (done) => {
let change = new SimpleChange(null, '123', true);
const change = new SimpleChange(null, '123', true);
component.ngOnChanges({ 'taskId': change });
fixture.detectChanges();
@@ -160,7 +160,7 @@ describe('TaskAttachmentList', () => {
'start': 0,
'data': []
}));
let change = new SimpleChange(null, '123', true);
const change = new SimpleChange(null, '123', true);
component.ngOnChanges({ 'taskId': change });
component.hasCustomTemplate = false;
@@ -172,15 +172,15 @@ describe('TaskAttachmentList', () => {
}));
it('should display all actions if attachments are not read only', async(() => {
let change = new SimpleChange(null, '123', true);
const change = new SimpleChange(null, '123', true);
component.ngOnChanges({ 'taskId': change });
fixture.detectChanges();
let actionButton = fixture.debugElement.nativeElement.querySelector('[data-automation-id="action_menu_0"]');
const actionButton = fixture.debugElement.nativeElement.querySelector('[data-automation-id="action_menu_0"]');
actionButton.click();
fixture.whenStable().then(() => {
fixture.detectChanges();
let actionMenu = window.document.querySelectorAll('button.mat-menu-item').length;
const actionMenu = window.document.querySelectorAll('button.mat-menu-item').length;
expect(window.document.querySelector('[data-automation-id="ADF_TASK_LIST.MENU_ACTIONS.VIEW_CONTENT"]')).not.toBeNull();
expect(window.document.querySelector('[data-automation-id="ADF_TASK_LIST.MENU_ACTIONS.REMOVE_CONTENT"]')).not.toBeNull();
expect(window.document.querySelector('[data-automation-id="ADF_TASK_LIST.MENU_ACTIONS.DOWNLOAD_CONTENT"]')).not.toBeNull();
@@ -189,16 +189,16 @@ describe('TaskAttachmentList', () => {
}));
it('should not display remove action if attachments are read only', async(() => {
let change = new SimpleChange(null, '123', true);
const change = new SimpleChange(null, '123', true);
component.ngOnChanges({ 'taskId': change });
component.disabled = true;
fixture.detectChanges();
let actionButton = fixture.debugElement.nativeElement.querySelector('[data-automation-id="action_menu_0"]');
const actionButton = fixture.debugElement.nativeElement.querySelector('[data-automation-id="action_menu_0"]');
actionButton.click();
fixture.whenStable().then(() => {
fixture.detectChanges();
let actionMenu = window.document.querySelectorAll('button.mat-menu-item').length;
const actionMenu = window.document.querySelectorAll('button.mat-menu-item').length;
expect(window.document.querySelector('[data-automation-id="ADF_TASK_LIST.MENU_ACTIONS.VIEW_CONTENT"]')).not.toBeNull();
expect(window.document.querySelector('[data-automation-id="ADF_TASK_LIST.MENU_ACTIONS.DOWNLOAD_CONTENT"]')).not.toBeNull();
expect(window.document.querySelector('[data-automation-id="ADF_TASK_LIST.MENU_ACTIONS.REMOVE_CONTENT"]')).toBeNull();
@@ -213,7 +213,7 @@ describe('TaskAttachmentList', () => {
'start': 0,
'data': []
}));
let change = new SimpleChange(null, '123', true);
const change = new SimpleChange(null, '123', true);
component.ngOnChanges({ 'taskId': change });
fixture.detectChanges();
fixture.whenStable().then(() => {
@@ -229,7 +229,7 @@ describe('TaskAttachmentList', () => {
'start': 0,
'data': []
}));
let change = new SimpleChange(null, '123', true);
const change = new SimpleChange(null, '123', true);
component.ngOnChanges({ 'taskId': change });
component.disabled = true;
@@ -241,7 +241,7 @@ describe('TaskAttachmentList', () => {
it('should not show the empty list component when the attachments list is not empty for completed task', (done) => {
getTaskRelatedContentSpy.and.returnValue(of(mockAttachment));
let change = new SimpleChange(null, '123', true);
const change = new SimpleChange(null, '123', true);
component.ngOnChanges({ 'taskId': change });
component.disabled = true;
@@ -346,7 +346,7 @@ describe('Custom CustomEmptyTemplateComponent', () => {
it('should render the custom template', async(() => {
fixture.whenStable().then(() => {
fixture.detectChanges();
let title: any = fixture.debugElement.queryAll(By.css('[adf-empty-list-header]'));
const title: any = fixture.debugElement.queryAll(By.css('[adf-empty-list-header]'));
expect(title.length).toBe(1);
expect(title[0].nativeElement.innerText).toBe('Custom header');
});

View File

@@ -122,7 +122,7 @@ export class TaskAttachmentListComponent implements OnChanges, AfterContentInit
const opts = 'true';
this.activitiContentService.getTaskRelatedContent(taskId, opts).subscribe(
(res: any) => {
let attachList = [];
const attachList = [];
res.data.forEach((content) => {
attachList.push({
id: content.id,
@@ -162,17 +162,17 @@ export class TaskAttachmentListComponent implements OnChanges, AfterContentInit
}
onShowRowActionsMenu(event: any) {
let viewAction = {
const viewAction = {
title: 'ADF_TASK_LIST.MENU_ACTIONS.VIEW_CONTENT',
name: 'view'
};
let removeAction = {
const removeAction = {
title: 'ADF_TASK_LIST.MENU_ACTIONS.REMOVE_CONTENT',
name: 'remove'
};
let downloadAction = {
const downloadAction = {
title: 'ADF_TASK_LIST.MENU_ACTIONS.DOWNLOAD_CONTENT',
name: 'download'
};
@@ -188,8 +188,8 @@ export class TaskAttachmentListComponent implements OnChanges, AfterContentInit
}
onExecuteRowAction(event: any) {
let args = event.value;
let action = args.action;
const args = event.value;
const action = args.action;
if (action.name === 'view') {
this.emitDocumentContent(args.row.obj);
} else if (action.name === 'remove') {
@@ -200,7 +200,7 @@ export class TaskAttachmentListComponent implements OnChanges, AfterContentInit
}
openContent(event: any): void {
let content = event.value.obj;
const content = event.value.obj;
this.emitDocumentContent(content);
}

View File

@@ -32,7 +32,7 @@ describe('AttachFileWidgetDialogComponent', () => {
let widget: AttachFileWidgetDialogComponent;
let fixture: ComponentFixture<AttachFileWidgetDialogComponent>;
let data: AttachFileWidgetDialogComponentData = {
const data: AttachFileWidgetDialogComponentData = {
title: 'Move along citizen...',
actionName: 'move',
selected: new EventEmitter<any>(),
@@ -94,8 +94,8 @@ describe('AttachFileWidgetDialogComponent', () => {
spyOn(authService, 'login').and.returnValue(of({ type: 'type', ticket: 'ticket'}));
isLogged = true;
let loginButton: HTMLButtonElement = element.querySelector('button[data-automation-id="attach-file-dialog-actions-login"]');
let usernameInput: HTMLInputElement = element.querySelector('#username');
let passwordInput: HTMLInputElement = element.querySelector('#password');
const usernameInput: HTMLInputElement = element.querySelector('#username');
const passwordInput: HTMLInputElement = element.querySelector('#password');
usernameInput.value = 'fakse-user';
passwordInput.value = 'fakse-user';
usernameInput.dispatchEvent(new Event('input'));
@@ -105,7 +105,7 @@ describe('AttachFileWidgetDialogComponent', () => {
fixture.whenStable().then(() => {
expect(element.querySelector('#attach-file-content-node')).not.toBeNull();
loginButton = element.querySelector('button[data-automation-id="attach-file-dialog-actions-login"]');
let chooseButton = element.querySelector('button[data-automation-id="attach-file-dialog-actions-choose"]');
const chooseButton = element.querySelector('button[data-automation-id="attach-file-dialog-actions-choose"]');
expect(loginButton).toBeNull();
expect(chooseButton).not.toBeNull();
done();
@@ -137,11 +137,11 @@ describe('AttachFileWidgetDialogComponent', () => {
expect(nodeList[0].isFile).toBeTruthy();
done();
});
let fakeNode: Node = new Node({ id: 'fake', isFile: true});
const fakeNode: Node = new Node({ id: 'fake', isFile: true});
contentNodePanel.componentInstance.select.emit([fakeNode]);
fixture.detectChanges();
fixture.whenStable().then(() => {
let chooseButton: HTMLButtonElement = element.querySelector('button[data-automation-id="attach-file-dialog-actions-choose"]');
const chooseButton: HTMLButtonElement = element.querySelector('button[data-automation-id="attach-file-dialog-actions-choose"]');
chooseButton.click();
});
});

View File

@@ -27,7 +27,6 @@ describe('AttachFileWidgetDialogService', () => {
let service: AttachFileWidgetDialogService;
let materialDialog: MatDialog;
let spyOnDialogOpen: jasmine.Spy;
let afterOpenObservable: Subject<any>;
setupTestBed({
imports: [
@@ -40,7 +39,7 @@ describe('AttachFileWidgetDialogService', () => {
service = TestBed.get(AttachFileWidgetDialogService);
materialDialog = TestBed.get(MatDialog);
spyOnDialogOpen = spyOn(materialDialog, 'open').and.returnValue({
afterOpen: () => afterOpenObservable,
afterOpen: () => of({}),
afterClosed: () => of({}),
componentInstance: {
error: new Subject<any>()

View File

@@ -41,7 +41,7 @@ export class AttachFileWidgetDialogService {
* @returns Information about the chosen file(s)
*/
openLogin(ecmHost: string, actionName?: string, context?: string): Observable<Node[]> {
let titleString: string = `Please log in for ${ecmHost}`;
const titleString: string = `Please log in for ${ecmHost}`;
const selected = new Subject<Node[]>();
selected.subscribe({
complete: this.close.bind(this)

View File

@@ -130,7 +130,7 @@ export class AttachFileWidgetComponent extends UploadWidgetComponent implements
}
openSelectDialogFromFileSource() {
let params = this.field.params;
const params = this.field.params;
if (this.isDefinedSourceFolder()) {
this.contentDialog.openFileBrowseDialogByFolderId(params.fileSource.selectedFolder.pathId).subscribe(
(selections: Node[]) => {
@@ -183,10 +183,10 @@ export class AttachFileWidgetComponent extends UploadWidgetComponent implements
openSelectDialog(repository) {
const accountIdentifier = 'alfresco-' + repository.id + '-' + repository.name;
let currentECMHost = this.getDomainHost(this.appConfigService.get(AppConfigValues.ECMHOST));
let chosenRepositoryHost = this.getDomainHost(repository.repositoryUrl);
const currentECMHost = this.getDomainHost(this.appConfigService.get(AppConfigValues.ECMHOST));
const chosenRepositoryHost = this.getDomainHost(repository.repositoryUrl);
if (chosenRepositoryHost !== currentECMHost) {
let formattedRepositoryHost = repository.repositoryUrl.replace('/alfresco', '');
const formattedRepositoryHost = repository.repositoryUrl.replace('/alfresco', '');
this.attachDialogService.openLogin(formattedRepositoryHost).subscribe(
(selections: any[]) => {
selections.forEach((node) => node.isExternal = true);
@@ -229,7 +229,7 @@ export class AttachFileWidgetComponent extends UploadWidgetComponent implements
}
private getDomainHost(urlToCheck) {
let result = urlToCheck.match('^(?:https?:\/\/)?(?:[^@\/\n]+@)?(?:www\.)?([^:\/?\n]+)');
const result = urlToCheck.match('^(?:https?:\/\/)?(?:[^@\/\n]+@)?(?:www\.)?([^:\/?\n]+)');
return result[1];
}

View File

@@ -155,7 +155,7 @@ describe('AttachFileWidgetComponent', () => {
spyOn(activitiContentService, 'getAlfrescoRepositories').and.returnValue(of(fakeRepositoryListAnswer));
fixture.detectChanges();
fixture.whenRenderingDone().then(() => {
let attachButton: HTMLButtonElement = element.querySelector('#attach-file-attach');
const attachButton: HTMLButtonElement = element.querySelector('#attach-file-attach');
expect(attachButton).not.toBeNull();
attachButton.click();
fixture.detectChanges();
@@ -182,7 +182,7 @@ describe('AttachFileWidgetComponent', () => {
widget.field.params = <FormFieldMetadata> allSourceParams;
fixture.detectChanges();
fixture.whenStable().then(() => {
let attachButton: HTMLButtonElement = element.querySelector('#attach-file-attach');
const attachButton: HTMLButtonElement = element.querySelector('#attach-file-attach');
expect(attachButton).not.toBeNull();
attachButton.click();
fixture.detectChanges();
@@ -206,7 +206,7 @@ describe('AttachFileWidgetComponent', () => {
spyOn(contentNodeDialogService, 'openFileBrowseDialogByFolderId').and.returnValue(of([fakeMinimalNode]));
fixture.detectChanges();
fixture.whenStable().then(() => {
let attachButton: HTMLButtonElement = element.querySelector('#attach-file-attach');
const attachButton: HTMLButtonElement = element.querySelector('#attach-file-attach');
expect(attachButton).not.toBeNull();
attachButton.click();
fixture.detectChanges();
@@ -228,7 +228,7 @@ describe('AttachFileWidgetComponent', () => {
spyOn(processContentService, 'createTemporaryRawRelatedContent').and.returnValue(of(fakePngAnswer));
fixture.detectChanges();
fixture.whenStable().then(() => {
let inputDebugElement = fixture.debugElement.query(By.css('#attach-file-attach'));
const inputDebugElement = fixture.debugElement.query(By.css('#attach-file-attach'));
inputDebugElement.triggerEventHandler('change', { target: { files: [fakePngAnswer] } });
fixture.detectChanges();
@@ -263,7 +263,7 @@ describe('AttachFileWidgetComponent', () => {
spyOn(processContentService, 'createTemporaryRawRelatedContent').and.returnValue(of(fakePngAnswer));
fixture.detectChanges();
fixture.whenStable().then(() => {
let inputDebugElement = fixture.debugElement.query(By.css('#attach-file-attach'));
const inputDebugElement = fixture.debugElement.query(By.css('#attach-file-attach'));
inputDebugElement.triggerEventHandler('change', {target: {files: [fakePngAnswer]}});
fixture.detectChanges();
expect(element.querySelector('#file-1155-icon')).not.toBeNull();
@@ -271,7 +271,7 @@ describe('AttachFileWidgetComponent', () => {
}));
it('should show the action menu', async(() => {
let menuButton: HTMLButtonElement = <HTMLButtonElement> element.querySelector('#file-1155-option-menu');
const menuButton: HTMLButtonElement = <HTMLButtonElement> element.querySelector('#file-1155-option-menu');
expect(menuButton).not.toBeNull();
menuButton.click();
fixture.detectChanges();
@@ -283,7 +283,7 @@ describe('AttachFileWidgetComponent', () => {
}));
it('should remove file when remove is clicked', async(() => {
let menuButton: HTMLButtonElement = <HTMLButtonElement> element.querySelector('#file-1155-option-menu');
const menuButton: HTMLButtonElement = <HTMLButtonElement> element.querySelector('#file-1155-option-menu');
expect(menuButton).not.toBeNull();
menuButton.click();
fixture.detectChanges();
@@ -297,7 +297,7 @@ describe('AttachFileWidgetComponent', () => {
it('should download file when download is clicked', async(() => {
spyOn(contentService, 'downloadBlob').and.stub();
let menuButton: HTMLButtonElement = <HTMLButtonElement> element.querySelector('#file-1155-option-menu');
const menuButton: HTMLButtonElement = <HTMLButtonElement> element.querySelector('#file-1155-option-menu');
expect(menuButton).not.toBeNull();
menuButton.click();
fixture.detectChanges();
@@ -314,7 +314,7 @@ describe('AttachFileWidgetComponent', () => {
expect(file).not.toBeNull();
expect(file.id).toBe(1155);
});
let menuButton: HTMLButtonElement = <HTMLButtonElement> element.querySelector('#file-1155-option-menu');
const menuButton: HTMLButtonElement = <HTMLButtonElement> element.querySelector('#file-1155-option-menu');
expect(menuButton).not.toBeNull();
menuButton.click();
fixture.detectChanges();

View File

@@ -71,7 +71,7 @@ export class AttachFolderWidgetComponent extends WidgetComponent implements OnIn
}
openSelectDialogFromFileSource() {
let params = this.field.params;
const params = this.field.params;
if (this.isDefinedSourceFolder()) {
this.contentDialog.openFolderBrowseDialogByFolderId(params.folderSource.selectedFolder.pathId).subscribe(
(selections: Node[]) => {

View File

@@ -32,7 +32,7 @@ export class ProcessList {
export class SingleProcessList extends ProcessList {
constructor(name?: string) {
let instance = new ProcessInstance({
const instance = new ProcessInstance({
id: '123',
name: name
});

View File

@@ -45,8 +45,8 @@ describe('PeopleListComponent', () => {
}));
it('should emit row click event', (done) => {
let row = new ObjectDataRow(fakeUser);
let rowEvent = new DataRowEvent(row, null);
const row = new ObjectDataRow(fakeUser);
const rowEvent = new DataRowEvent(row, null);
peopleListComponent.clickRow.subscribe((selectedUser) => {
expect(selectedUser.id).toEqual(1);
@@ -60,12 +60,12 @@ describe('PeopleListComponent', () => {
});
it('should emit row action event', (done) => {
let row = new ObjectDataRow(fakeUser);
let removeObj = {
const row = new ObjectDataRow(fakeUser);
const removeObj = {
name: 'remove',
title: 'Remove'
};
let rowActionEvent = new DataRowActionEvent(row, removeObj);
const rowActionEvent = new DataRowActionEvent(row, removeObj);
peopleListComponent.clickAction.subscribe((selectedAction: UserEventModel) => {
expect(selectedAction.type).toEqual('remove');

View File

@@ -69,7 +69,7 @@ export class PeopleListComponent implements AfterViewInit, AfterContentInit {
onShowRowActionsMenu(event: any) {
let removeAction = {
const removeAction = {
title: 'Remove',
name: 'remove'
};
@@ -80,8 +80,8 @@ export class PeopleListComponent implements AfterViewInit, AfterContentInit {
}
onExecuteRowAction(event: any) {
let args = event.value;
let action = args.action;
const args = event.value;
const action = args.action;
this.clickAction.emit(new UserEventModel({type: action.name, value: args.row.obj}));
}
}

View File

@@ -40,7 +40,7 @@ describe('PeopleSearchFieldComponent', () => {
});
it('should have the proper placeholder by default', () => {
let searchField = debug.query(By.css('[data-automation-id="adf-people-search-input"]')).nativeElement;
const searchField = debug.query(By.css('[data-automation-id="adf-people-search-input"]')).nativeElement;
expect(searchField.placeholder).toBe('ADF_TASK_LIST.PEOPLE.SEARCH_USER');
});
@@ -49,7 +49,7 @@ describe('PeopleSearchFieldComponent', () => {
fixture.detectChanges();
let searchField = debug.query(By.css('[data-automation-id="adf-people-search-input"]')).nativeElement;
const searchField = debug.query(By.css('[data-automation-id="adf-people-search-input"]')).nativeElement;
expect(searchField.placeholder).toBe('Arcadia Bay');
});

View File

@@ -40,7 +40,7 @@ describe('PeopleSearchComponent', () => {
let peopleSearchComponent: PeopleSearchComponent;
let fixture: ComponentFixture<PeopleSearchComponent>;
let element: HTMLElement;
let userArray = [fakeUser, fakeSecondUser];
const userArray = [fakeUser, fakeSecondUser];
let searchInput: any;
setupTestBed({
@@ -80,7 +80,7 @@ describe('PeopleSearchComponent', () => {
fixture.whenStable().then(() => {
fixture.detectChanges();
let gatewayElement: any = element.querySelector('#search-people-list .adf-datatable-body');
const gatewayElement: any = element.querySelector('#search-people-list .adf-datatable-body');
expect(gatewayElement).not.toBeNull();
expect(gatewayElement.children.length).toBe(2);
done();
@@ -99,7 +99,7 @@ describe('PeopleSearchComponent', () => {
fixture.whenStable()
.then(() => {
peopleSearchComponent.onRowClick(fakeUser);
let addUserButton = <HTMLElement> element.querySelector('#add-people');
const addUserButton = <HTMLElement> element.querySelector('#add-people');
addUserButton.click();
});
});
@@ -115,14 +115,14 @@ describe('PeopleSearchComponent', () => {
fixture.detectChanges();
peopleSearchComponent.onRowClick(fakeUser);
let addUserButton = <HTMLElement> element.querySelector('#add-people');
const addUserButton = <HTMLElement> element.querySelector('#add-people');
addUserButton.click();
fixture.detectChanges();
fixture.whenStable()
.then(() => {
fixture.detectChanges();
let gatewayElement: any = element.querySelector('#search-people-list .adf-datatable-body');
const gatewayElement: any = element.querySelector('#search-people-list .adf-datatable-body');
expect(gatewayElement).not.toBeNull();
expect(gatewayElement.children.length).toBe(1);
done();

View File

@@ -42,7 +42,7 @@ describe('PeopleComponent', () => {
let activitiPeopleComponent: PeopleComponent;
let fixture: ComponentFixture<PeopleComponent>;
let element: HTMLElement;
let userArray = [fakeUser, fakeSecondUser];
const userArray = [fakeUser, fakeSecondUser];
let logService: LogService;
setupTestBed({
@@ -99,7 +99,7 @@ describe('PeopleComponent', () => {
it('should show people involved', async(() => {
fixture.whenStable()
.then(() => {
let gatewayElement: any = element.querySelector('#assignment-people-list .adf-datatable-body');
const gatewayElement: any = element.querySelector('#assignment-people-list .adf-datatable-body');
expect(gatewayElement).not.toBeNull();
expect(gatewayElement.children.length).toBe(2);
});
@@ -113,7 +113,7 @@ describe('PeopleComponent', () => {
fixture.whenStable()
.then(() => {
fixture.detectChanges();
let gatewayElement: any = element.querySelector('#assignment-people-list .adf-datatable-body');
const gatewayElement: any = element.querySelector('#assignment-people-list .adf-datatable-body');
expect(gatewayElement).not.toBeNull();
expect(gatewayElement.children.length).toBe(1);
});
@@ -127,7 +127,7 @@ describe('PeopleComponent', () => {
fixture.whenStable()
.then(() => {
fixture.detectChanges();
let gatewayElement: any = element.querySelector('#assignment-people-list .adf-datatable-body');
const gatewayElement: any = element.querySelector('#assignment-people-list .adf-datatable-body');
expect(gatewayElement).not.toBeNull();
expect(gatewayElement.children.length).toBe(3);
});
@@ -206,7 +206,7 @@ describe('PeopleComponent', () => {
fixture.whenStable()
.then(() => {
fixture.detectChanges();
let gatewayElement: any = element.querySelector('#assignment-people-list .adf-datatable-body');
const gatewayElement: any = element.querySelector('#assignment-people-list .adf-datatable-body');
expect(gatewayElement).not.toBeNull();
expect(gatewayElement.children.length).toBe(2);
});
@@ -220,7 +220,7 @@ describe('PeopleComponent', () => {
fixture.whenStable()
.then(() => {
fixture.detectChanges();
let gatewayElement: any = element.querySelector('#assignment-people-list .adf-datatable-body');
const gatewayElement: any = element.querySelector('#assignment-people-list .adf-datatable-body');
expect(gatewayElement).not.toBeNull();
expect(gatewayElement.children.length).toBe(2);
});

View File

@@ -49,17 +49,17 @@ describe('ProcessCommentsComponent', () => {
});
it('should load comments when processInstanceId specified', () => {
let change = new SimpleChange(null, '123', true);
const change = new SimpleChange(null, '123', true);
component.ngOnChanges({ 'processInstanceId': change });
fixture.detectChanges();
expect(getCommentsSpy).toHaveBeenCalled();
});
it('should emit an error when an error occurs loading comments', () => {
let emitSpy = spyOn(component.error, 'emit');
const emitSpy = spyOn(component.error, 'emit');
getCommentsSpy.and.returnValue(throwError({}));
let change = new SimpleChange(null, '123', true);
const change = new SimpleChange(null, '123', true);
component.ngOnChanges({ 'processInstanceId': change });
fixture.detectChanges();
@@ -72,7 +72,7 @@ describe('ProcessCommentsComponent', () => {
});
it('should display comments when the process has comments', async(() => {
let change = new SimpleChange(null, '123', true);
const change = new SimpleChange(null, '123', true);
component.ngOnChanges({ 'processInstanceId': change });
fixture.whenStable().then(() => {
@@ -83,18 +83,18 @@ describe('ProcessCommentsComponent', () => {
}));
it('should display comments count when the process has comments', async(() => {
let change = new SimpleChange(null, '123', true);
const change = new SimpleChange(null, '123', true);
component.ngOnChanges({ 'processInstanceId': change });
fixture.whenStable().then(() => {
fixture.detectChanges();
let element = fixture.nativeElement.querySelector('#comment-header');
const element = fixture.nativeElement.querySelector('#comment-header');
expect(element.innerText).toBe('ADF_PROCESS_LIST.DETAILS.COMMENTS.HEADER');
});
}));
it('should not display comments when the process has no comments', async(() => {
let change = new SimpleChange(null, '123', true);
const change = new SimpleChange(null, '123', true);
component.ngOnChanges({ 'processInstanceId': change });
getCommentsSpy.and.returnValue(of([]));
@@ -105,7 +105,7 @@ describe('ProcessCommentsComponent', () => {
}));
it('should not display comments input by default', async(() => {
let change = new SimpleChange(null, '123', true);
const change = new SimpleChange(null, '123', true);
component.ngOnChanges({ 'processInstanceId': change });
fixture.whenStable().then(() => {

View File

@@ -57,7 +57,7 @@ export class ProcessCommentsComponent implements OnChanges {
}
ngOnChanges(changes: SimpleChanges) {
let processInstanceId = changes['processInstanceId'];
const processInstanceId = changes['processInstanceId'];
if (processInstanceId) {
if (processInstanceId.currentValue) {
this.getProcessInstanceComments(processInstanceId.currentValue);
@@ -73,8 +73,8 @@ export class ProcessCommentsComponent implements OnChanges {
this.commentProcessService.getProcessInstanceComments(processInstanceId).subscribe(
(res: CommentModel[]) => {
res = res.sort((comment1: CommentModel, comment2: CommentModel) => {
let date1 = new Date(comment1.created);
let date2 = new Date(comment2.created);
const date1 = new Date(comment1.created);
const date2 = new Date(comment2.created);
return date1 > date2 ? -1 : date1 < date2 ? 1 : 0;
});
res.forEach((comment) => {

View File

@@ -56,7 +56,7 @@ describe('ProcessAuditDirective', () => {
let service: ProcessService;
function createFakePdfBlob(): Blob {
let pdfData = atob(
const pdfData = atob(
'JVBERi0xLjcKCjEgMCBvYmogICUgZW50cnkgcG9pbnQKPDwKICAvVHlwZSAvQ2F0YWxvZwog' +
'IC9QYWdlcyAyIDAgUgo+PgplbmRvYmoKCjIgMCBvYmoKPDwKICAvVHlwZSAvUGFnZXMKICAv' +
'TWVkaWFCb3ggWyAwIDAgMjAwIDIwMCBdCiAgL0NvdW50IDEKICAvS2lkcyBbIDMgMCBSIF0K' +
@@ -99,13 +99,13 @@ describe('ProcessAuditDirective', () => {
it('should fetch the pdf Blob when the format is pdf', fakeAsync(() => {
component.fileName = 'FakeAuditName';
component.format = 'pdf';
let blob = createFakePdfBlob();
const blob = createFakePdfBlob();
spyOn(service, 'fetchProcessAuditPdfById').and.returnValue(of(blob));
spyOn(component, 'onAuditClick').and.callThrough();
fixture.detectChanges();
let button = fixture.nativeElement.querySelector('#auditButton');
const button = fixture.nativeElement.querySelector('#auditButton');
fixture.whenStable().then(() => {
fixture.detectChanges();
@@ -141,7 +141,7 @@ describe('ProcessAuditDirective', () => {
fixture.detectChanges();
let button = fixture.nativeElement.querySelector('#auditButton');
const button = fixture.nativeElement.querySelector('#auditButton');
fixture.whenStable().then(() => {
fixture.detectChanges();
@@ -155,13 +155,13 @@ describe('ProcessAuditDirective', () => {
it('should fetch the pdf Blob as default when the format is UNKNOW', fakeAsync(() => {
component.fileName = 'FakeAuditName';
component.format = 'fakeFormat';
let blob = createFakePdfBlob();
const blob = createFakePdfBlob();
spyOn(service, 'fetchProcessAuditPdfById').and.returnValue(of(blob));
spyOn(component, 'onAuditClick').and.callThrough();
fixture.detectChanges();
let button = fixture.nativeElement.querySelector('#auditButton');
const button = fixture.nativeElement.querySelector('#auditButton');
fixture.whenStable().then(() => {
fixture.detectChanges();

View File

@@ -85,7 +85,7 @@ describe('ProcessFiltersComponent', () => {
it('should return the filter task list', (done) => {
spyOn(processFilterService, 'getProcessFilters').and.returnValue(from(fakeGlobalFilterPromise));
const appId = '1';
let change = new SimpleChange(null, appId, true);
const change = new SimpleChange(null, appId, true);
filterList.ngOnChanges({ 'appId': change });
filterList.success.subscribe((res) => {
@@ -104,7 +104,7 @@ describe('ProcessFiltersComponent', () => {
it('should select the Running process filter', (done) => {
spyOn(processFilterService, 'getProcessFilters').and.returnValue(from(fakeGlobalFilterPromise));
const appId = '1';
let change = new SimpleChange(null, appId, true);
const change = new SimpleChange(null, appId, true);
filterList.ngOnChanges({ 'appId': change });
expect(filterList.currentFilter).toBeUndefined();
@@ -121,7 +121,7 @@ describe('ProcessFiltersComponent', () => {
it('should emit an event when a filter is selected', (done) => {
spyOn(processFilterService, 'getProcessFilters').and.returnValue(from(fakeGlobalFilterPromise));
const appId = '1';
let change = new SimpleChange(null, appId, true);
const change = new SimpleChange(null, appId, true);
filterList.ngOnChanges({ 'appId': change });
expect(filterList.currentFilter).toBeUndefined();
@@ -139,11 +139,11 @@ describe('ProcessFiltersComponent', () => {
spyOn(appsProcessService, 'getDeployedApplicationsByName').and.returnValue(from(Promise.resolve({ id: 1 })));
spyOn(processFilterService, 'getProcessFilters').and.returnValue(from(fakeGlobalFilterPromise));
let change = new SimpleChange(null, 'test', true);
const change = new SimpleChange(null, 'test', true);
filterList.ngOnChanges({ 'appName': change });
filterList.success.subscribe((res) => {
let deployApp: any = appsProcessService.getDeployedApplicationsByName;
const deployApp: any = appsProcessService.getDeployedApplicationsByName;
expect(deployApp.calls.count()).toEqual(1);
expect(res).toBeDefined();
done();
@@ -156,7 +156,7 @@ describe('ProcessFiltersComponent', () => {
spyOn(processFilterService, 'getProcessFilters').and.returnValue(from(mockErrorFilterPromise));
const appId = '1';
let change = new SimpleChange(null, appId, true);
const change = new SimpleChange(null, appId, true);
filterList.ngOnChanges({ 'appId': change });
filterList.error.subscribe((err) => {
@@ -171,7 +171,7 @@ describe('ProcessFiltersComponent', () => {
spyOn(appsProcessService, 'getDeployedApplicationsByName').and.returnValue(from(mockErrorFilterPromise));
const appId = 'fake-app';
let change = new SimpleChange(null, appId, true);
const change = new SimpleChange(null, appId, true);
filterList.ngOnChanges({ 'appName': change });
filterList.error.subscribe((err) => {
@@ -183,7 +183,7 @@ describe('ProcessFiltersComponent', () => {
});
it('should emit an event when a filter is selected', (done) => {
let currentFilter = new FilterProcessRepresentationModel({
const currentFilter = new FilterProcessRepresentationModel({
id: 10,
name: 'FakeInvolvedTasks',
filter: { state: 'open', assignment: 'fake-involved' }
@@ -203,7 +203,7 @@ describe('ProcessFiltersComponent', () => {
spyOn(filterList, 'getFiltersByAppId').and.stub();
const appId = '1';
let change = new SimpleChange(null, appId, true);
const change = new SimpleChange(null, appId, true);
filterList.ngOnChanges({ 'appId': change });
expect(filterList.getFiltersByAppId).toHaveBeenCalledWith(appId);
@@ -213,7 +213,7 @@ describe('ProcessFiltersComponent', () => {
spyOn(filterList, 'getFiltersByAppId').and.stub();
const appId = null;
let change = new SimpleChange(null, appId, true);
const change = new SimpleChange(null, appId, true);
filterList.ngOnChanges({ 'appId': change });
expect(filterList.getFiltersByAppId).toHaveBeenCalledWith(appId);
@@ -223,14 +223,14 @@ describe('ProcessFiltersComponent', () => {
spyOn(filterList, 'getFiltersByAppName').and.stub();
const appName = 'fake-app-name';
let change = new SimpleChange(null, appName, true);
const change = new SimpleChange(null, appName, true);
filterList.ngOnChanges({ 'appName': change });
expect(filterList.getFiltersByAppName).toHaveBeenCalledWith(appName);
});
it('should return the current filter after one is selected', () => {
let filter = new FilterProcessRepresentationModel({
const filter = new FilterProcessRepresentationModel({
name: 'FakeMyTasks',
filter: { state: 'open', assignment: 'fake-assignee' }
});
@@ -245,7 +245,7 @@ describe('ProcessFiltersComponent', () => {
filterList.filterParam = new FilterProcessRepresentationModel({ id: 20 });
const appId = 1;
let change = new SimpleChange(null, appId, true);
const change = new SimpleChange(null, appId, true);
filterList.ngOnChanges({ 'appId': change });
@@ -265,7 +265,7 @@ describe('ProcessFiltersComponent', () => {
filterList.filterParam = new FilterProcessRepresentationModel({ name: 'FakeMyTasks' });
const appId = 1;
let change = new SimpleChange(null, appId, true);
const change = new SimpleChange(null, appId, true);
filterList.ngOnChanges({ 'appId': change });
@@ -285,7 +285,7 @@ describe('ProcessFiltersComponent', () => {
filterList.filterParam = new FilterProcessRepresentationModel({});
const appId = 1;
let change = new SimpleChange(null, appId, true);
const change = new SimpleChange(null, appId, true);
filterList.ngOnChanges({ 'appId': change });
@@ -302,13 +302,13 @@ describe('ProcessFiltersComponent', () => {
it('should attach specific icon for each filter if hasIcon is true', (done) => {
spyOn(processFilterService, 'getProcessFilters').and.returnValue(from(fakeGlobalFilterPromise));
filterList.showIcon = true;
let change = new SimpleChange(undefined, 1, true);
const change = new SimpleChange(undefined, 1, true);
filterList.ngOnChanges({ 'appId': change });
fixture.detectChanges();
fixture.whenStable().then(() => {
fixture.detectChanges();
expect(filterList.filters.length).toBe(3);
let filters: any = fixture.debugElement.queryAll(By.css('.adf-filters__entry-icon'));
const filters: any = fixture.debugElement.queryAll(By.css('.adf-filters__entry-icon'));
expect(filters.length).toBe(3);
expect(filters[0].nativeElement.innerText).toContain('dashboard');
expect(filters[1].nativeElement.innerText).toContain('shuffle');
@@ -320,12 +320,12 @@ describe('ProcessFiltersComponent', () => {
it('should not attach icons for each filter if hasIcon is false', (done) => {
spyOn(processFilterService, 'getProcessFilters').and.returnValue(from(fakeGlobalFilterPromise));
filterList.showIcon = false;
let change = new SimpleChange(undefined, 1, true);
const change = new SimpleChange(undefined, 1, true);
filterList.ngOnChanges({ 'appId': change });
fixture.detectChanges();
fixture.whenStable().then(() => {
fixture.detectChanges();
let filters: any = fixture.debugElement.queryAll(By.css('.adf-filters__entry-icon'));
const filters: any = fixture.debugElement.queryAll(By.css('.adf-filters__entry-icon'));
expect(filters.length).toBe(0);
done();
});

View File

@@ -72,7 +72,7 @@ describe('ProcessInstanceDetailsComponent', () => {
component.ngOnChanges({ 'processInstanceId': new SimpleChange(null, '123', true) });
fixture.whenStable().then(() => {
fixture.detectChanges();
let headerEl: DebugElement = fixture.debugElement.query(By.css('.mat-card-title '));
const headerEl: DebugElement = fixture.debugElement.query(By.css('.mat-card-title '));
expect(headerEl).not.toBeNull();
expect(headerEl.nativeElement.innerText).toBe('Process 123');
});
@@ -84,7 +84,7 @@ describe('ProcessInstanceDetailsComponent', () => {
component.ngOnChanges({ 'processInstanceId': new SimpleChange(null, '123', true) });
fixture.whenStable().then(() => {
fixture.detectChanges();
let headerEl: DebugElement = fixture.debugElement.query(By.css('.mat-card-title '));
const headerEl: DebugElement = fixture.debugElement.query(By.css('.mat-card-title '));
expect(headerEl).not.toBeNull();
expect(headerEl.nativeElement.innerText).toBe('My Process - Nov 10, 2016, 3:37:30 AM');
});
@@ -92,8 +92,8 @@ describe('ProcessInstanceDetailsComponent', () => {
describe('change detection', () => {
let change = new SimpleChange('123', '456', true);
let nullChange = new SimpleChange('123', null, true);
const change = new SimpleChange('123', '456', true);
const nullChange = new SimpleChange('123', null, true);
beforeEach(async(() => {
component.processInstanceId = '123';
@@ -130,7 +130,7 @@ describe('ProcessInstanceDetailsComponent', () => {
ended: null
});
fixture.detectChanges();
let buttonEl = fixture.debugElement.query(By.css('[data-automation-id="header-status"] button'));
const buttonEl = fixture.debugElement.query(By.css('[data-automation-id="header-status"] button'));
expect(buttonEl).not.toBeNull();
});
@@ -143,7 +143,7 @@ describe('ProcessInstanceDetailsComponent', () => {
fixture.detectChanges();
fixture.whenStable().then(() => {
let diagramButton = fixture.debugElement.query(By.css('#show-diagram-button'));
const diagramButton = fixture.debugElement.query(By.css('#show-diagram-button'));
expect(diagramButton).not.toBeNull();
expect(diagramButton.nativeElement.disabled).toBe(false);
});
@@ -157,7 +157,7 @@ describe('ProcessInstanceDetailsComponent', () => {
fixture.detectChanges();
fixture.whenStable().then(() => {
let diagramButton = fixture.debugElement.query(By.css('#show-diagram-button'));
const diagramButton = fixture.debugElement.query(By.css('#show-diagram-button'));
expect(diagramButton).not.toBeNull();
expect(diagramButton.nativeElement.disabled).toBe(true);
});

View File

@@ -78,7 +78,7 @@ export class ProcessInstanceDetailsComponent implements OnChanges {
}
ngOnChanges(changes: SimpleChanges) {
let processInstanceId = changes['processInstanceId'];
const processInstanceId = changes['processInstanceId'];
if (processInstanceId && !processInstanceId.currentValue) {
this.reset();
return;
@@ -134,7 +134,7 @@ export class ProcessInstanceDetailsComponent implements OnChanges {
}
getFormatDate(value, format: string) {
let datePipe = new DatePipe('en-US');
const datePipe = new DatePipe('en-US');
try {
return datePipe.transform(value, format);
} catch (err) {

View File

@@ -54,7 +54,7 @@ describe('ProcessInstanceHeaderComponent', () => {
component.processInstance.ended = null;
component.ngOnChanges({});
fixture.detectChanges();
let valueEl = fixture.nativeElement.querySelector('[data-automation-id="card-textitem-value-status"]');
const valueEl = fixture.nativeElement.querySelector('[data-automation-id="card-textitem-value-status"]');
expect(valueEl.innerText).toBe('Running');
});
@@ -62,7 +62,7 @@ describe('ProcessInstanceHeaderComponent', () => {
component.processInstance.ended = new Date('2016-11-03');
component.ngOnChanges({});
fixture.detectChanges();
let valueEl = fixture.nativeElement.querySelector('[data-automation-id="card-textitem-value-status"]');
const valueEl = fixture.nativeElement.querySelector('[data-automation-id="card-textitem-value-status"]');
expect(valueEl.innerText).toBe('Completed');
});
@@ -70,7 +70,7 @@ describe('ProcessInstanceHeaderComponent', () => {
component.processInstance.ended = new Date('2016-11-03');
component.ngOnChanges({});
fixture.detectChanges();
let valueEl = fixture.nativeElement.querySelector('[data-automation-id="card-dateitem-ended"]');
const valueEl = fixture.nativeElement.querySelector('[data-automation-id="card-dateitem-ended"]');
expect(valueEl.innerText).toBe('Nov 03 2016');
});
@@ -78,7 +78,7 @@ describe('ProcessInstanceHeaderComponent', () => {
component.processInstance.ended = null;
component.ngOnChanges({});
fixture.detectChanges();
let valueEl = fixture.nativeElement.querySelector('[data-automation-id="card-dateitem-ended"]');
const valueEl = fixture.nativeElement.querySelector('[data-automation-id="card-dateitem-ended"]');
expect(valueEl.innerText).toBe('ADF_PROCESS_LIST.PROPERTIES.END_DATE_DEFAULT');
});
@@ -86,7 +86,7 @@ describe('ProcessInstanceHeaderComponent', () => {
component.processInstance.processDefinitionCategory = 'Accounts';
component.ngOnChanges({});
fixture.detectChanges();
let valueEl = fixture.nativeElement.querySelector('[data-automation-id="card-textitem-value-category"]');
const valueEl = fixture.nativeElement.querySelector('[data-automation-id="card-textitem-value-category"]');
expect(valueEl.innerText).toBe('Accounts');
});
@@ -94,7 +94,7 @@ describe('ProcessInstanceHeaderComponent', () => {
component.processInstance.processDefinitionCategory = null;
component.ngOnChanges({});
fixture.detectChanges();
let valueEl = fixture.nativeElement.querySelector('[data-automation-id="card-textitem-value-category"]');
const valueEl = fixture.nativeElement.querySelector('[data-automation-id="card-textitem-value-category"]');
expect(valueEl.innerText).toBe('ADF_PROCESS_LIST.PROPERTIES.CATEGORY_DEFAULT');
});
@@ -102,7 +102,7 @@ describe('ProcessInstanceHeaderComponent', () => {
component.processInstance.started = new Date('2016-11-03');
component.ngOnChanges({});
fixture.detectChanges();
let valueEl = fixture.nativeElement.querySelector('[data-automation-id="card-dateitem-created"]');
const valueEl = fixture.nativeElement.querySelector('[data-automation-id="card-dateitem-created"]');
expect(valueEl.innerText).toBe('Nov 03 2016');
});
@@ -110,7 +110,7 @@ describe('ProcessInstanceHeaderComponent', () => {
component.processInstance.startedBy = {firstName: 'Admin', lastName: 'User'};
component.ngOnChanges({});
fixture.detectChanges();
let valueEl = fixture.nativeElement.querySelector('[data-automation-id="card-textitem-value-assignee"]');
const valueEl = fixture.nativeElement.querySelector('[data-automation-id="card-textitem-value-assignee"]');
expect(valueEl.innerText).toBe('Admin User');
});
@@ -118,7 +118,7 @@ describe('ProcessInstanceHeaderComponent', () => {
component.processInstance.id = '123';
component.ngOnChanges({});
fixture.detectChanges();
let valueEl = fixture.nativeElement.querySelector('[data-automation-id="card-textitem-value-id"]');
const valueEl = fixture.nativeElement.querySelector('[data-automation-id="card-textitem-value-id"]');
expect(valueEl.innerText).toBe('123');
});
@@ -126,7 +126,7 @@ describe('ProcessInstanceHeaderComponent', () => {
component.processInstance.processDefinitionDescription = 'Test process';
component.ngOnChanges({});
fixture.detectChanges();
let valueEl = fixture.nativeElement.querySelector('[data-automation-id="card-textitem-value-description"]');
const valueEl = fixture.nativeElement.querySelector('[data-automation-id="card-textitem-value-description"]');
expect(valueEl.innerText).toBe('Test process');
});
@@ -134,7 +134,7 @@ describe('ProcessInstanceHeaderComponent', () => {
component.processInstance.processDefinitionDescription = null;
component.ngOnChanges({});
fixture.detectChanges();
let valueEl = fixture.nativeElement.querySelector('[data-automation-id="card-textitem-value-description"]');
const valueEl = fixture.nativeElement.querySelector('[data-automation-id="card-textitem-value-description"]');
expect(valueEl.innerText).toBe('ADF_PROCESS_LIST.PROPERTIES.DESCRIPTION_DEFAULT');
});
@@ -142,7 +142,7 @@ describe('ProcessInstanceHeaderComponent', () => {
component.processInstance.businessKey = 'fakeBusinessKey';
component.ngOnChanges({});
fixture.detectChanges();
let valueEl = fixture.nativeElement.querySelector('[data-automation-id="card-textitem-value-businessKey"]');
const valueEl = fixture.nativeElement.querySelector('[data-automation-id="card-textitem-value-businessKey"]');
expect(valueEl.innerText).toBe('fakeBusinessKey');
});
@@ -150,7 +150,7 @@ describe('ProcessInstanceHeaderComponent', () => {
component.processInstance.businessKey = null;
component.ngOnChanges({});
fixture.detectChanges();
let valueEl = fixture.nativeElement.querySelector('[data-automation-id="card-textitem-value-businessKey"]');
const valueEl = fixture.nativeElement.querySelector('[data-automation-id="card-textitem-value-businessKey"]');
expect(valueEl.innerText).toBe('ADF_PROCESS_LIST.PROPERTIES.BUSINESS_KEY_DEFAULT');
});

View File

@@ -36,7 +36,7 @@ describe('ProcessInstanceTasksComponent', () => {
let service: ProcessService;
// let getProcessTasksSpy: jasmine.Spy;
let exampleProcessInstance = new ProcessInstance({ id: '123' });
const exampleProcessInstance = new ProcessInstance({ id: '123' });
setupTestBed({
imports: [
@@ -61,7 +61,7 @@ describe('ProcessInstanceTasksComponent', () => {
component.processInstanceDetails = undefined;
fixture.detectChanges();
fixture.whenStable().then(() => {
let msgEl = fixture.debugElement.query(By.css('[data-automation-id="active-tasks-none"]'));
const msgEl = fixture.debugElement.query(By.css('[data-automation-id="active-tasks-none"]'));
expect(msgEl).not.toBeNull();
});
}));
@@ -70,7 +70,7 @@ describe('ProcessInstanceTasksComponent', () => {
component.processInstanceDetails = undefined;
fixture.detectChanges();
fixture.whenStable().then(() => {
let msgEl = fixture.debugElement.query(By.css('[data-automation-id="completed-tasks-none"]'));
const msgEl = fixture.debugElement.query(By.css('[data-automation-id="completed-tasks-none"]'));
expect(msgEl).not.toBeNull();
});
}));
@@ -78,37 +78,37 @@ describe('ProcessInstanceTasksComponent', () => {
it('should not render active tasks list if no process instance ID provided', () => {
component.processInstanceDetails = undefined;
fixture.detectChanges();
let listEl = fixture.debugElement.query(By.css('[data-automation-id="active-tasks"]'));
const listEl = fixture.debugElement.query(By.css('[data-automation-id="active-tasks"]'));
expect(listEl).toBeNull();
});
it('should not render completed tasks list if no process instance ID provided', () => {
component.processInstanceDetails = undefined;
fixture.detectChanges();
let listEl = fixture.debugElement.query(By.css('[data-automation-id="completed-tasks"]'));
const listEl = fixture.debugElement.query(By.css('[data-automation-id="completed-tasks"]'));
expect(listEl).toBeNull();
});
it('should display active tasks', async(() => {
let change = new SimpleChange(null, exampleProcessInstance, true);
const change = new SimpleChange(null, exampleProcessInstance, true);
fixture.detectChanges();
component.ngOnChanges({ 'processInstanceDetails': change });
fixture.whenStable().then(() => {
fixture.detectChanges();
component.ngOnChanges({ 'processInstanceDetails': change });
let listEl = fixture.debugElement.query(By.css('[data-automation-id="active-tasks"]'));
const listEl = fixture.debugElement.query(By.css('[data-automation-id="active-tasks"]'));
expect(listEl).not.toBeNull();
expect(listEl.queryAll(By.css('mat-list-item')).length).toBe(1);
});
}));
it('should display completed tasks', async(() => {
let change = new SimpleChange(null, exampleProcessInstance, true);
const change = new SimpleChange(null, exampleProcessInstance, true);
fixture.detectChanges();
component.ngOnChanges({ 'processInstanceDetails': change });
fixture.whenStable().then(() => {
fixture.detectChanges();
let listEl = fixture.debugElement.query(By.css('[data-automation-id="completed-tasks"]'));
const listEl = fixture.debugElement.query(By.css('[data-automation-id="completed-tasks"]'));
expect(listEl).not.toBeNull();
expect(listEl.queryAll(By.css('mat-list-item')).length).toBe(1);
});

View File

@@ -87,7 +87,7 @@ export class ProcessInstanceTasksComponent implements OnInit, OnChanges {
}
ngOnChanges(changes: SimpleChanges) {
let processInstanceDetails = changes['processInstanceDetails'];
const processInstanceDetails = changes['processInstanceDetails'];
if (processInstanceDetails && processInstanceDetails.currentValue) {
this.load(processInstanceDetails.currentValue.id);
}
@@ -148,7 +148,7 @@ export class ProcessInstanceTasksComponent implements OnInit, OnChanges {
}
getFormatDate(value, format: string) {
let datePipe = new DatePipe('en-US');
const datePipe = new DatePipe('en-US');
try {
return datePipe.transform(value, format);
} catch (err) {
@@ -157,7 +157,7 @@ export class ProcessInstanceTasksComponent implements OnInit, OnChanges {
}
clickTask($event: any, task: TaskDetailsModel) {
let args = new TaskDetailsEvent(task);
const args = new TaskDetailsEvent(task);
this.taskClick.emit(args);
}

View File

@@ -113,7 +113,7 @@ describe('ProcessInstanceListComponent', () => {
});
it('should emit onSuccess event when process instances loaded', fakeAsync(() => {
let emitSpy = spyOn(component.success, 'emit');
const emitSpy = spyOn(component.success, 'emit');
component.appId = 1;
component.state = 'open';
fixture.detectChanges();
@@ -183,7 +183,7 @@ describe('ProcessInstanceListComponent', () => {
});
it('should return an empty list when the response is wrong', fakeAsync(() => {
let mockError = 'Fake server error';
const mockError = 'Fake server error';
getProcessInstancesSpy.and.returnValue(throwError(mockError));
component.appId = 1;
component.state = 'open';
@@ -197,7 +197,7 @@ describe('ProcessInstanceListComponent', () => {
component.state = 'open';
fixture.detectChanges();
tick();
let emitSpy = spyOn(component.success, 'emit');
const emitSpy = spyOn(component.success, 'emit');
component.reload();
tick();
expect(emitSpy).toHaveBeenCalledWith(fakeProcessInstance);
@@ -223,10 +223,10 @@ describe('ProcessInstanceListComponent', () => {
});
it('should emit row click event', (done) => {
let row = new ObjectDataRow({
const row = new ObjectDataRow({
id: '999'
});
let rowEvent = new DataRowEvent(row, null);
const rowEvent = new DataRowEvent(row, null);
component.rowClick.subscribe((taskId) => {
expect(taskId).toEqual('999');
@@ -239,7 +239,7 @@ describe('ProcessInstanceListComponent', () => {
it('should emit row click event on Enter', (done) => {
let prevented = false;
let keyEvent = new CustomEvent('Keyboard event', { detail: {
const keyEvent = new CustomEvent('Keyboard event', { detail: {
keyboardEvent: { key: 'Enter' },
row: new ObjectDataRow({ id: '999' })
}});
@@ -258,7 +258,7 @@ describe('ProcessInstanceListComponent', () => {
it('should NOT emit row click event on every other key', async(() => {
let triggered = false;
let keyEvent = new CustomEvent('Keyboard event', { detail: {
const keyEvent = new CustomEvent('Keyboard event', { detail: {
keyboardEvent: { key: 'Space' },
row: new ObjectDataRow({ id: 999 })
}});
@@ -290,7 +290,7 @@ describe('ProcessInstanceListComponent', () => {
it('should reload the list when the appId parameter changes', (done) => {
const appId = '1';
let change = new SimpleChange(null, appId, true);
const change = new SimpleChange(null, appId, true);
component.success.subscribe((res) => {
expect(res).toBeDefined();
@@ -306,7 +306,7 @@ describe('ProcessInstanceListComponent', () => {
it('should reload the list when the state parameter changes', (done) => {
const state = 'open';
let change = new SimpleChange(null, state, true);
const change = new SimpleChange(null, state, true);
component.success.subscribe((res) => {
expect(res).toBeDefined();
@@ -322,7 +322,7 @@ describe('ProcessInstanceListComponent', () => {
it('should reload the list when the sort parameter changes', (done) => {
const sort = 'created-desc';
let change = new SimpleChange(null, sort, true);
const change = new SimpleChange(null, sort, true);
component.success.subscribe((res) => {
expect(res).toBeDefined();
@@ -338,7 +338,7 @@ describe('ProcessInstanceListComponent', () => {
it('should reload the process list when the processDefinitionId parameter changes', (done) => {
const processDefinitionId = 'SimpleProcess:1:10';
let change = new SimpleChange(null, processDefinitionId, true);
const change = new SimpleChange(null, processDefinitionId, true);
component.success.subscribe((res) => {
expect(res).toBeDefined();
@@ -354,7 +354,7 @@ describe('ProcessInstanceListComponent', () => {
it('should reload the process list when the processDefinitionId parameter changes to null', (done) => {
const processDefinitionId = null;
let change = new SimpleChange('SimpleProcess:1:10', processDefinitionId, false);
const change = new SimpleChange('SimpleProcess:1:10', processDefinitionId, false);
component.success.subscribe((res) => {
expect(res).toBeDefined();
@@ -370,7 +370,7 @@ describe('ProcessInstanceListComponent', () => {
it('should reload the process list when the processInstanceId parameter changes', (done) => {
const processInstanceId = '123';
let change = new SimpleChange(null, processInstanceId, true);
const change = new SimpleChange(null, processInstanceId, true);
component.success.subscribe((res) => {
expect(res).toBeDefined();
@@ -386,7 +386,7 @@ describe('ProcessInstanceListComponent', () => {
it('should reload the process list when the processInstanceId parameter changes to null', (done) => {
const processInstanceId = null;
let change = new SimpleChange('123', processInstanceId, false);
const change = new SimpleChange('123', processInstanceId, false);
component.success.subscribe((res) => {
expect(res).toBeDefined();
@@ -486,7 +486,7 @@ describe('Process List: Custom EmptyTemplateComponent', () => {
it('should render the custom template', (done) => {
fixture.whenStable().then(() => {
fixture.detectChanges();
let title = fixture.debugElement.query(By.css('#custom-id'));
const title = fixture.debugElement.query(By.css('#custom-id'));
expect(title).not.toBeNull();
expect(title.nativeElement.innerText).toBe('No Process Instance');
expect(fixture.debugElement.query(By.css('.adf-empty-content'))).toBeNull();

View File

@@ -173,13 +173,13 @@ export class ProcessInstanceListComponent extends DataTableSchema implements On
private isPropertyChanged(changes: SimpleChanges): boolean {
let changed: boolean = false;
let appId = changes['appId'];
let processDefinitionId = changes['processDefinitionId'];
let processInstanceId = changes['processInstanceId'];
let state = changes['state'];
let sort = changes['sort'];
let page = changes['page'];
let size = changes['size'];
const appId = changes['appId'];
const processDefinitionId = changes['processDefinitionId'];
const processInstanceId = changes['processInstanceId'];
const state = changes['state'];
const sort = changes['sort'];
const page = changes['page'];
const size = changes['size'];
if (appId && appId.currentValue) {
changed = true;
@@ -232,7 +232,7 @@ export class ProcessInstanceListComponent extends DataTableSchema implements On
selectFirst() {
if (this.selectFirstRow) {
if (!this.isListEmpty()) {
let dataRow = this.rows[0];
const dataRow = this.rows[0];
dataRow.isSelected = true;
this.currentInstanceId = dataRow['id'];
} else {
@@ -260,7 +260,7 @@ export class ProcessInstanceListComponent extends DataTableSchema implements On
* @param event
*/
onRowClick(event: DataRowEvent) {
let item = event;
const item = event;
this.currentInstanceId = item.value.getValue('id');
this.rowClick.emit(this.currentInstanceId);
}
@@ -302,7 +302,7 @@ export class ProcessInstanceListComponent extends DataTableSchema implements On
}
getFormatDate(value, format: string) {
let datePipe = new DatePipe('en-US');
const datePipe = new DatePipe('en-US');
try {
return datePipe.transform(value, format);
} catch (err) {
@@ -311,7 +311,7 @@ export class ProcessInstanceListComponent extends DataTableSchema implements On
}
private createRequestNode() {
let requestNode = {
const requestNode = {
appDefinitionId: this.appId,
processDefinitionId: this.processDefinitionId,
processInstanceId: this.processInstanceId,

View File

@@ -81,7 +81,7 @@ describe('StartFormComponent', () => {
beforeEach(() => {
fixture.detectChanges();
component.name = 'My new process';
let change = new SimpleChange(null, 123, true);
const change = new SimpleChange(null, 123, true);
component.ngOnChanges({ 'appId': change });
fixture.detectChanges();
});
@@ -94,7 +94,7 @@ describe('StartFormComponent', () => {
fixture.detectChanges();
fixture.whenStable().then(() => {
let startBtn = fixture.nativeElement.querySelector('#button-start');
const startBtn = fixture.nativeElement.querySelector('#button-start');
expect(startBtn.disabled).toBe(false);
});
}));
@@ -105,7 +105,7 @@ describe('StartFormComponent', () => {
component.processDefinitionInput.setValue(testProcessDef.name);
fixture.detectChanges();
fixture.whenStable().then(() => {
let startBtn = fixture.nativeElement.querySelector('#button-start');
const startBtn = fixture.nativeElement.querySelector('#button-start');
expect(startBtn.disabled).toBe(true);
});
}));
@@ -114,7 +114,7 @@ describe('StartFormComponent', () => {
component.selectedProcessDef = null;
fixture.detectChanges();
fixture.whenStable().then(() => {
let startBtn = fixture.nativeElement.querySelector('#button-start');
const startBtn = fixture.nativeElement.querySelector('#button-start');
expect(startBtn.disabled).toBe(true);
});
}));
@@ -125,7 +125,7 @@ describe('StartFormComponent', () => {
beforeEach(() => {
fixture.detectChanges();
getDefinitionsSpy.and.returnValue(of(testProcessDefWithForm));
let change = new SimpleChange(null, 123, true);
const change = new SimpleChange(null, 123, true);
component.ngOnChanges({ 'appId': change });
});
@@ -148,15 +148,15 @@ describe('StartFormComponent', () => {
component.name = 'My new process';
fixture.detectChanges();
fixture.whenStable().then(() => {
let startBtn = fixture.nativeElement.querySelector('#button-start');
const startBtn = fixture.nativeElement.querySelector('#button-start');
expect(startBtn).toBeNull();
});
}));
it('should emit cancel event on cancel Button', async(() => {
fixture.detectChanges();
let cancelButton = fixture.nativeElement.querySelector('#cancel_process');
let cancelSpy: jasmine.Spy = spyOn(component.cancel, 'emit');
const cancelButton = fixture.nativeElement.querySelector('#cancel_process');
const cancelSpy: jasmine.Spy = spyOn(component.cancel, 'emit');
cancelButton.click();
fixture.detectChanges();
fixture.whenStable().then(() => {
@@ -218,7 +218,7 @@ describe('StartFormComponent', () => {
it('should display the correct number of processes in the select list', () => {
fixture.whenStable().then(() => {
let selectElement = fixture.nativeElement.querySelector('mat-select');
const selectElement = fixture.nativeElement.querySelector('mat-select');
expect(selectElement.children.length).toBe(1);
});
});
@@ -227,8 +227,8 @@ describe('StartFormComponent', () => {
component.processDefinitions = testMultipleProcessDefs;
fixture.detectChanges();
fixture.whenStable().then(() => {
let selectElement = fixture.nativeElement.querySelector('mat-select > .mat-select-trigger');
let optionElement = fixture.nativeElement.querySelectorAll('mat-option');
const selectElement = fixture.nativeElement.querySelector('mat-select > .mat-select-trigger');
const optionElement = fixture.nativeElement.querySelectorAll('mat-option');
selectElement.click();
expect(selectElement).not.toBeNull();
expect(selectElement).toBeDefined();
@@ -244,7 +244,7 @@ describe('StartFormComponent', () => {
fixture.detectChanges();
fixture.whenStable().then(() => {
let errorEl = fixture.nativeElement.querySelector('#error-message');
const errorEl = fixture.nativeElement.querySelector('#error-message');
expect(errorEl).not.toBeNull('Expected error message to be present');
expect(errorEl.innerText.trim()).toBe('ADF_PROCESS_LIST.START_PROCESS.ERROR.LOAD_PROCESS_DEFS');
});
@@ -304,7 +304,7 @@ describe('StartFormComponent', () => {
component.ngOnChanges({});
fixture.detectChanges();
fixture.whenStable().then(() => {
let selectElement = fixture.nativeElement.querySelector('button#adf-select-process-dropdown');
const selectElement = fixture.nativeElement.querySelector('button#adf-select-process-dropdown');
expect(selectElement).toBeNull();
});
}));
@@ -318,7 +318,7 @@ describe('StartFormComponent', () => {
component.ngOnChanges({});
fixture.detectChanges();
fixture.whenStable().then(() => {
let selectElement = fixture.nativeElement.querySelector('button#adf-select-process-dropdown');
const selectElement = fixture.nativeElement.querySelector('button#adf-select-process-dropdown');
expect(selectElement).not.toBeNull();
});
}));
@@ -331,7 +331,7 @@ describe('StartFormComponent', () => {
component.ngOnChanges({});
fixture.detectChanges();
fixture.whenStable().then(() => {
let selectElement = fixture.nativeElement.querySelector('button#adf-select-process-dropdown');
const selectElement = fixture.nativeElement.querySelector('button#adf-select-process-dropdown');
expect(selectElement).not.toBeNull();
});
}));
@@ -340,7 +340,7 @@ describe('StartFormComponent', () => {
describe('input changes', () => {
let change = new SimpleChange(123, 456, true);
const change = new SimpleChange(123, 456, true);
beforeEach(async(() => {
component.appId = 123;
@@ -403,9 +403,9 @@ describe('StartFormComponent', () => {
}));
it('should call service to start process with the variables setted', async(() => {
let inputProcessVariable: ProcessInstanceVariable[] = [];
const inputProcessVariable: ProcessInstanceVariable[] = [];
let variable: ProcessInstanceVariable = {};
const variable: ProcessInstanceVariable = {};
variable.name = 'nodeId';
variable.value = 'id';
@@ -420,7 +420,7 @@ describe('StartFormComponent', () => {
}));
it('should output start event when process started successfully', async(() => {
let emitSpy = spyOn(component.start, 'emit');
const emitSpy = spyOn(component.start, 'emit');
component.selectedProcessDef = testProcessDef;
component.startProcess();
fixture.whenStable().then(() => {
@@ -429,8 +429,8 @@ describe('StartFormComponent', () => {
}));
it('should throw error event when process cannot be started', async(() => {
let errorSpy = spyOn(component.error, 'error');
let error = { message: 'My error' };
const errorSpy = spyOn(component.error, 'error');
const error = { message: 'My error' };
startProcessSpy = startProcessSpy.and.returnValue(throwError(error));
component.selectedProcessDef = testProcessDef;
component.startProcess();
@@ -446,14 +446,14 @@ describe('StartFormComponent', () => {
component.startProcess();
fixture.detectChanges();
fixture.whenStable().then(() => {
let errorEl = fixture.nativeElement.querySelector('#error-message');
const errorEl = fixture.nativeElement.querySelector('#error-message');
expect(errorEl).not.toBeNull();
expect(errorEl.innerText.trim()).toBe('ADF_PROCESS_LIST.START_PROCESS.ERROR.START');
});
}));
it('should emit start event when start select a process and add a name', (done) => {
let disposableStart = component.start.subscribe(() => {
const disposableStart = component.start.subscribe(() => {
disposableStart.unsubscribe();
done();
});
@@ -467,7 +467,7 @@ describe('StartFormComponent', () => {
it('should not emit start event when start the process without select a process and name', () => {
component.name = null;
component.selectedProcessDef = null;
let startSpy: jasmine.Spy = spyOn(component.start, 'emit');
const startSpy: jasmine.Spy = spyOn(component.start, 'emit');
component.startProcess();
fixture.detectChanges();
expect(startSpy).not.toHaveBeenCalled();
@@ -475,7 +475,7 @@ describe('StartFormComponent', () => {
it('should not emit start event when start the process without name', () => {
component.name = null;
let startSpy: jasmine.Spy = spyOn(component.start, 'emit');
const startSpy: jasmine.Spy = spyOn(component.start, 'emit');
component.startProcess();
fixture.detectChanges();
expect(startSpy).not.toHaveBeenCalled();
@@ -483,7 +483,7 @@ describe('StartFormComponent', () => {
it('should not emit start event when start the process without select a process', () => {
component.selectedProcessDef = null;
let startSpy: jasmine.Spy = spyOn(component.start, 'emit');
const startSpy: jasmine.Spy = spyOn(component.start, 'emit');
component.startProcess();
fixture.detectChanges();
expect(startSpy).not.toHaveBeenCalled();
@@ -493,7 +493,7 @@ describe('StartFormComponent', () => {
component.name = 'my:process1';
component.selectedProcessDef = testProcessDef;
let disposableStart = component.start.subscribe(() => {
const disposableStart = component.start.subscribe(() => {
disposableStart.unsubscribe();
done();
});

View File

@@ -137,7 +137,7 @@ export class StartProcessInstanceComponent implements OnChanges, OnInit {
private _filter(value: string): ProcessDefinitionRepresentation[] {
if (value !== null && value !== undefined) {
const filterValue = value.toLowerCase();
let filteredProcess = this.processDefinitions.filter((option) => option.name.toLowerCase().includes(filterValue));
const filteredProcess = this.processDefinitions.filter((option) => option.name.toLowerCase().includes(filterValue));
if (this.processFilterSelector) {
this.selectedProcessDef = this.getSelectedProcess(filterValue);
@@ -170,7 +170,7 @@ export class StartProcessInstanceComponent implements OnChanges, OnInit {
}
if (this.processDefinitionName) {
let selectedProcess = this.processDefinitions.find((currentProcessDefinition) => {
const selectedProcess = this.processDefinitions.find((currentProcessDefinition) => {
return currentProcessDefinition.name === this.processDefinitionName;
});
if (selectedProcess) {
@@ -199,11 +199,11 @@ export class StartProcessInstanceComponent implements OnChanges, OnInit {
}
moveNodeFromCStoPS() {
let accountIdentifier = this.getAlfrescoRepositoryName();
const accountIdentifier = this.getAlfrescoRepositoryName();
for (let key in this.values) {
for (const key in this.values) {
if (this.values.hasOwnProperty(key)) {
let currentValue = this.values[key];
const currentValue = this.values[key];
if (currentValue.isFile) {
this.activitiContentService.applyAlfrescoNode(currentValue, null, accountIdentifier).subscribe((res) => {
@@ -217,7 +217,7 @@ export class StartProcessInstanceComponent implements OnChanges, OnInit {
public startProcess(outcome?: string) {
if (this.selectedProcessDef && this.selectedProcessDef.id && this.name) {
this.resetErrorMessage();
let formValues = this.startForm ? this.startForm.form.values : undefined;
const formValues = this.startForm ? this.startForm.form.values : undefined;
this.activitiProcess.startProcess(this.selectedProcessDef.id, this.name, outcome, formValues, this.variables).subscribe(
(res) => {
this.name = '';

View File

@@ -163,7 +163,7 @@ describe('Process filter', () => {
.callFake((processfilter: FilterProcessRepresentationModel) => Promise.resolve(processfilter));
});
let filter = fakeProcessFilters.data[0];
const filter = fakeProcessFilters.data[0];
it('should call the API to create the filter', () => {
service.addProcessFilter(filter);

View File

@@ -38,9 +38,9 @@ export class ProcessFilterService {
return from(this.callApiProcessFilters(appId))
.pipe(
map((response: any) => {
let filters: FilterProcessRepresentationModel[] = [];
const filters: FilterProcessRepresentationModel[] = [];
response.data.forEach((filter: FilterProcessRepresentationModel) => {
let filterModel = new FilterProcessRepresentationModel(filter);
const filterModel = new FilterProcessRepresentationModel(filter);
filters.push(filterModel);
});
return filters;
@@ -87,14 +87,14 @@ export class ProcessFilterService {
* @returns Default filters just created
*/
public createDefaultFilters(appId: number): Observable<FilterProcessRepresentationModel[]> {
let runningFilter = this.getRunningFilterInstance(appId);
let runningObservable = this.addProcessFilter(runningFilter);
const runningFilter = this.getRunningFilterInstance(appId);
const runningObservable = this.addProcessFilter(runningFilter);
let completedFilter = this.getCompletedFilterInstance(appId);
let completedObservable = this.addProcessFilter(completedFilter);
const completedFilter = this.getCompletedFilterInstance(appId);
const completedObservable = this.addProcessFilter(completedFilter);
let allFilter = this.getAllFilterInstance(appId);
let allObservable = this.addProcessFilter(allFilter);
const allFilter = this.getAllFilterInstance(appId);
const allObservable = this.addProcessFilter(allFilter);
return new Observable((observer) => {
forkJoin(
@@ -103,7 +103,7 @@ export class ProcessFilterService {
allObservable
).subscribe(
(res) => {
let filters: FilterProcessRepresentationModel[] = [];
const filters: FilterProcessRepresentationModel[] = [];
res.forEach((filter) => {
if (filter.name === runningFilter.name) {
runningFilter.id = filter.id;

View File

@@ -47,7 +47,7 @@ describe('ProcessService', () => {
let getProcessInstances: jasmine.Spy;
let filter: ProcessFilterParamRepresentationModel = new ProcessFilterParamRepresentationModel({
const filter: ProcessFilterParamRepresentationModel = new ProcessFilterParamRepresentationModel({
processDefinitionId: '1',
appDefinitionId: '1',
page: 1,
@@ -69,7 +69,7 @@ describe('ProcessService', () => {
it('should return the correct instance data', async(() => {
service.getProcessInstances(filter).subscribe((instances) => {
let instance = instances.data[0];
const instance = instances.data[0];
expect(instance.id).toBe(exampleProcess.id);
expect(instance.name).toBe(exampleProcess.name);
expect(instance.started).toBe(exampleProcess.started);
@@ -81,7 +81,7 @@ describe('ProcessService', () => {
service.getProcessInstances(filter, 'fakeProcessDefinitionKey1').subscribe((instances) => {
expect(instances.data.length).toBe(1);
let instance = instances.data[0];
const instance = instances.data[0];
expect(instance.id).toBe('340124');
/* cspell:disable-next-line */
expect(instance.name).toBe('James Franklin EMEA Onboarding');
@@ -192,7 +192,7 @@ describe('ProcessService', () => {
});
it('should call the API to create the process instance with form parameters', () => {
let formParams = {
const formParams = {
type: 'ford',
color: 'red'
};
@@ -365,9 +365,9 @@ describe('ProcessService', () => {
}));
it('should return the correct task data', async(() => {
let fakeTasks = fakeTasksList.data;
const fakeTasks = fakeTasksList.data;
service.getProcessTasks(processId).subscribe((tasks) => {
let task = tasks[0];
const task = tasks[0];
expect(task.id).toBe(fakeTasks[0].id);
expect(task.name).toBe(fakeTasks[0].name);
expect(task.created).toEqual(moment(new Date('2016-11-10T00:00:00+00:00'), 'YYYY-MM-DD').format());
@@ -469,7 +469,7 @@ describe('ProcessService', () => {
describe('create or update variables', () => {
let updatedVariables = [new ProcessInstanceVariable({
const updatedVariables = [new ProcessInstanceVariable({
name: 'var1',
value: 'Test1'
}), new ProcessInstanceVariable({

View File

@@ -115,7 +115,7 @@ export class ProcessService {
* @returns Array of task instance details
*/
getProcessTasks(processInstanceId: string, state?: string): Observable<TaskDetailsModel[]> {
let taskOpts = state ? {
const taskOpts = state ? {
processInstanceId: processInstanceId,
state: state
} : {
@@ -138,7 +138,7 @@ export class ProcessService {
* @returns Array of process definitions
*/
getProcessDefinitions(appId?: number): Observable<ProcessDefinitionRepresentation[]> {
let opts = appId ? {
const opts = appId ? {
latest: true,
appDefinitionId: appId
} : {
@@ -164,7 +164,7 @@ export class ProcessService {
* @returns Details of the process instance just started
*/
startProcess(processDefinitionId: string, name: string, outcome?: string, startFormValues?: FormValues, variables?: ProcessInstanceVariable[]): Observable<ProcessInstance> {
let startRequest: any = {
const startRequest: any = {
name: name,
processDefinitionId: processDefinitionId
};

View File

@@ -51,7 +51,7 @@ describe('AttachFormComponent', () => {
it('should show the attach button disabled', async(() => {
fixture.detectChanges();
fixture.whenStable().then(() => {
let attachButton = fixture.debugElement.query(By.css('#adf-no-form-attach-form-button'));
const attachButton = fixture.debugElement.query(By.css('#adf-no-form-attach-form-button'));
expect(attachButton.nativeElement.disabled).toBeTruthy();
});
}));
@@ -87,7 +87,7 @@ describe('AttachFormComponent', () => {
spyOn(taskService, 'attachFormToATask').and.returnValue(of(true));
fixture.detectChanges();
fixture.whenStable().then(() => {
let attachButton = fixture.debugElement.query(By.css('#adf-no-form-attach-form-button'));
const attachButton = fixture.debugElement.query(By.css('#adf-no-form-attach-form-button'));
expect(attachButton.nativeElement.disabled).toBeFalsy();
});
}));
@@ -103,7 +103,7 @@ describe('AttachFormComponent', () => {
fixture.detectChanges();
component.attachFormControl.setValue(2);
fixture.detectChanges();
let attachButton = fixture.debugElement.query(By.css('#adf-no-form-attach-form-button'));
const attachButton = fixture.debugElement.query(By.css('#adf-no-form-attach-form-button'));
expect(attachButton.nativeElement.disabled).toBeTruthy();
});
}));

View File

@@ -178,7 +178,7 @@ describe('ChecklistComponent', () => {
}));
showChecklistDialog.click();
let addButtonDialog = <HTMLElement> window.document.querySelector('#add-check');
const addButtonDialog = <HTMLElement> window.document.querySelector('#add-check');
addButtonDialog.click();
fixture.whenStable().then(() => {
@@ -197,7 +197,7 @@ describe('ChecklistComponent', () => {
name: 'fake-check-name'
}));
fixture.detectChanges();
let checklistElementRemove = <HTMLElement> element.querySelector('#remove-fake-check-id');
const checklistElementRemove = <HTMLElement> element.querySelector('#remove-fake-check-id');
expect(checklistElementRemove).toBeDefined();
expect(checklistElementRemove).not.toBeNull();
checklistElementRemove.click();
@@ -220,7 +220,7 @@ describe('ChecklistComponent', () => {
fixture.whenStable().then(() => {
fixture.detectChanges();
expect(checklistComponent.checklist.length).toBe(1);
let checklistElementRemove = <HTMLElement> element.querySelector('#remove-fake-check-id');
const checklistElementRemove = <HTMLElement> element.querySelector('#remove-fake-check-id');
expect(checklistElementRemove).toBeDefined();
expect(checklistElementRemove).not.toBeNull();
checklistElementRemove.click();
@@ -237,7 +237,7 @@ describe('ChecklistComponent', () => {
name: 'fake-check-name'
}));
fixture.detectChanges();
let change = new SimpleChange(null, 'new-fake-task-id', true);
const change = new SimpleChange(null, 'new-fake-task-id', true);
checklistComponent.ngOnChanges({
taskId: change
});
@@ -257,7 +257,7 @@ describe('ChecklistComponent', () => {
}));
fixture.detectChanges();
checklistComponent.taskId = null;
let change = new SimpleChange(null, 'new-fake-task-id', true);
const change = new SimpleChange(null, 'new-fake-task-id', true);
checklistComponent.ngOnChanges({
taskId: change
});
@@ -271,7 +271,7 @@ describe('ChecklistComponent', () => {
it('should emit checklist task created event when the checklist is successfully added', (done) => {
spyOn(service, 'addTask').and.returnValue(of({ id: 'fake-check-added-id', name: 'fake-check-added-name' }));
let disposableCreated = checklistComponent.checklistTaskCreated.subscribe((taskAdded: TaskDetailsModel) => {
const disposableCreated = checklistComponent.checklistTaskCreated.subscribe((taskAdded: TaskDetailsModel) => {
fixture.detectChanges();
expect(taskAdded.id).toEqual('fake-check-added-id');
expect(taskAdded.name).toEqual('fake-check-added-name');
@@ -281,7 +281,7 @@ describe('ChecklistComponent', () => {
done();
});
showChecklistDialog.click();
let addButtonDialog = <HTMLElement> window.document.querySelector('#add-check');
const addButtonDialog = <HTMLElement> window.document.querySelector('#add-check');
addButtonDialog.click();
});
});

View File

@@ -72,7 +72,7 @@ export class ChecklistComponent implements OnChanges {
}
ngOnChanges(changes: SimpleChanges) {
let taskId = changes['taskId'];
const taskId = changes['taskId'];
if (taskId && taskId.currentValue) {
this.getTaskChecklist(taskId.currentValue);
return;
@@ -102,7 +102,7 @@ export class ChecklistComponent implements OnChanges {
}
public add() {
let newTask = new TaskDetailsModel({
const newTask = new TaskDetailsModel({
name: this.taskName,
parentTaskId: this.taskId,
assignee: { id: this.assignee }

View File

@@ -34,7 +34,7 @@ describe('NoTaskDetailsTemplateDirective', () => {
});
it('should set "no task details" template on task details component', () => {
let testTemplate: any = 'test template';
const testTemplate: any = 'test template';
component.template = testTemplate;
component.ngAfterContentInit();
expect(detailsComponent.noTaskDetailsTemplateComponent).toBe(testTemplate);

View File

@@ -34,7 +34,7 @@ describe('StartTaskComponent', () => {
let getFormListSpy: jasmine.Spy;
let createNewTaskSpy: jasmine.Spy;
let logSpy: jasmine.Spy;
let fakeForms$ = [
const fakeForms$ = [
{
id: 123,
name: 'Display Data'
@@ -45,7 +45,7 @@ describe('StartTaskComponent', () => {
}
];
let testUser = { id: 1001, firstName: 'fakeName', email: 'fake@app.activiti.com' };
const testUser = { id: 1001, firstName: 'fakeName', email: 'fake@app.activiti.com' };
setupTestBed({
imports: [ProcessTestingModule]
@@ -96,20 +96,20 @@ describe('StartTaskComponent', () => {
});
it('should create new task when start is clicked', () => {
let successSpy = spyOn(component.success, 'emit');
const successSpy = spyOn(component.success, 'emit');
component.taskForm.controls['name'].setValue('task');
fixture.detectChanges();
let createTaskButton = <HTMLElement> element.querySelector('#button-start');
const createTaskButton = <HTMLElement> element.querySelector('#button-start');
createTaskButton.click();
expect(successSpy).toHaveBeenCalled();
});
it('should send on success event when the task is started', () => {
let successSpy = spyOn(component.success, 'emit');
const successSpy = spyOn(component.success, 'emit');
component.taskDetailsModel = new TaskDetailsModel(taskDetailsMock);
component.taskForm.controls['name'].setValue('fakeName');
fixture.detectChanges();
let createTaskButton = <HTMLElement> element.querySelector('#button-start');
const createTaskButton = <HTMLElement> element.querySelector('#button-start');
createTaskButton.click();
expect(successSpy).toHaveBeenCalledWith({
id: 91,
@@ -120,20 +120,20 @@ describe('StartTaskComponent', () => {
});
it('should send on success event when only name is given', () => {
let successSpy = spyOn(component.success, 'emit');
const successSpy = spyOn(component.success, 'emit');
component.appId = 42;
component.taskForm.controls['name'].setValue('fakeName');
fixture.detectChanges();
let createTaskButton = <HTMLElement> element.querySelector('#button-start');
const createTaskButton = <HTMLElement> element.querySelector('#button-start');
createTaskButton.click();
expect(successSpy).toHaveBeenCalled();
});
it('should not emit success event when data not present', () => {
let successSpy = spyOn(component.success, 'emit');
const successSpy = spyOn(component.success, 'emit');
component.taskDetailsModel = new TaskDetailsModel(null);
fixture.detectChanges();
let createTaskButton = <HTMLElement> element.querySelector('#button-start');
const createTaskButton = <HTMLElement> element.querySelector('#button-start');
createTaskButton.click();
expect(createNewTaskSpy).not.toHaveBeenCalled();
expect(successSpy).not.toHaveBeenCalled();
@@ -161,13 +161,13 @@ describe('StartTaskComponent', () => {
assignee: null
}
));
let successSpy = spyOn(component.success, 'emit');
const successSpy = spyOn(component.success, 'emit');
component.taskForm.controls['name'].setValue('fakeName');
component.taskForm.controls['formKey'].setValue(1204);
component.appId = 42;
component.taskDetailsModel = new TaskDetailsModel(taskDetailsMock);
fixture.detectChanges();
let createTaskButton = <HTMLElement> element.querySelector('#button-start');
const createTaskButton = <HTMLElement> element.querySelector('#button-start');
createTaskButton.click();
expect(successSpy).toHaveBeenCalledWith({
id: 91,
@@ -186,13 +186,13 @@ describe('StartTaskComponent', () => {
assignee: null
}
));
let successSpy = spyOn(component.success, 'emit');
const successSpy = spyOn(component.success, 'emit');
component.taskForm.controls['name'].setValue('fakeName');
component.taskForm.controls['formKey'].setValue(null);
component.appId = 42;
component.taskDetailsModel = new TaskDetailsModel(taskDetailsMock);
fixture.detectChanges();
let createTaskButton = <HTMLElement> element.querySelector('#button-start');
const createTaskButton = <HTMLElement> element.querySelector('#button-start');
createTaskButton.click();
expect(successSpy).toHaveBeenCalledWith({
id: 91,
@@ -232,13 +232,13 @@ describe('StartTaskComponent', () => {
});
it('should assign task when an assignee is selected', () => {
let successSpy = spyOn(component.success, 'emit');
const successSpy = spyOn(component.success, 'emit');
component.taskForm.controls['name'].setValue('fakeName');
component.taskForm.controls['formKey'].setValue(1204);
component.appId = 42;
component.assigneeId = testUser.id;
fixture.detectChanges();
let createTaskButton = <HTMLElement> element.querySelector('#button-start');
const createTaskButton = <HTMLElement> element.querySelector('#button-start');
createTaskButton.click();
expect(successSpy).toHaveBeenCalledWith({
id: 91,
@@ -249,14 +249,14 @@ describe('StartTaskComponent', () => {
});
it('should assign task with id of selected user assigned', () => {
let successSpy = spyOn(component.success, 'emit');
const successSpy = spyOn(component.success, 'emit');
component.taskDetailsModel = new TaskDetailsModel(taskDetailsMock);
component.taskForm.controls['name'].setValue('fakeName');
component.taskForm.controls['formKey'].setValue(1204);
component.appId = 42;
component.getAssigneeId(testUser.id);
fixture.detectChanges();
let createTaskButton = <HTMLElement> element.querySelector('#button-start');
const createTaskButton = <HTMLElement> element.querySelector('#button-start');
createTaskButton.click();
expect(successSpy).toHaveBeenCalledWith({
id: 91,
@@ -267,14 +267,14 @@ describe('StartTaskComponent', () => {
});
it('should not assign task when no assignee is selected', () => {
let successSpy = spyOn(component.success, 'emit');
const successSpy = spyOn(component.success, 'emit');
component.taskForm.controls['name'].setValue('fakeName');
component.taskForm.controls['formKey'].setValue(1204);
component.appId = 42;
component.assigneeId = null;
component.taskDetailsModel = new TaskDetailsModel(taskDetailsMock);
fixture.detectChanges();
let createTaskButton = <HTMLElement> element.querySelector('#button-start');
const createTaskButton = <HTMLElement> element.querySelector('#button-start');
createTaskButton.click();
expect(successSpy).toHaveBeenCalledWith({
id: 91,
@@ -286,7 +286,7 @@ describe('StartTaskComponent', () => {
});
it('should not attach a form when a form id is not selected', () => {
let attachFormToATask = spyOn(service, 'attachFormToATask').and.returnValue([]);
const attachFormToATask = spyOn(service, 'attachFormToATask').and.returnValue([]);
spyOn(service, 'createNewTask').and.callFake(
function() {
return new Observable((observer) => {
@@ -296,7 +296,7 @@ describe('StartTaskComponent', () => {
});
component.taskForm.controls['name'].setValue('fakeName');
fixture.detectChanges();
let createTaskButton = <HTMLElement> element.querySelector('#button-start');
const createTaskButton = <HTMLElement> element.querySelector('#button-start');
fixture.detectChanges();
createTaskButton.click();
expect(attachFormToATask).not.toHaveBeenCalled();
@@ -310,7 +310,7 @@ describe('StartTaskComponent', () => {
});
it('should not emit TaskDetails OnCancel', () => {
let emitSpy = spyOn(component.cancel, 'emit');
const emitSpy = spyOn(component.cancel, 'emit');
component.onCancel();
expect(emitSpy).not.toBeNull();
expect(emitSpy).toHaveBeenCalled();
@@ -319,13 +319,13 @@ describe('StartTaskComponent', () => {
it('should disable start button if name is empty', () => {
component.taskForm.controls['name'].setValue('');
fixture.detectChanges();
let createTaskButton = fixture.nativeElement.querySelector('#button-start');
const createTaskButton = fixture.nativeElement.querySelector('#button-start');
expect(createTaskButton.disabled).toBeTruthy();
});
it('should cancel start task on cancel button click', () => {
let emitSpy = spyOn(component.cancel, 'emit');
let cancelTaskButton = <HTMLElement> element.querySelector('#button-cancel');
const emitSpy = spyOn(component.cancel, 'emit');
const cancelTaskButton = <HTMLElement> element.querySelector('#button-cancel');
fixture.detectChanges();
cancelTaskButton.click();
expect(emitSpy).not.toBeNull();
@@ -335,27 +335,27 @@ describe('StartTaskComponent', () => {
it('should enable start button if name is filled out', () => {
component.taskForm.controls['name'].setValue('fakeName');
fixture.detectChanges();
let createTaskButton = fixture.nativeElement.querySelector('#button-start');
const createTaskButton = fixture.nativeElement.querySelector('#button-start');
expect(createTaskButton.disabled).toBeFalsy();
});
it('should define the select options for Forms', () => {
component.forms$ = service.getFormList();
fixture.detectChanges();
let selectElement = fixture.nativeElement.querySelector('#form_label');
const selectElement = fixture.nativeElement.querySelector('#form_label');
expect(selectElement.innerHTML).toContain('ADF_TASK_LIST.START_TASK.FORM.LABEL.FORM');
});
it('should get formatted fullname', () => {
let testUser1 = { 'id': 1001, 'firstName': 'Wilbur', 'lastName': 'Adams', 'email': 'wilbur@app.activiti.com' };
let testUser2 = { 'id': 1002, 'firstName': '', 'lastName': 'Adams', 'email': 'adams@app.activiti.com' };
let testUser3 = { 'id': 1003, 'firstName': 'Wilbur', 'lastName': '', 'email': 'wilbur@app.activiti.com' };
let testUser4 = { 'id': 1004, 'firstName': '', 'lastName': '', 'email': 'test@app.activiti.com' };
const testUser1 = { 'id': 1001, 'firstName': 'Wilbur', 'lastName': 'Adams', 'email': 'wilbur@app.activiti.com' };
const testUser2 = { 'id': 1002, 'firstName': '', 'lastName': 'Adams', 'email': 'adams@app.activiti.com' };
const testUser3 = { 'id': 1003, 'firstName': 'Wilbur', 'lastName': '', 'email': 'wilbur@app.activiti.com' };
const testUser4 = { 'id': 1004, 'firstName': '', 'lastName': '', 'email': 'test@app.activiti.com' };
let testFullName1 = component.getDisplayUser(testUser1.firstName, testUser1.lastName, ' ');
let testFullName2 = component.getDisplayUser(testUser2.firstName, testUser2.lastName, ' ');
let testFullName3 = component.getDisplayUser(testUser3.firstName, testUser3.lastName, ' ');
let testFullName4 = component.getDisplayUser(testUser4.firstName, testUser4.lastName, ' ');
const testFullName1 = component.getDisplayUser(testUser1.firstName, testUser1.lastName, ' ');
const testFullName2 = component.getDisplayUser(testUser2.firstName, testUser2.lastName, ' ');
const testFullName3 = component.getDisplayUser(testUser3.firstName, testUser3.lastName, ' ');
const testFullName4 = component.getDisplayUser(testUser4.firstName, testUser4.lastName, ' ');
expect(testFullName1.trim()).toBe('Wilbur Adams');
expect(testFullName2.trim()).toBe('Adams');
@@ -365,9 +365,9 @@ describe('StartTaskComponent', () => {
it('should emit error when there is an error while creating task', () => {
component.taskForm.controls['name'].setValue('fakeName');
let errorSpy = spyOn(component.error, 'emit');
const errorSpy = spyOn(component.error, 'emit');
spyOn(service, 'createNewTask').and.returnValue(throwError({}));
let createTaskButton = <HTMLElement> element.querySelector('#button-start');
const createTaskButton = <HTMLElement> element.querySelector('#button-start');
fixture.detectChanges();
createTaskButton.click();
expect(errorSpy).toHaveBeenCalled();
@@ -377,7 +377,7 @@ describe('StartTaskComponent', () => {
component.maxTaskNameLength = 2;
component.ngOnInit();
fixture.detectChanges();
let name = component.taskForm.controls['name'];
const name = component.taskForm.controls['name'];
name.setValue('task');
fixture.detectChanges();
expect(name.valid).toBeFalsy();
@@ -388,7 +388,7 @@ describe('StartTaskComponent', () => {
it('should emit error when task name field is empty', () => {
fixture.detectChanges();
let name = component.taskForm.controls['name'];
const name = component.taskForm.controls['name'];
name.setValue('');
fixture.detectChanges();
expect(name.valid).toBeFalsy();
@@ -407,7 +407,7 @@ describe('StartTaskComponent', () => {
it('should emit error when description have only white spaces', () => {
fixture.detectChanges();
let description = component.taskForm.controls['description'];
const description = component.taskForm.controls['description'];
description.setValue(' ');
fixture.detectChanges();
expect(description.valid).toBeFalsy();

View File

@@ -61,7 +61,7 @@ describe('TaskAuditDirective', () => {
let service: TaskListService;
function createFakePdfBlob(): Blob {
let pdfData = atob(
const pdfData = atob(
'JVBERi0xLjcKCjEgMCBvYmogICUgZW50cnkgcG9pbnQKPDwKICAvVHlwZSAvQ2F0YWxvZwog' +
'IC9QYWdlcyAyIDAgUgo+PgplbmRvYmoKCjIgMCBvYmoKPDwKICAvVHlwZSAvUGFnZXMKICAv' +
'TWVkaWFCb3ggWyAwIDAgMjAwIDIwMCBdCiAgL0NvdW50IDEKICAvS2lkcyBbIDMgMCBSIF0K' +
@@ -99,13 +99,13 @@ describe('TaskAuditDirective', () => {
it('should fetch the pdf Blob when the format is pdf', fakeAsync(() => {
component.fileName = 'FakeAuditName';
component.format = 'pdf';
let blob = createFakePdfBlob();
const blob = createFakePdfBlob();
spyOn(service, 'fetchTaskAuditPdfById').and.returnValue(of(blob));
spyOn(component, 'onAuditClick').and.callThrough();
fixture.detectChanges();
let button = fixture.nativeElement.querySelector('#auditButton');
const button = fixture.nativeElement.querySelector('#auditButton');
fixture.whenStable().then(() => {
fixture.detectChanges();
@@ -127,7 +127,7 @@ describe('TaskAuditDirective', () => {
fixture.detectChanges();
let button = fixture.nativeElement.querySelector('#auditButton');
const button = fixture.nativeElement.querySelector('#auditButton');
fixture.whenStable().then(() => {
fixture.detectChanges();
@@ -141,13 +141,13 @@ describe('TaskAuditDirective', () => {
it('should fetch the pdf Blob as default when the format is UNKNOWN', fakeAsync(() => {
component.fileName = 'FakeAuditName';
component.format = 'fakeFormat';
let blob = createFakePdfBlob();
const blob = createFakePdfBlob();
spyOn(service, 'fetchTaskAuditPdfById').and.returnValue(of(blob));
spyOn(component, 'onAuditClick').and.callThrough();
fixture.detectChanges();
let button = fixture.nativeElement.querySelector('#auditButton');
const button = fixture.nativeElement.querySelector('#auditButton');
fixture.whenStable().then(() => {
fixture.detectChanges();

View File

@@ -286,19 +286,19 @@ describe('TaskDetailsComponent', () => {
});
it('should emit a save event when form saved', () => {
let emitSpy: jasmine.Spy = spyOn(component.formSaved, 'emit');
const emitSpy: jasmine.Spy = spyOn(component.formSaved, 'emit');
component.onFormSaved(new FormModel());
expect(emitSpy).toHaveBeenCalled();
});
it('should emit a outcome execution event when form outcome executed', () => {
let emitSpy: jasmine.Spy = spyOn(component.executeOutcome, 'emit');
const emitSpy: jasmine.Spy = spyOn(component.executeOutcome, 'emit');
component.onFormExecuteOutcome(new FormOutcomeEvent(new FormOutcomeModel(new FormModel())));
expect(emitSpy).toHaveBeenCalled();
});
it('should emit a complete event when form completed', () => {
let emitSpy: jasmine.Spy = spyOn(component.formCompleted, 'emit');
const emitSpy: jasmine.Spy = spyOn(component.formCompleted, 'emit');
component.onFormCompleted(new FormModel());
expect(emitSpy).toHaveBeenCalled();
});
@@ -316,7 +316,7 @@ describe('TaskDetailsComponent', () => {
});
it('should emit an error event if an error occurs fetching the next task', () => {
let emitSpy: jasmine.Spy = spyOn(component.error, 'emit');
const emitSpy: jasmine.Spy = spyOn(component.error, 'emit');
getTasksSpy.and.returnValue(throwError({}));
component.onComplete();
expect(emitSpy).toHaveBeenCalled();
@@ -334,7 +334,7 @@ describe('TaskDetailsComponent', () => {
});
it('should emit a complete event when complete button clicked and task completed', () => {
let emitSpy: jasmine.Spy = spyOn(component.formCompleted, 'emit');
const emitSpy: jasmine.Spy = spyOn(component.formCompleted, 'emit');
component.onComplete();
expect(emitSpy).toHaveBeenCalled();
});
@@ -345,13 +345,13 @@ describe('TaskDetailsComponent', () => {
});
it('should emit a load event when form loaded', () => {
let emitSpy: jasmine.Spy = spyOn(component.formLoaded, 'emit');
const emitSpy: jasmine.Spy = spyOn(component.formLoaded, 'emit');
component.onFormLoaded(new FormModel());
expect(emitSpy).toHaveBeenCalled();
});
it('should emit an error event when form error occurs', () => {
let emitSpy: jasmine.Spy = spyOn(component.error, 'emit');
const emitSpy: jasmine.Spy = spyOn(component.error, 'emit');
component.onFormError({});
expect(emitSpy).toHaveBeenCalled();
});
@@ -368,8 +368,8 @@ describe('TaskDetailsComponent', () => {
});
it('should emit a task created event when checklist task is created', () => {
let emitSpy: jasmine.Spy = spyOn(component.taskCreated, 'emit');
let mockTask = new TaskDetailsModel(taskDetailsMock);
const emitSpy: jasmine.Spy = spyOn(component.taskCreated, 'emit');
const mockTask = new TaskDetailsModel(taskDetailsMock);
component.onChecklistTaskCreated(mockTask);
expect(emitSpy).toHaveBeenCalled();
});

View File

@@ -212,7 +212,7 @@ export class TaskDetailsComponent implements OnInit, OnChanges {
}
ngOnChanges(changes: SimpleChanges): void {
let taskId = changes.taskId;
const taskId = changes.taskId;
this.showAssignee = false;
if (taskId && !taskId.currentValue) {
@@ -305,7 +305,7 @@ export class TaskDetailsComponent implements OnInit, OnChanges {
this.taskDetails.name = 'No name';
}
let endDate: any = res.endDate;
const endDate: any = res.endDate;
if (endDate && !isNaN(endDate.getTime())) {
this.internalReadOnlyForm = true;
} else {
@@ -369,7 +369,7 @@ export class TaskDetailsComponent implements OnInit, OnChanges {
* @param processDefinitionId
*/
private loadNextTask(processInstanceId: string, processDefinitionId: string): void {
let requestNode = new TaskQueryRequestRepresentationModel(
const requestNode = new TaskQueryRequestRepresentationModel(
{
processInstanceId: processInstanceId,
processDefinitionId: processDefinitionId

View File

@@ -32,7 +32,7 @@ describe('TaskFiltersComponent', () => {
let taskFilterService: TaskFilterService;
let appsProcessService: AppsProcessService;
let fakeGlobalFilter = [];
const fakeGlobalFilter = [];
fakeGlobalFilter.push(new FilterRepresentationModel({
name: 'FakeInvolvedTasks',
icon: 'glyphicon-align-left',
@@ -52,23 +52,23 @@ describe('TaskFiltersComponent', () => {
filter: { state: 'open', assignment: 'fake-assignee' }
}));
let fakeGlobalFilterPromise = new Promise(function (resolve, reject) {
const fakeGlobalFilterPromise = new Promise(function (resolve, reject) {
resolve(fakeGlobalFilter);
});
let fakeGlobalEmptyFilter = {
const fakeGlobalEmptyFilter = {
message: 'invalid data'
};
let fakeGlobalEmptyFilterPromise = new Promise(function (resolve, reject) {
const fakeGlobalEmptyFilterPromise = new Promise(function (resolve, reject) {
resolve(fakeGlobalEmptyFilter);
});
let mockErrorFilterList = {
const mockErrorFilterList = {
error: 'wrong request'
};
let mockErrorFilterPromise = Promise.reject(mockErrorFilterList);
const mockErrorFilterPromise = Promise.reject(mockErrorFilterList);
let component: TaskFiltersComponent;
let fixture: ComponentFixture<TaskFiltersComponent>;
@@ -80,7 +80,7 @@ describe('TaskFiltersComponent', () => {
});
beforeEach(() => {
let appConfig: AppConfigService = TestBed.get(AppConfigService);
const appConfig: AppConfigService = TestBed.get(AppConfigService);
appConfig.config.bpmHost = 'http://localhost:9876/bpm';
fixture = TestBed.createComponent(TaskFiltersComponent);
@@ -95,7 +95,7 @@ describe('TaskFiltersComponent', () => {
spyOn(taskFilterService, 'getTaskListFilters').and.returnValue(from(mockErrorFilterPromise));
const appId = '1';
let change = new SimpleChange(null, appId, true);
const change = new SimpleChange(null, appId, true);
component.ngOnChanges({ 'appId': change });
component.error.subscribe((err) => {
@@ -108,7 +108,7 @@ describe('TaskFiltersComponent', () => {
it('should return the filter task list', (done) => {
spyOn(taskFilterService, 'getTaskListFilters').and.returnValue(from(fakeGlobalFilterPromise));
const appId = '1';
let change = new SimpleChange(null, appId, true);
const change = new SimpleChange(null, appId, true);
component.ngOnChanges({ 'appId': change });
component.success.subscribe((res) => {
@@ -126,18 +126,18 @@ describe('TaskFiltersComponent', () => {
it('should return the filter task list, filtered By Name', (done) => {
let fakeDeployedApplicationsPromise = new Promise(function (resolve, reject) {
const fakeDeployedApplicationsPromise = new Promise(function (resolve, reject) {
resolve({});
});
spyOn(appsProcessService, 'getDeployedApplicationsByName').and.returnValue(from(fakeDeployedApplicationsPromise));
spyOn(taskFilterService, 'getTaskListFilters').and.returnValue(from(fakeGlobalFilterPromise));
let change = new SimpleChange(null, 'test', true);
const change = new SimpleChange(null, 'test', true);
component.ngOnChanges({ 'appName': change });
component.success.subscribe((res) => {
let deployApp: any = appsProcessService.getDeployedApplicationsByName;
const deployApp: any = appsProcessService.getDeployedApplicationsByName;
expect(deployApp.calls.count()).toEqual(1);
expect(res).toBeDefined();
done();
@@ -150,7 +150,7 @@ describe('TaskFiltersComponent', () => {
spyOn(taskFilterService, 'getTaskListFilters').and.returnValue(from(fakeGlobalFilterPromise));
const appId = '1';
let change = new SimpleChange(null, appId, true);
const change = new SimpleChange(null, appId, true);
fixture.detectChanges();
component.ngOnChanges({ 'appId': change });
@@ -169,7 +169,7 @@ describe('TaskFiltersComponent', () => {
spyOn(component, 'createFiltersByAppId').and.stub();
const appId = '1';
let change = new SimpleChange(null, appId, true);
const change = new SimpleChange(null, appId, true);
component.ngOnChanges({ 'appId': change });
component.success.subscribe((res) => {
@@ -184,7 +184,7 @@ describe('TaskFiltersComponent', () => {
component.filterParam = new FilterParamsModel({ name: 'FakeMyTasks1' });
const appId = '1';
let change = new SimpleChange(null, appId, true);
const change = new SimpleChange(null, appId, true);
fixture.detectChanges();
component.ngOnChanges({ 'appId': change });
@@ -204,7 +204,7 @@ describe('TaskFiltersComponent', () => {
component.filterParam = new FilterParamsModel({ name: 'UnexistableFilter' });
const appId = '1';
let change = new SimpleChange(null, appId, true);
const change = new SimpleChange(null, appId, true);
fixture.detectChanges();
component.ngOnChanges({ 'appId': change });
@@ -224,7 +224,7 @@ describe('TaskFiltersComponent', () => {
component.filterParam = new FilterParamsModel({ index: 2 });
const appId = '1';
let change = new SimpleChange(null, appId, true);
const change = new SimpleChange(null, appId, true);
fixture.detectChanges();
component.ngOnChanges({ 'appId': change });
@@ -244,7 +244,7 @@ describe('TaskFiltersComponent', () => {
component.filterParam = new FilterParamsModel({ id: 10 });
const appId = '1';
let change = new SimpleChange(null, appId, true);
const change = new SimpleChange(null, appId, true);
fixture.detectChanges();
component.ngOnChanges({ 'appId': change });
@@ -259,7 +259,7 @@ describe('TaskFiltersComponent', () => {
});
it('should emit an event when a filter is selected', (done) => {
let currentFilter = fakeGlobalFilter[0];
const currentFilter = fakeGlobalFilter[0];
component.filters = fakeGlobalFilter;
component.filterClick.subscribe((filter: FilterRepresentationModel) => {
expect(filter).toBeDefined();
@@ -275,7 +275,7 @@ describe('TaskFiltersComponent', () => {
spyOn(component, 'getFiltersByAppId').and.stub();
const appId = '1';
let change = new SimpleChange(null, appId, true);
const change = new SimpleChange(null, appId, true);
component.ngOnChanges({ 'appId': change });
expect(component.getFiltersByAppId).toHaveBeenCalledWith(appId);
@@ -285,7 +285,7 @@ describe('TaskFiltersComponent', () => {
spyOn(component, 'getFiltersByAppId').and.stub();
const appId = null;
let change = new SimpleChange(undefined, appId, true);
const change = new SimpleChange(undefined, appId, true);
component.ngOnChanges({ 'appId': change });
expect(component.getFiltersByAppId).toHaveBeenCalledWith(appId);
@@ -318,14 +318,14 @@ describe('TaskFiltersComponent', () => {
spyOn(component, 'getFiltersByAppName').and.stub();
const appName = 'fake-app-name';
let change = new SimpleChange(null, appName, true);
const change = new SimpleChange(null, appName, true);
component.ngOnChanges({ 'appName': change });
expect(component.getFiltersByAppName).toHaveBeenCalledWith(appName);
});
it('should return the current filter after one is selected', () => {
let filter = fakeGlobalFilter[1];
const filter = fakeGlobalFilter[1];
component.filters = fakeGlobalFilter;
expect(component.currentFilter).toBeUndefined();
@@ -336,14 +336,14 @@ describe('TaskFiltersComponent', () => {
it('should load default list when app id is null', () => {
spyOn(component, 'getFiltersByAppId').and.stub();
let change = new SimpleChange(undefined, null, true);
const change = new SimpleChange(undefined, null, true);
component.ngOnChanges({ 'appId': change });
expect(component.getFiltersByAppId).toHaveBeenCalled();
});
it('should not change the current filter if no filter with taskid is found', async(() => {
let filter = new FilterRepresentationModel({
const filter = new FilterRepresentationModel({
name: 'FakeMyTasks',
filter: { state: 'open', assignment: 'fake-assignee' }
});
@@ -358,13 +358,13 @@ describe('TaskFiltersComponent', () => {
it('should attach specific icon for each filter if showIcon is true', (done) => {
spyOn(taskFilterService, 'getTaskListFilters').and.returnValue(from(fakeGlobalFilterPromise));
component.showIcon = true;
let change = new SimpleChange(undefined, 1, true);
const change = new SimpleChange(undefined, 1, true);
component.ngOnChanges({ 'appId': change });
fixture.detectChanges();
fixture.whenStable().then(() => {
fixture.detectChanges();
expect(component.filters.length).toBe(3);
let filters: any = fixture.debugElement.queryAll(By.css('.adf-filters__entry-icon'));
const filters: any = fixture.debugElement.queryAll(By.css('.adf-filters__entry-icon'));
expect(filters.length).toBe(3);
expect(filters[0].nativeElement.innerText).toContain('format_align_left');
expect(filters[1].nativeElement.innerText).toContain('check_circle');
@@ -376,12 +376,12 @@ describe('TaskFiltersComponent', () => {
it('should not attach icons for each filter if showIcon is false', (done) => {
spyOn(taskFilterService, 'getTaskListFilters').and.returnValue(from(fakeGlobalFilterPromise));
component.showIcon = false;
let change = new SimpleChange(undefined, 1, true);
const change = new SimpleChange(undefined, 1, true);
component.ngOnChanges({ 'appId': change });
fixture.detectChanges();
fixture.whenStable().then(() => {
fixture.detectChanges();
let filters: any = fixture.debugElement.queryAll(By.css('.adf-filters__entry-icon'));
const filters: any = fixture.debugElement.queryAll(By.css('.adf-filters__entry-icon'));
expect(filters.length).toBe(0);
done();
});

View File

@@ -181,7 +181,7 @@ export class TaskFiltersComponent implements OnInit, OnChanges {
* @param taskId
*/
public selectFilterWithTask(taskId: string) {
let filteredFilterList: FilterRepresentationModel[] = [];
const filteredFilterList: FilterRepresentationModel[] = [];
this.taskListService.getFilterForTaskById(taskId, this.filters).subscribe(
(filter: FilterRepresentationModel) => {
filteredFilterList.push(filter);

View File

@@ -42,7 +42,7 @@ describe('TaskHeaderComponent', () => {
let userBpmService: BpmUserService;
let appConfigService: AppConfigService;
let fakeBpmAssignedUser = {
const fakeBpmAssignedUser = {
id: 1001,
apps: [],
capabilities: 'fake-capability',
@@ -83,7 +83,7 @@ describe('TaskHeaderComponent', () => {
fixture.detectChanges();
fixture.whenStable().then(() => {
let formNameEl = fixture.debugElement.query(By.css('[data-automation-id="header-assignee"] .adf-textitem-clickable-value'));
const formNameEl = fixture.debugElement.query(By.css('[data-automation-id="header-assignee"] .adf-textitem-clickable-value'));
expect(formNameEl.nativeElement.innerText).toBe('Wilbur Adams');
});
}));
@@ -93,8 +93,8 @@ describe('TaskHeaderComponent', () => {
fixture.detectChanges();
fixture.whenStable().then(() => {
let formNameEl = fixture.debugElement.query(By.css('[data-automation-id="header-assignee"] .adf-textitem-clickable-value'));
let iconE = fixture.debugElement.query(By.css(`[data-automation-id="card-textitem-edit-icon-create"]`));
const formNameEl = fixture.debugElement.query(By.css('[data-automation-id="header-assignee"] .adf-textitem-clickable-value'));
const iconE = fixture.debugElement.query(By.css(`[data-automation-id="card-textitem-edit-icon-create"]`));
expect(formNameEl).not.toBeNull();
expect(iconE).not.toBeNull();
expect(formNameEl.nativeElement.innerText).toBe('Wilbur Adams');
@@ -108,7 +108,7 @@ describe('TaskHeaderComponent', () => {
fixture.detectChanges();
fixture.whenStable().then(() => {
let valueEl = fixture.debugElement.query(By.css('[data-automation-id="header-assignee"] .adf-textitem-clickable-value'));
const valueEl = fixture.debugElement.query(By.css('[data-automation-id="header-assignee"] .adf-textitem-clickable-value'));
expect(valueEl.nativeElement.innerText).toBe('ADF_TASK_LIST.PROPERTIES.ASSIGNEE_DEFAULT');
});
@@ -120,7 +120,7 @@ describe('TaskHeaderComponent', () => {
fixture.detectChanges();
fixture.whenStable().then(() => {
let formNameEl = fixture.debugElement.query(By.css('[data-automation-id="card-textitem-value-priority"]'));
const formNameEl = fixture.debugElement.query(By.css('[data-automation-id="card-textitem-value-priority"]'));
expect(formNameEl.nativeElement.innerText).toBe('27');
});
}));
@@ -131,7 +131,7 @@ describe('TaskHeaderComponent', () => {
fixture.detectChanges();
fixture.whenStable().then(() => {
let datePicker = fixture.debugElement.query(By.css(`[data-automation-id="datepicker-dueDate"]`));
const datePicker = fixture.debugElement.query(By.css(`[data-automation-id="datepicker-dueDate"]`));
expect(datePicker).toBeNull('Datepicker should NOT be in DOM');
});
}));
@@ -142,7 +142,7 @@ describe('TaskHeaderComponent', () => {
fixture.detectChanges();
fixture.whenStable().then(() => {
let datePicker = fixture.debugElement.query(By.css(`[data-automation-id="datepicker-dueDate"]`));
const datePicker = fixture.debugElement.query(By.css(`[data-automation-id="datepicker-dueDate"]`));
expect(datePicker).not.toBeNull('Datepicker should be in DOM');
});
}));
@@ -156,7 +156,7 @@ describe('TaskHeaderComponent', () => {
fixture.detectChanges();
fixture.whenStable().then(() => {
let claimButton = fixture.debugElement.query(By.css('[data-automation-id="header-claim-button"]'));
const claimButton = fixture.debugElement.query(By.css('[data-automation-id="header-claim-button"]'));
expect(claimButton.nativeElement.innerText).toBe('ADF_TASK_LIST.DETAILS.BUTTON.CLAIM');
});
}));
@@ -167,7 +167,7 @@ describe('TaskHeaderComponent', () => {
fixture.detectChanges();
fixture.whenStable().then(() => {
let claimButton = fixture.debugElement.query(By.css('[data-automation-id="header-claim-button"]'));
const claimButton = fixture.debugElement.query(By.css('[data-automation-id="header-claim-button"]'));
expect(component.isTaskClaimable()).toBeTruthy();
expect(claimButton.nativeElement.innerText).toBe('ADF_TASK_LIST.DETAILS.BUTTON.CLAIM');
});
@@ -180,8 +180,8 @@ describe('TaskHeaderComponent', () => {
fixture.detectChanges();
fixture.whenStable().then(() => {
let claimButton = fixture.debugElement.query(By.css('[data-automation-id="header-claim-button"]'));
let unclaimButton = fixture.debugElement.query(By.css('[data-automation-id="header-unclaim-button"]'));
const claimButton = fixture.debugElement.query(By.css('[data-automation-id="header-claim-button"]'));
const unclaimButton = fixture.debugElement.query(By.css('[data-automation-id="header-unclaim-button"]'));
expect(component.isTaskClaimable()).toBeFalsy();
expect(component.isTaskClaimedByCandidateMember()).toBeFalsy();
expect(unclaimButton).toBeNull();
@@ -196,7 +196,7 @@ describe('TaskHeaderComponent', () => {
fixture.detectChanges();
fixture.whenStable().then(() => {
let unclaimButton = fixture.debugElement.query(By.css('[data-automation-id="header-unclaim-button"]'));
const unclaimButton = fixture.debugElement.query(By.css('[data-automation-id="header-unclaim-button"]'));
expect(component.isTaskClaimedByCandidateMember()).toBeTruthy();
expect(unclaimButton.nativeElement.innerText).toBe('ADF_TASK_LIST.DETAILS.BUTTON.UNCLAIM');
});
@@ -208,7 +208,7 @@ describe('TaskHeaderComponent', () => {
fixture.detectChanges();
fixture.whenStable().then(() => {
let unclaimButton = fixture.debugElement.query(By.css('[data-automation-id="header-unclaim-button"]'));
const unclaimButton = fixture.debugElement.query(By.css('[data-automation-id="header-unclaim-button"]'));
expect(component.isTaskClaimedByCandidateMember()).toBeFalsy();
expect(unclaimButton).toBeNull();
});
@@ -220,7 +220,7 @@ describe('TaskHeaderComponent', () => {
fixture.detectChanges();
fixture.whenStable().then(() => {
let claimButton = fixture.debugElement.query(By.css('[data-automation-id="header-claim-button"]'));
const claimButton = fixture.debugElement.query(By.css('[data-automation-id="header-claim-button"]'));
expect(component.isTaskClaimable()).toBeTruthy();
expect(component.isTaskClaimedByCandidateMember()).toBeFalsy();
expect(claimButton.nativeElement.innerText).toBe('ADF_TASK_LIST.DETAILS.BUTTON.CLAIM');
@@ -233,8 +233,8 @@ describe('TaskHeaderComponent', () => {
fixture.detectChanges();
fixture.whenStable().then(() => {
let claimButton = fixture.debugElement.query(By.css('[data-automation-id="header-claim-button"]'));
let unclaimButton = fixture.debugElement.query(By.css('[data-automation-id="header-unclaim-button"]'));
const claimButton = fixture.debugElement.query(By.css('[data-automation-id="header-claim-button"]'));
const unclaimButton = fixture.debugElement.query(By.css('[data-automation-id="header-unclaim-button"]'));
expect(claimButton).toBeNull();
expect(unclaimButton).toBeNull();
});
@@ -247,7 +247,7 @@ describe('TaskHeaderComponent', () => {
fixture.detectChanges();
fixture.whenStable().then(() => {
let unclaimButton = fixture.debugElement.query(By.css('[data-automation-id="header-unclaim-button"]'));
const unclaimButton = fixture.debugElement.query(By.css('[data-automation-id="header-unclaim-button"]'));
unclaimButton.triggerEventHandler('click', {});
expect(service.unclaimTask).toHaveBeenCalledWith('91');
@@ -266,7 +266,7 @@ describe('TaskHeaderComponent', () => {
unclaimed = true;
});
let unclaimButton = fixture.debugElement.query(By.css('[data-automation-id="header-unclaim-button"]'));
const unclaimButton = fixture.debugElement.query(By.css('[data-automation-id="header-unclaim-button"]'));
unclaimButton.triggerEventHandler('click', {});
expect(unclaimed).toBeTruthy();
@@ -279,7 +279,7 @@ describe('TaskHeaderComponent', () => {
fixture.detectChanges();
fixture.whenStable().then(() => {
let valueEl = fixture.debugElement.query(By.css('[data-automation-id="header-dueDate"] .adf-property-value'));
const valueEl = fixture.debugElement.query(By.css('[data-automation-id="header-dueDate"] .adf-property-value'));
expect(valueEl.nativeElement.innerText.trim()).toBe('Nov 03 2016');
});
}));
@@ -290,7 +290,7 @@ describe('TaskHeaderComponent', () => {
fixture.detectChanges();
fixture.whenStable().then(() => {
let valueEl = fixture.debugElement.query(By.css('[data-automation-id="header-dueDate"] .adf-property-value'));
const valueEl = fixture.debugElement.query(By.css('[data-automation-id="header-dueDate"] .adf-property-value'));
expect(valueEl.nativeElement.innerText.trim()).toBe('ADF_TASK_LIST.PROPERTIES.DUE_DATE_DEFAULT');
});
}));
@@ -301,7 +301,7 @@ describe('TaskHeaderComponent', () => {
fixture.detectChanges();
fixture.whenStable().then(() => {
let valueEl = fixture.debugElement.query(By.css('[data-automation-id="header-formName"] .adf-textitem-clickable-value'));
const valueEl = fixture.debugElement.query(By.css('[data-automation-id="header-formName"] .adf-textitem-clickable-value'));
expect(valueEl.nativeElement.innerText).toBe('test form');
});
}));
@@ -312,7 +312,7 @@ describe('TaskHeaderComponent', () => {
fixture.detectChanges();
fixture.whenStable().then(() => {
let valueEl = fixture.debugElement.query(By.css('[data-automation-id="header-parentName"] .adf-property-value'));
const valueEl = fixture.debugElement.query(By.css('[data-automation-id="header-parentName"] .adf-property-value'));
expect(valueEl.nativeElement.innerText.trim()).toEqual('ADF_TASK_LIST.PROPERTIES.PARENT_NAME_DEFAULT');
});
}));
@@ -324,7 +324,7 @@ describe('TaskHeaderComponent', () => {
fixture.detectChanges();
fixture.whenStable().then(() => {
let valueEl = fixture.debugElement.query(By.css('[data-automation-id="header-parentName"] .adf-property-value'));
const valueEl = fixture.debugElement.query(By.css('[data-automation-id="header-parentName"] .adf-property-value'));
expect(valueEl.nativeElement.innerText.trim()).toEqual('Parent Name');
});
}));
@@ -334,7 +334,7 @@ describe('TaskHeaderComponent', () => {
fixture.detectChanges();
fixture.whenStable().then(() => {
let valueEl = fixture.debugElement.query(By.css('[data-automation-id="header-formName"] .adf-property-value'));
const valueEl = fixture.debugElement.query(By.css('[data-automation-id="header-formName"] .adf-property-value'));
expect(valueEl.nativeElement.innerText).toBe('ADF_TASK_LIST.PROPERTIES.FORM_NAME_DEFAULT');
});
}));
@@ -347,7 +347,7 @@ describe('TaskHeaderComponent', () => {
component.taskDetails.processDefinitionName = 'Parent Name';
component.refreshData();
fixture.detectChanges();
let propertyList = fixture.debugElement.queryAll(By.css('.adf-property-list .adf-property'));
const propertyList = fixture.debugElement.queryAll(By.css('.adf-property-list .adf-property'));
fixture.whenStable().then(() => {
expect(propertyList).toBeDefined();
@@ -366,7 +366,7 @@ describe('TaskHeaderComponent', () => {
fixture.detectChanges();
fixture.whenStable().then(() => {
let propertyList = fixture.debugElement.queryAll(By.css('.adf-property-list .adf-property'));
const propertyList = fixture.debugElement.queryAll(By.css('.adf-property-list .adf-property'));
expect(propertyList).toBeDefined();
expect(propertyList).not.toBeNull();
expect(propertyList.length).toBe(component.properties.length);

View File

@@ -107,9 +107,9 @@ describe('TaskListComponent', () => {
});
it('should return the filtered task list when the input parameters are passed', (done) => {
let state = new SimpleChange(null, 'open', true);
let processDefinitionKey = new SimpleChange(null, null, true);
let assignment = new SimpleChange(null, 'fake-assignee', true);
const state = new SimpleChange(null, 'open', true);
const processDefinitionKey = new SimpleChange(null, null, true);
const assignment = new SimpleChange(null, 'fake-assignee', true);
component.success.subscribe((res) => {
expect(res).toBeDefined();
@@ -151,10 +151,10 @@ describe('TaskListComponent', () => {
});
it('should return the filtered task list by processDefinitionKey', (done) => {
let state = new SimpleChange(null, 'open', true);
const state = new SimpleChange(null, 'open', true);
/* cspell:disable-next-line */
let processDefinitionKey = new SimpleChange(null, 'fakeprocess', true);
let assignment = new SimpleChange(null, 'fake-assignee', true);
const processDefinitionKey = new SimpleChange(null, 'fakeprocess', true);
const assignment = new SimpleChange(null, 'fake-assignee', true);
component.success.subscribe((res) => {
expect(res).toBeDefined();
@@ -177,9 +177,9 @@ describe('TaskListComponent', () => {
});
it('should return the filtered task list by processInstanceId', (done) => {
let state = new SimpleChange(null, 'open', true);
let processInstanceId = new SimpleChange(null, 'fakeprocessId', true);
let assignment = new SimpleChange(null, 'fake-assignee', true);
const state = new SimpleChange(null, 'open', true);
const processInstanceId = new SimpleChange(null, 'fakeprocessId', true);
const assignment = new SimpleChange(null, 'fake-assignee', true);
component.success.subscribe((res) => {
expect(res).toBeDefined();
@@ -203,9 +203,9 @@ describe('TaskListComponent', () => {
});
it('should return the filtered task list by processDefinitionId', (done) => {
let state = new SimpleChange(null, 'open', true);
let processDefinitionId = new SimpleChange(null, 'fakeprocessDefinitionId', true);
let assignment = new SimpleChange(null, 'fake-assignee', true);
const state = new SimpleChange(null, 'open', true);
const processDefinitionId = new SimpleChange(null, 'fakeprocessDefinitionId', true);
const assignment = new SimpleChange(null, 'fake-assignee', true);
component.success.subscribe((res) => {
expect(res).toBeDefined();
@@ -229,8 +229,8 @@ describe('TaskListComponent', () => {
});
it('should return the filtered task list by created date', (done) => {
let state = new SimpleChange(null, 'open', true);
let afterDate = new SimpleChange(null, '28-02-2017', true);
const state = new SimpleChange(null, 'open', true);
const afterDate = new SimpleChange(null, '28-02-2017', true);
component.success.subscribe((res) => {
expect(res).toBeDefined();
expect(component.rows).toBeDefined();
@@ -251,9 +251,9 @@ describe('TaskListComponent', () => {
});
it('should return the filtered task list for all state', (done) => {
let state = new SimpleChange(null, 'all', true);
const state = new SimpleChange(null, 'all', true);
/* cspell:disable-next-line */
let processInstanceId = new SimpleChange(null, 'fakeprocessId', true);
const processInstanceId = new SimpleChange(null, 'fakeprocessId', true);
component.success.subscribe((res) => {
expect(res).toBeDefined();
@@ -317,10 +317,10 @@ describe('TaskListComponent', () => {
});
it('should emit row click event', (done) => {
let row = new ObjectDataRow({
const row = new ObjectDataRow({
id: '999'
});
let rowEvent = new DataRowEvent(row, null);
const rowEvent = new DataRowEvent(row, null);
component.rowClick.subscribe((taskId) => {
expect(taskId).toEqual('999');
@@ -344,7 +344,7 @@ describe('TaskListComponent', () => {
component.rows = [{ id: '999', name: 'Fake-name' }];
const landingTaskId = '999';
let change = new SimpleChange(null, landingTaskId, true);
const change = new SimpleChange(null, landingTaskId, true);
component.ngOnChanges({'landingTaskId': change});
expect(component.reload).not.toHaveBeenCalled();
expect(component.rows.length).toEqual(1);
@@ -354,7 +354,7 @@ describe('TaskListComponent', () => {
component.currentInstanceId = '999';
component.rows = [{ id: '999', name: 'Fake-name' }];
const landingTaskId = '888';
let change = new SimpleChange(null, landingTaskId, true);
const change = new SimpleChange(null, landingTaskId, true);
component.success.subscribe((res) => {
expect(res).toBeDefined();
@@ -381,7 +381,7 @@ describe('TaskListComponent', () => {
it('should reload the list when the appId parameter changes', (done) => {
const appId = '1';
let change = new SimpleChange(null, appId, true);
const change = new SimpleChange(null, appId, true);
component.success.subscribe((res) => {
expect(res).toBeDefined();
@@ -402,7 +402,7 @@ describe('TaskListComponent', () => {
it('should reload the list when the processDefinitionKey parameter changes', (done) => {
const processDefinitionKey = 'fakeprocess';
let change = new SimpleChange(null, processDefinitionKey, true);
const change = new SimpleChange(null, processDefinitionKey, true);
component.success.subscribe((res) => {
expect(res).toBeDefined();
@@ -424,7 +424,7 @@ describe('TaskListComponent', () => {
it('should reload the list when the state parameter changes', (done) => {
const state = 'open';
let change = new SimpleChange(null, state, true);
const change = new SimpleChange(null, state, true);
component.success.subscribe((res) => {
expect(res).toBeDefined();
@@ -446,7 +446,7 @@ describe('TaskListComponent', () => {
it('should reload the list when the sort parameter changes', (done) => {
const sort = 'desc';
let change = new SimpleChange(null, sort, true);
const change = new SimpleChange(null, sort, true);
component.success.subscribe((res) => {
expect(res).toBeDefined();
@@ -468,7 +468,7 @@ describe('TaskListComponent', () => {
it('should reload the process list when the name parameter changes', (done) => {
const name = 'FakeTaskName';
let change = new SimpleChange(null, name, true);
const change = new SimpleChange(null, name, true);
component.success.subscribe((res) => {
expect(res).toBeDefined();
@@ -490,7 +490,7 @@ describe('TaskListComponent', () => {
it('should reload the list when the assignment parameter changes', (done) => {
const assignment = 'assignee';
let change = new SimpleChange(null, assignment, true);
const change = new SimpleChange(null, assignment, true);
component.success.subscribe((res) => {
expect(res).toBeDefined();

View File

@@ -220,9 +220,9 @@ export class TaskListComponent extends DataTableSchema implements OnChanges, Aft
private isPropertyChanged(changes: SimpleChanges): boolean {
let changed: boolean = true;
let landingTaskId = changes['landingTaskId'];
let page = changes['page'];
let size = changes['size'];
const landingTaskId = changes['landingTaskId'];
const page = changes['page'];
const size = changes['size'];
if (landingTaskId && landingTaskId.currentValue && this.isEqualToCurrentId(landingTaskId.currentValue)) {
changed = false;
} else if (page && page.currentValue !== page.previousValue) {
@@ -353,7 +353,7 @@ export class TaskListComponent extends DataTableSchema implements OnChanges, Aft
private createRequestNode() {
let requestNode = {
const requestNode = {
appDefinitionId: this.appId,
dueAfter: this.dueAfter ? moment(this.dueAfter).toDate() : null,
dueBefore: this.dueBefore ? moment(this.dueBefore).toDate() : null,

View File

@@ -98,8 +98,8 @@ export class TaskDetailsModel implements TaskRepresentation {
let fullName: string = '';
if (this.assignee) {
let firstName: string = this.assignee.firstName ? this.assignee.firstName : '';
let lastName: string = this.assignee.lastName ? this.assignee.lastName : '';
const firstName: string = this.assignee.firstName ? this.assignee.firstName : '';
const lastName: string = this.assignee.lastName ? this.assignee.lastName : '';
fullName = `${firstName} ${lastName}`;
}

View File

@@ -29,11 +29,11 @@ export class ProcessUploadService extends UploadService {
}
getUploadPromise(file: any): any {
let opts = {
const opts = {
isRelatedContent: true
};
let processInstanceId = file.options.parentId;
let promise = this.apiService.getInstance().activiti.contentApi.createRelatedContentOnProcessInstance(processInstanceId, file.file, opts);
const processInstanceId = file.options.parentId;
const promise = this.apiService.getInstance().activiti.contentApi.createRelatedContentOnProcessInstance(processInstanceId, file.file, opts);
promise.catch((err) => this.handleError(err));

View File

@@ -100,7 +100,7 @@ describe('Activiti Task filter Service', () => {
it('should call the api with the appId', (done) => {
spyOn(service, 'callApiTaskFilters').and.returnValue((fakeAppPromise));
let appId = 1;
const appId = 1;
service.getTaskListFilters(appId).subscribe((res) => {
expect(service.callApiTaskFilters).toHaveBeenCalledWith(appId);
done();
@@ -108,7 +108,7 @@ describe('Activiti Task filter Service', () => {
});
it('should return the app filter by id', (done) => {
let appId = 1;
const appId = 1;
service.getTaskListFilters(appId).subscribe((res) => {
expect(res).toBeDefined();
expect(res.length).toEqual(1);
@@ -172,7 +172,7 @@ describe('Activiti Task filter Service', () => {
});
it('should add a filter', (done) => {
let filterFake = new FilterRepresentationModel({
const filterFake = new FilterRepresentationModel({
name: 'FakeNameFilter',
assignment: 'fake-assignment'
});

View File

@@ -36,17 +36,17 @@ export class TaskFilterService {
* @returns Array of default filters just created
*/
public createDefaultFilters(appId: number): Observable<FilterRepresentationModel[]> {
let involvedTasksFilter = this.getInvolvedTasksFilterInstance(appId);
let involvedObservable = this.addFilter(involvedTasksFilter);
const involvedTasksFilter = this.getInvolvedTasksFilterInstance(appId);
const involvedObservable = this.addFilter(involvedTasksFilter);
let myTasksFilter = this.getMyTasksFilterInstance(appId);
let myTaskObservable = this.addFilter(myTasksFilter);
const myTasksFilter = this.getMyTasksFilterInstance(appId);
const myTaskObservable = this.addFilter(myTasksFilter);
let queuedTasksFilter = this.getQueuedTasksFilterInstance(appId);
let queuedObservable = this.addFilter(queuedTasksFilter);
const queuedTasksFilter = this.getQueuedTasksFilterInstance(appId);
const queuedObservable = this.addFilter(queuedTasksFilter);
let completedTasksFilter = this.getCompletedTasksFilterInstance(appId);
let completeObservable = this.addFilter(completedTasksFilter);
const completedTasksFilter = this.getCompletedTasksFilterInstance(appId);
const completeObservable = this.addFilter(completedTasksFilter);
return new Observable((observer) => {
forkJoin(
@@ -56,7 +56,7 @@ export class TaskFilterService {
completeObservable
).subscribe(
(res) => {
let filters: FilterRepresentationModel[] = [];
const filters: FilterRepresentationModel[] = [];
res.forEach((filter) => {
if (filter.name === involvedTasksFilter.name) {
involvedTasksFilter.id = filter.id;

View File

@@ -29,11 +29,11 @@ export class TaskUploadService extends UploadService {
}
getUploadPromise(file: any): any {
let opts = {
const opts = {
isRelatedContent: true
};
let taskId = file.options.parentId;
let promise = this.apiService.getInstance().activiti.contentApi.createRelatedContentOnTask(taskId, file.file, opts);
const taskId = file.options.parentId;
const promise = this.apiService.getInstance().activiti.contentApi.createRelatedContentOnTask(taskId, file.file, opts);
promise.catch((err) => this.handleError(err));

View File

@@ -255,7 +255,7 @@ describe('Activiti TaskList Service', () => {
});
it('should add a task ', (done) => {
let taskFake = new TaskDetailsModel({
const taskFake = new TaskDetailsModel({
id: 123,
parentTaskId: 456,
name: 'FakeNameTask',
@@ -324,7 +324,7 @@ describe('Activiti TaskList Service', () => {
});
it('should create a new standalone task ', (done) => {
let taskFake = new TaskDetailsModel({
const taskFake = new TaskDetailsModel({
name: 'FakeNameTask',
description: 'FakeDescription',
category: '3'
@@ -355,7 +355,7 @@ describe('Activiti TaskList Service', () => {
});
it('should assign task to a user', (done) => {
let testTaskId = '8888';
const testTaskId = '8888';
service.assignTask(testTaskId, fakeUser2).subscribe((res: TaskDetailsModel) => {
expect(res).toBeDefined();
expect(res.id).toEqual(testTaskId);
@@ -389,7 +389,7 @@ describe('Activiti TaskList Service', () => {
});
it('should assign task to a userId', (done) => {
let testTaskId = '8888';
const testTaskId = '8888';
service.assignTaskByUserId(testTaskId, fakeUser2.id.toString()).subscribe((res: TaskDetailsModel) => {
expect(res).toBeDefined();
expect(res.id).toEqual(testTaskId);
@@ -421,7 +421,7 @@ describe('Activiti TaskList Service', () => {
});
it('should claim a task', (done) => {
let taskId = '111';
const taskId = '111';
service.claimTask(taskId).subscribe(() => {
done();
@@ -435,7 +435,7 @@ describe('Activiti TaskList Service', () => {
});
it('should unclaim a task', (done) => {
let taskId = '111';
const taskId = '111';
service.unclaimTask(taskId).subscribe(() => {
done();
@@ -449,7 +449,7 @@ describe('Activiti TaskList Service', () => {
});
it('should update a task', (done) => {
let taskId = '111';
const taskId = '111';
service.updateTask(taskId, { property: 'value' }).subscribe(() => {
done();
@@ -463,8 +463,8 @@ describe('Activiti TaskList Service', () => {
});
it('should return the filter if it contains task id', (done) => {
let taskId = '1';
let filterFake = new FilterRepresentationModel({
const taskId = '1';
const filterFake = new FilterRepresentationModel({
name: 'FakeNameFilter',
assignment: 'fake-assignment',
filter: {
@@ -489,9 +489,9 @@ describe('Activiti TaskList Service', () => {
});
it('should return the filters if it contains task id', (done) => {
let taskId = '1';
const taskId = '1';
let fakeFilterList: FilterRepresentationModel[] = [];
const fakeFilterList: FilterRepresentationModel[] = [];
fakeFilterList.push(fakeRepresentationFilter1, fakeRepresentationFilter2);
let resultFilter: FilterRepresentationModel = null;
service.getFilterForTaskById(taskId, fakeFilterList).subscribe((res: FilterRepresentationModel) => {

View File

@@ -57,7 +57,7 @@ export class TaskListService {
* @returns The search query
*/
private generateTaskRequestNodeFromFilter(filterModel: FilterRepresentationModel): TaskQueryRequestRepresentationModel {
let requestNode = {
const requestNode = {
appDefinitionId: filterModel.appId,
assignment: filterModel.filter.assignment,
state: filterModel.filter.state,
@@ -73,7 +73,7 @@ export class TaskListService {
* @returns The filter if it is related or null otherwise
*/
isTaskRelatedToFilter(taskId: string, filterModel: FilterRepresentationModel): Observable<FilterRepresentationModel> {
let requestNodeForFilter = this.generateTaskRequestNodeFromFilter(filterModel);
const requestNodeForFilter = this.generateTaskRequestNodeFromFilter(filterModel);
return from(this.callApiTasksFiltered(requestNodeForFilter))
.pipe(
map((res: any) => {
@@ -185,7 +185,7 @@ export class TaskListService {
* @returns Array of form details
*/
getFormList(): Observable<Form[]> {
let opts = {
const opts = {
'filter': 'myReusableForms', // String | filter
'sort': 'modifiedDesc', // String | sort
'modelType': 2 // Integer | modelType
@@ -194,7 +194,7 @@ export class TaskListService {
return from(this.apiService.getInstance().activiti.modelsApi.getModels(opts))
.pipe(
map((response: any) => {
let forms: Form[] = [];
const forms: Form[] = [];
response.data.forEach((form) => {
forms.push(new Form(form.id, form.name));
});
@@ -306,7 +306,7 @@ export class TaskListService {
* @returns Details of the assigned task
*/
assignTask(taskId: string, requestNode: any): Observable<TaskDetailsModel> {
let assignee = { assignee: requestNode.id };
const assignee = { assignee: requestNode.id };
return from(this.callApiAssignTask(taskId, assignee))
.pipe(
map((response: TaskDetailsModel) => {