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

@@ -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 = '';