mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
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:
committed by
Eugenio Romano
parent
26c5982a1a
commit
a7a48e8b2b
@@ -73,7 +73,7 @@ describe('GroupCloudComponent', () => {
|
||||
it('should show the groups if the typed result match', async(() => {
|
||||
fixture.detectChanges();
|
||||
component.searchGroups$ = of(<GroupModel[]> mockGroups);
|
||||
let inputHTMLElement: HTMLInputElement = <HTMLInputElement> element.querySelector('input');
|
||||
const inputHTMLElement: HTMLInputElement = <HTMLInputElement> element.querySelector('input');
|
||||
inputHTMLElement.focus();
|
||||
inputHTMLElement.dispatchEvent(new Event('input'));
|
||||
inputHTMLElement.dispatchEvent(new Event('keyup'));
|
||||
@@ -88,7 +88,7 @@ describe('GroupCloudComponent', () => {
|
||||
|
||||
it('should hide result list if input is empty', async(() => {
|
||||
fixture.detectChanges();
|
||||
let inputHTMLElement: HTMLInputElement = <HTMLInputElement> element.querySelector('input');
|
||||
const inputHTMLElement: HTMLInputElement = <HTMLInputElement> element.querySelector('input');
|
||||
inputHTMLElement.focus();
|
||||
inputHTMLElement.value = '';
|
||||
inputHTMLElement.dispatchEvent(new Event('keyup'));
|
||||
@@ -102,7 +102,7 @@ describe('GroupCloudComponent', () => {
|
||||
|
||||
it('should emit selectedGroup if option is valid', async(() => {
|
||||
fixture.detectChanges();
|
||||
let selectEmitSpy = spyOn(component.selectGroup, 'emit');
|
||||
const selectEmitSpy = spyOn(component.selectGroup, 'emit');
|
||||
component.onSelect(new GroupModel({ name: 'group name'}));
|
||||
fixture.whenStable().then(() => {
|
||||
expect(selectEmitSpy).toHaveBeenCalled();
|
||||
@@ -186,7 +186,7 @@ describe('GroupCloudComponent', () => {
|
||||
}));
|
||||
|
||||
it('should emit removeGroup when a selected group is removed if mode=multiple', async(() => {
|
||||
let removeGroupSpy = spyOn(component.removeGroup, 'emit');
|
||||
const removeGroupSpy = spyOn(component.removeGroup, 'emit');
|
||||
|
||||
component.mode = 'multiple';
|
||||
component.preSelectGroups = <any> [{id: mockGroups[1].id}, {id: mockGroups[2].id}];
|
||||
@@ -205,7 +205,7 @@ describe('GroupCloudComponent', () => {
|
||||
it('should list groups who have access to the app when appName is specified', async(() => {
|
||||
component.appName = 'sample-app';
|
||||
fixture.detectChanges();
|
||||
let inputHTMLElement: HTMLInputElement = <HTMLInputElement> element.querySelector('input');
|
||||
const inputHTMLElement: HTMLInputElement = <HTMLInputElement> element.querySelector('input');
|
||||
inputHTMLElement.focus();
|
||||
inputHTMLElement.value = 'M';
|
||||
inputHTMLElement.dispatchEvent(new Event('input'));
|
||||
@@ -222,7 +222,7 @@ describe('GroupCloudComponent', () => {
|
||||
component.appName = 'sample-app';
|
||||
|
||||
fixture.detectChanges();
|
||||
let inputHTMLElement: HTMLInputElement = <HTMLInputElement> element.querySelector('[data-automation-id="adf-cloud-group-search-input"]');
|
||||
const inputHTMLElement: HTMLInputElement = <HTMLInputElement> element.querySelector('[data-automation-id="adf-cloud-group-search-input"]');
|
||||
inputHTMLElement.focus();
|
||||
inputHTMLElement.value = 'Mock';
|
||||
inputHTMLElement.dispatchEvent(new Event('input'));
|
||||
@@ -238,7 +238,7 @@ describe('GroupCloudComponent', () => {
|
||||
checkGroupHasGivenRoleSpy.and.returnValue(of(true));
|
||||
component.roles = ['mock-role-1', 'mock-role-2'];
|
||||
fixture.detectChanges();
|
||||
let inputHTMLElement: HTMLInputElement = <HTMLInputElement> element.querySelector('input');
|
||||
const inputHTMLElement: HTMLInputElement = <HTMLInputElement> element.querySelector('input');
|
||||
inputHTMLElement.focus();
|
||||
inputHTMLElement.value = 'M';
|
||||
inputHTMLElement.dispatchEvent(new Event('input'));
|
||||
@@ -255,7 +255,7 @@ describe('GroupCloudComponent', () => {
|
||||
checkGroupHasGivenRoleSpy.and.returnValue(of(false));
|
||||
component.roles = [];
|
||||
fixture.detectChanges();
|
||||
let inputHTMLElement: HTMLInputElement = <HTMLInputElement> element.querySelector('input');
|
||||
const inputHTMLElement: HTMLInputElement = <HTMLInputElement> element.querySelector('input');
|
||||
inputHTMLElement.focus();
|
||||
inputHTMLElement.value = 'M';
|
||||
inputHTMLElement.dispatchEvent(new Event('input'));
|
||||
@@ -272,7 +272,7 @@ describe('GroupCloudComponent', () => {
|
||||
findGroupsByNameSpy.and.returnValue(of(mockGroups));
|
||||
checkGroupHasAccessSpy.and.returnValue(of(true));
|
||||
fixture.detectChanges();
|
||||
let inputHTMLElement: HTMLInputElement = <HTMLInputElement> element.querySelector('input');
|
||||
const inputHTMLElement: HTMLInputElement = <HTMLInputElement> element.querySelector('input');
|
||||
inputHTMLElement.focus();
|
||||
inputHTMLElement.value = 'Mock';
|
||||
inputHTMLElement.dispatchEvent(new Event('input'));
|
||||
@@ -285,7 +285,7 @@ describe('GroupCloudComponent', () => {
|
||||
|
||||
it('should not validate access to the app when appName is not specified', async(() => {
|
||||
fixture.detectChanges();
|
||||
let inputHTMLElement: HTMLInputElement = <HTMLInputElement> element.querySelector('input');
|
||||
const inputHTMLElement: HTMLInputElement = <HTMLInputElement> element.querySelector('input');
|
||||
inputHTMLElement.focus();
|
||||
inputHTMLElement.value = 'M';
|
||||
inputHTMLElement.dispatchEvent(new Event('input'));
|
||||
|
@@ -30,12 +30,12 @@ describe('InitialGroupNamePipe', () => {
|
||||
|
||||
it('should return with the group initial', () => {
|
||||
fakeGroup.name = 'FAKE-GROUP-NAME';
|
||||
let result = pipe.transform(fakeGroup);
|
||||
const result = pipe.transform(fakeGroup);
|
||||
expect(result).toBe('F');
|
||||
});
|
||||
|
||||
it('should return an empty string when group is null', () => {
|
||||
let result = pipe.transform(null);
|
||||
const result = pipe.transform(null);
|
||||
expect(result).toBe('');
|
||||
});
|
||||
});
|
||||
|
@@ -258,7 +258,7 @@ export class EditProcessFilterCloudComponent implements OnInit, OnChanges {
|
||||
|
||||
onDateChanged(newDateValue: any, dateProperty: ProcessFilterProperties) {
|
||||
if (newDateValue) {
|
||||
let momentDate = moment(newDateValue, this.DATE_FORMAT, true);
|
||||
const momentDate = moment(newDateValue, this.DATE_FORMAT, true);
|
||||
|
||||
if (momentDate.isValid()) {
|
||||
this.getPropertyController(dateProperty).setValue(momentDate.toDate());
|
||||
|
@@ -63,7 +63,7 @@ describe('ProcessFilterDialogCloudComponent', () => {
|
||||
|
||||
it('should display title', () => {
|
||||
fixture.detectChanges();
|
||||
let titleElement = fixture.debugElement.nativeElement.querySelector(
|
||||
const titleElement = fixture.debugElement.nativeElement.querySelector(
|
||||
'#adf-process-filter-dialog-title'
|
||||
);
|
||||
expect(titleElement.textContent).toEqual(' ADF_CLOUD_EDIT_PROCESS_FILTER.DIALOG.TITLE ');
|
||||
@@ -71,7 +71,7 @@ describe('ProcessFilterDialogCloudComponent', () => {
|
||||
|
||||
it('should enable save button if form is valid', async(() => {
|
||||
fixture.detectChanges();
|
||||
let saveButton = fixture.debugElement.nativeElement.querySelector(
|
||||
const saveButton = fixture.debugElement.nativeElement.querySelector(
|
||||
'#adf-save-button-id'
|
||||
);
|
||||
const inputElement = fixture.debugElement.nativeElement.querySelector(
|
||||
@@ -94,7 +94,7 @@ describe('ProcessFilterDialogCloudComponent', () => {
|
||||
inputElement.value = '';
|
||||
inputElement.dispatchEvent(new Event('input'));
|
||||
fixture.whenStable().then(() => {
|
||||
let saveButton = fixture.debugElement.nativeElement.querySelector(
|
||||
const saveButton = fixture.debugElement.nativeElement.querySelector(
|
||||
'#adf-save-button-id'
|
||||
);
|
||||
fixture.detectChanges();
|
||||
@@ -111,7 +111,7 @@ describe('ProcessFilterDialogCloudComponent', () => {
|
||||
inputElement.value = 'My custom Name';
|
||||
inputElement.dispatchEvent(new Event('input'));
|
||||
fixture.whenStable().then(() => {
|
||||
let saveButton = fixture.debugElement.nativeElement.querySelector(
|
||||
const saveButton = fixture.debugElement.nativeElement.querySelector(
|
||||
'#adf-save-button-id'
|
||||
);
|
||||
fixture.detectChanges();
|
||||
@@ -124,7 +124,7 @@ describe('ProcessFilterDialogCloudComponent', () => {
|
||||
|
||||
it('should able close dialog on click of cancel button', () => {
|
||||
component.data = { data: { name: '' } };
|
||||
let cancelButton = fixture.debugElement.nativeElement.querySelector(
|
||||
const cancelButton = fixture.debugElement.nativeElement.querySelector(
|
||||
'#adf-cancel-button-id'
|
||||
);
|
||||
fixture.detectChanges();
|
||||
|
@@ -31,7 +31,7 @@ describe('ProcessFiltersCloudComponent', () => {
|
||||
|
||||
let processFilterService: ProcessFilterCloudService;
|
||||
|
||||
let fakeGlobalFilter = [
|
||||
const fakeGlobalFilter = [
|
||||
new ProcessFilterCloudModel({
|
||||
name: 'FakeAllProcesses',
|
||||
icon: 'adjust',
|
||||
@@ -54,21 +54,21 @@ describe('ProcessFiltersCloudComponent', () => {
|
||||
})
|
||||
];
|
||||
|
||||
let fakeGlobalFilterObservable =
|
||||
const fakeGlobalFilterObservable =
|
||||
new Observable(function(observer) {
|
||||
observer.next(fakeGlobalFilter);
|
||||
observer.complete();
|
||||
});
|
||||
|
||||
let fakeGlobalFilterPromise = new Promise(function (resolve, reject) {
|
||||
const fakeGlobalFilterPromise = new Promise(function (resolve, reject) {
|
||||
resolve(fakeGlobalFilter);
|
||||
});
|
||||
|
||||
let mockErrorFilterList = {
|
||||
const mockErrorFilterList = {
|
||||
error: 'wrong request'
|
||||
};
|
||||
|
||||
let mockErrorFilterPromise = Promise.reject(mockErrorFilterList);
|
||||
const mockErrorFilterPromise = Promise.reject(mockErrorFilterList);
|
||||
|
||||
let component: ProcessFiltersCloudComponent;
|
||||
let fixture: ComponentFixture<ProcessFiltersCloudComponent>;
|
||||
@@ -87,14 +87,14 @@ describe('ProcessFiltersCloudComponent', () => {
|
||||
|
||||
it('should attach specific icon for each filter if hasIcon is true', async(() => {
|
||||
spyOn(processFilterService, 'getProcessFilters').and.returnValue(fakeGlobalFilterObservable);
|
||||
let change = new SimpleChange(undefined, 'my-app-1', true);
|
||||
const change = new SimpleChange(undefined, 'my-app-1', true);
|
||||
component.ngOnChanges({'appName': change});
|
||||
fixture.detectChanges();
|
||||
component.showIcons = true;
|
||||
fixture.whenStable().then(() => {
|
||||
fixture.detectChanges();
|
||||
expect(component.filters.length).toBe(3);
|
||||
let filters = fixture.nativeElement.querySelectorAll('.adf-filters__entry-icon');
|
||||
const filters = fixture.nativeElement.querySelectorAll('.adf-filters__entry-icon');
|
||||
expect(filters.length).toBe(3);
|
||||
expect(filters[0].innerText).toContain('adjust');
|
||||
expect(filters[1].innerText).toContain('inbox');
|
||||
@@ -106,13 +106,13 @@ describe('ProcessFiltersCloudComponent', () => {
|
||||
spyOn(processFilterService, 'getProcessFilters').and.returnValue(from(fakeGlobalFilterPromise));
|
||||
|
||||
component.showIcons = false;
|
||||
let change = new SimpleChange(undefined, 'my-app-1', true);
|
||||
const change = new SimpleChange(undefined, 'my-app-1', true);
|
||||
component.ngOnChanges({'appName': 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();
|
||||
});
|
||||
@@ -120,13 +120,13 @@ describe('ProcessFiltersCloudComponent', () => {
|
||||
|
||||
it('should display the filters', async(() => {
|
||||
spyOn(processFilterService, 'getProcessFilters').and.returnValue(fakeGlobalFilterObservable);
|
||||
let change = new SimpleChange(undefined, 'my-app-1', true);
|
||||
const change = new SimpleChange(undefined, 'my-app-1', true);
|
||||
component.ngOnChanges({'appName': change});
|
||||
fixture.detectChanges();
|
||||
component.showIcons = true;
|
||||
fixture.whenStable().then(() => {
|
||||
fixture.detectChanges();
|
||||
let filters = fixture.debugElement.queryAll(By.css('mat-list-item[class*="adf-filters__entry"]'));
|
||||
const filters = fixture.debugElement.queryAll(By.css('mat-list-item[class*="adf-filters__entry"]'));
|
||||
expect(component.filters.length).toBe(3);
|
||||
expect(filters.length).toBe(3);
|
||||
expect(filters[0].nativeElement.innerText).toContain('FakeAllProcesses');
|
||||
@@ -139,7 +139,7 @@ describe('ProcessFiltersCloudComponent', () => {
|
||||
spyOn(processFilterService, 'getProcessFilters').and.returnValue(from(mockErrorFilterPromise));
|
||||
|
||||
const appName = 'my-app-1';
|
||||
let change = new SimpleChange(null, appName, true);
|
||||
const change = new SimpleChange(null, appName, true);
|
||||
component.ngOnChanges({'appName': change});
|
||||
|
||||
component.error.subscribe((err) => {
|
||||
@@ -151,7 +151,7 @@ describe('ProcessFiltersCloudComponent', () => {
|
||||
it('should emit success with the filters when filters are loaded', (done) => {
|
||||
spyOn(processFilterService, 'getProcessFilters').and.returnValue(from(fakeGlobalFilterPromise));
|
||||
const appName = 'my-app-1';
|
||||
let change = new SimpleChange(null, appName, true);
|
||||
const change = new SimpleChange(null, appName, true);
|
||||
component.ngOnChanges({ 'appName': change });
|
||||
|
||||
component.success.subscribe((res) => {
|
||||
@@ -168,7 +168,7 @@ describe('ProcessFiltersCloudComponent', () => {
|
||||
spyOn(processFilterService, 'getProcessFilters').and.returnValue(fakeGlobalFilterObservable);
|
||||
|
||||
const appName = 'my-app-1';
|
||||
let change = new SimpleChange(null, appName, true);
|
||||
const change = new SimpleChange(null, appName, true);
|
||||
|
||||
fixture.detectChanges();
|
||||
component.ngOnChanges({ 'appName': change });
|
||||
@@ -186,7 +186,7 @@ describe('ProcessFiltersCloudComponent', () => {
|
||||
|
||||
component.filterParam = new FilterParamsModel({ name: 'FakeRunningProcesses' });
|
||||
const appName = 'my-app-1';
|
||||
let change = new SimpleChange(null, appName, true);
|
||||
const change = new SimpleChange(null, appName, true);
|
||||
|
||||
component.filterClick.subscribe((res) => {
|
||||
expect(res).toBeDefined();
|
||||
@@ -205,7 +205,7 @@ describe('ProcessFiltersCloudComponent', () => {
|
||||
|
||||
component.filterParam = new FilterParamsModel({ key: 'completed-processes' });
|
||||
const appName = 'my-app-1';
|
||||
let change = new SimpleChange(null, appName, true);
|
||||
const change = new SimpleChange(null, appName, true);
|
||||
|
||||
fixture.detectChanges();
|
||||
|
||||
@@ -226,7 +226,7 @@ describe('ProcessFiltersCloudComponent', () => {
|
||||
component.filterParam = new FilterParamsModel({ name: 'UnexistableFilter' });
|
||||
|
||||
const appName = 'my-app-1';
|
||||
let change = new SimpleChange(null, appName, true);
|
||||
const change = new SimpleChange(null, appName, true);
|
||||
|
||||
fixture.detectChanges();
|
||||
|
||||
@@ -247,7 +247,7 @@ describe('ProcessFiltersCloudComponent', () => {
|
||||
component.filterParam = new FilterParamsModel({ index: 2 });
|
||||
|
||||
const appName = 'my-app-1';
|
||||
let change = new SimpleChange(null, appName, true);
|
||||
const change = new SimpleChange(null, appName, true);
|
||||
fixture.detectChanges();
|
||||
|
||||
component.filterClick.subscribe((res) => {
|
||||
@@ -267,7 +267,7 @@ describe('ProcessFiltersCloudComponent', () => {
|
||||
component.filterParam = new FilterParamsModel({ id: '12' });
|
||||
|
||||
const appName = 'my-app-1';
|
||||
let change = new SimpleChange(null, appName, true);
|
||||
const change = new SimpleChange(null, appName, true);
|
||||
fixture.detectChanges();
|
||||
|
||||
component.filterClick.subscribe((res) => {
|
||||
@@ -286,7 +286,7 @@ describe('ProcessFiltersCloudComponent', () => {
|
||||
component.filterParam = new FilterParamsModel({ id: '10' });
|
||||
|
||||
const appName = 'my-app-1';
|
||||
let change = new SimpleChange(null, appName, true);
|
||||
const change = new SimpleChange(null, appName, true);
|
||||
component.ngOnChanges({ 'appName': change });
|
||||
fixture.detectChanges();
|
||||
|
||||
@@ -297,7 +297,7 @@ describe('ProcessFiltersCloudComponent', () => {
|
||||
done();
|
||||
});
|
||||
|
||||
let filterButton = fixture.debugElement.nativeElement.querySelector('span[data-automation-id="FakeRunningProcesses_filter"]');
|
||||
const filterButton = fixture.debugElement.nativeElement.querySelector('span[data-automation-id="FakeRunningProcesses_filter"]');
|
||||
filterButton.click();
|
||||
});
|
||||
|
||||
@@ -305,7 +305,7 @@ describe('ProcessFiltersCloudComponent', () => {
|
||||
spyOn(component, 'getFilters').and.stub();
|
||||
const appName = 'my-app-1';
|
||||
|
||||
let change = new SimpleChange(null, appName, true);
|
||||
const change = new SimpleChange(null, appName, true);
|
||||
component.ngOnChanges({ 'appName': change });
|
||||
|
||||
expect(component.getFilters).toHaveBeenCalledWith(appName);
|
||||
@@ -315,7 +315,7 @@ describe('ProcessFiltersCloudComponent', () => {
|
||||
spyOn(component, 'getFilters').and.stub();
|
||||
const appName = null;
|
||||
|
||||
let change = new SimpleChange(undefined, appName, true);
|
||||
const change = new SimpleChange(undefined, appName, true);
|
||||
component.ngOnChanges({ 'appName': change });
|
||||
|
||||
expect(component.getFilters).not.toHaveBeenCalledWith(appName);
|
||||
@@ -337,14 +337,14 @@ describe('ProcessFiltersCloudComponent', () => {
|
||||
spyOn(component, 'getFilters').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.getFilters).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();
|
||||
|
@@ -103,8 +103,8 @@ export class ProcessFilterCloudService {
|
||||
const user: IdentityUserModel = this.identityUserService.getCurrentUserInfo();
|
||||
const key = `process-filters-${filter.appName}-${user.username}`;
|
||||
if (key) {
|
||||
let filters = JSON.parse(this.storage.getItem(key) || '[]');
|
||||
let itemIndex = filters.findIndex((flt: ProcessFilterCloudModel) => flt.id === filter.id);
|
||||
const filters = JSON.parse(this.storage.getItem(key) || '[]');
|
||||
const itemIndex = filters.findIndex((flt: ProcessFilterCloudModel) => flt.id === filter.id);
|
||||
filters[itemIndex] = filter;
|
||||
this.storage.setItem(key, JSON.stringify(filters));
|
||||
this.addFiltersToStream(filters);
|
||||
|
@@ -45,7 +45,7 @@ export class ProcessHeaderCloudService {
|
||||
getProcessInstanceById(appName: string, processInstanceId: string): Observable<ProcessInstanceCloud> {
|
||||
if (appName && processInstanceId) {
|
||||
|
||||
let queryUrl = `${this.contextRoot}/${appName}-query/v1/process-instances/${processInstanceId}`;
|
||||
const queryUrl = `${this.contextRoot}/${appName}-query/v1/process-instances/${processInstanceId}`;
|
||||
return from(this.alfrescoApiService.getInstance()
|
||||
.oauth2Auth.callCustomApi(queryUrl, 'GET',
|
||||
null, null, null,
|
||||
|
@@ -124,7 +124,7 @@ describe('ProcessListCloudComponent', () => {
|
||||
|
||||
it('should return the results if an application name is given', (done) => {
|
||||
spyOn(processListCloudService, 'getProcessByRequest').and.returnValue(of(fakeProcessCloudList));
|
||||
let appName = new SimpleChange(null, 'FAKE-APP-NAME', true);
|
||||
const appName = new SimpleChange(null, 'FAKE-APP-NAME', true);
|
||||
component.success.subscribe((res) => {
|
||||
expect(res).toBeDefined();
|
||||
expect(component.rows).toBeDefined();
|
||||
@@ -164,12 +164,12 @@ describe('ProcessListCloudComponent', () => {
|
||||
});
|
||||
|
||||
it('should emit row click event', (done) => {
|
||||
let row = new ObjectDataRow({
|
||||
const row = new ObjectDataRow({
|
||||
entry: {
|
||||
id: '999'
|
||||
}
|
||||
});
|
||||
let rowEvent = new DataRowEvent(row, null);
|
||||
const rowEvent = new DataRowEvent(row, null);
|
||||
component.rowClick.subscribe((taskId) => {
|
||||
expect(taskId).toEqual('999');
|
||||
expect(component.getCurrentId()).toEqual('999');
|
||||
|
@@ -178,7 +178,7 @@ export class ProcessListCloudComponent extends DataTableSchema implements OnChan
|
||||
}
|
||||
|
||||
private isPropertyChanged(changes: SimpleChanges): boolean {
|
||||
for (let property in changes) {
|
||||
for (const property in changes) {
|
||||
if (changes.hasOwnProperty(property)) {
|
||||
if (changes[property] &&
|
||||
(changes[property].currentValue !== changes[property].previousValue)) {
|
||||
@@ -224,7 +224,7 @@ export class ProcessListCloudComponent extends DataTableSchema implements OnChan
|
||||
}
|
||||
|
||||
private createRequestNode(): ProcessQueryCloudRequestModel {
|
||||
let requestNode = {
|
||||
const requestNode = {
|
||||
appName: this.appName,
|
||||
maxItems: this.size,
|
||||
skipCount: this.skipCount,
|
||||
|
@@ -69,7 +69,7 @@ describe('Activiti ProcessList Cloud Service', () => {
|
||||
}));
|
||||
|
||||
it('should return the processes', (done) => {
|
||||
let processRequest: ProcessQueryCloudRequestModel = <ProcessQueryCloudRequestModel> { appName: 'fakeName' };
|
||||
const processRequest: ProcessQueryCloudRequestModel = <ProcessQueryCloudRequestModel> { appName: 'fakeName' };
|
||||
spyOn(alfrescoApiMock, 'getInstance').and.callFake(returFakeProcessListResults);
|
||||
service.getProcessByRequest(processRequest).subscribe((res) => {
|
||||
expect(res).toBeDefined();
|
||||
@@ -83,7 +83,7 @@ describe('Activiti ProcessList Cloud Service', () => {
|
||||
});
|
||||
|
||||
it('should append to the call all the parameters', (done) => {
|
||||
let processRequest: ProcessQueryCloudRequestModel = <ProcessQueryCloudRequestModel> { appName: 'fakeName', skipCount: 0, maxItems: 20, service: 'fake-service' };
|
||||
const processRequest: ProcessQueryCloudRequestModel = <ProcessQueryCloudRequestModel> { appName: 'fakeName', skipCount: 0, maxItems: 20, service: 'fake-service' };
|
||||
spyOn(alfrescoApiMock, 'getInstance').and.callFake(returnCallQueryParameters);
|
||||
service.getProcessByRequest(processRequest).subscribe((res) => {
|
||||
expect(res).toBeDefined();
|
||||
@@ -96,7 +96,7 @@ describe('Activiti ProcessList Cloud Service', () => {
|
||||
});
|
||||
|
||||
it('should concat the app name to the request url', (done) => {
|
||||
let processRequest: ProcessQueryCloudRequestModel = <ProcessQueryCloudRequestModel> { appName: 'fakeName', skipCount: 0, maxItems: 20, service: 'fake-service' };
|
||||
const processRequest: ProcessQueryCloudRequestModel = <ProcessQueryCloudRequestModel> { appName: 'fakeName', skipCount: 0, maxItems: 20, service: 'fake-service' };
|
||||
spyOn(alfrescoApiMock, 'getInstance').and.callFake(returnCallUrl);
|
||||
service.getProcessByRequest(processRequest).subscribe((requestUrl) => {
|
||||
expect(requestUrl).toBeDefined();
|
||||
@@ -107,7 +107,7 @@ describe('Activiti ProcessList Cloud Service', () => {
|
||||
});
|
||||
|
||||
it('should concat the sorting to append as parameters', (done) => {
|
||||
let processRequest: ProcessQueryCloudRequestModel = <ProcessQueryCloudRequestModel> {
|
||||
const processRequest: ProcessQueryCloudRequestModel = <ProcessQueryCloudRequestModel> {
|
||||
appName: 'fakeName', skipCount: 0, maxItems: 20, service: 'fake-service',
|
||||
sorting: [{ orderBy: 'NAME', direction: 'DESC' }, { orderBy: 'TITLE', direction: 'ASC' }]
|
||||
};
|
||||
@@ -121,7 +121,7 @@ describe('Activiti ProcessList Cloud Service', () => {
|
||||
});
|
||||
|
||||
it('should return an error when app name is not specified', (done) => {
|
||||
let processRequest: ProcessQueryCloudRequestModel = <ProcessQueryCloudRequestModel> { appName: null };
|
||||
const processRequest: ProcessQueryCloudRequestModel = <ProcessQueryCloudRequestModel> { appName: null };
|
||||
spyOn(alfrescoApiMock, 'getInstance').and.callFake(returnCallUrl);
|
||||
service.getProcessByRequest(processRequest).subscribe(
|
||||
() => { },
|
||||
|
@@ -37,9 +37,9 @@ export class ProcessListCloudService {
|
||||
*/
|
||||
getProcessByRequest(requestNode: ProcessQueryCloudRequestModel): Observable<any> {
|
||||
if (requestNode.appName) {
|
||||
let queryUrl = this.buildQueryUrl(requestNode);
|
||||
let queryParams = this.buildQueryParams(requestNode);
|
||||
let sortingParams = this.buildSortingParam(requestNode.sorting);
|
||||
const queryUrl = this.buildQueryUrl(requestNode);
|
||||
const queryParams = this.buildQueryParams(requestNode);
|
||||
const sortingParams = this.buildSortingParam(requestNode.sorting);
|
||||
if (sortingParams) {
|
||||
queryParams['sort'] = sortingParams;
|
||||
}
|
||||
@@ -63,8 +63,8 @@ export class ProcessListCloudService {
|
||||
}
|
||||
|
||||
private buildQueryParams(requestNode: ProcessQueryCloudRequestModel) {
|
||||
let queryParam = {};
|
||||
for (let property in requestNode) {
|
||||
const queryParam = {};
|
||||
for (const property in requestNode) {
|
||||
if (requestNode.hasOwnProperty(property) &&
|
||||
!this.isExcludedField(property) &&
|
||||
this.isPropertyValueValid(requestNode, property)) {
|
||||
@@ -81,7 +81,7 @@ export class ProcessListCloudService {
|
||||
private buildSortingParam(sortings: ProcessListCloudSortingModel[]): string {
|
||||
let finalSorting: string = '';
|
||||
if (sortings) {
|
||||
for (let sort of sortings) {
|
||||
for (const sort of sortings) {
|
||||
if (!finalSorting) {
|
||||
finalSorting = `${sort.orderBy},${sort.direction}`;
|
||||
} else {
|
||||
|
@@ -80,7 +80,7 @@ describe('StartProcessCloudComponent', () => {
|
||||
fixture.detectChanges();
|
||||
|
||||
fixture.whenStable().then(() => {
|
||||
let startBtn = fixture.nativeElement.querySelector('#button-start');
|
||||
const startBtn = fixture.nativeElement.querySelector('#button-start');
|
||||
expect(startBtn.disabled).toBe(false);
|
||||
});
|
||||
}));
|
||||
@@ -91,7 +91,7 @@ describe('StartProcessCloudComponent', () => {
|
||||
component.processForm.controls['processDefinition'].setValue(fakeProcessInstance.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);
|
||||
});
|
||||
}));
|
||||
@@ -100,7 +100,7 @@ describe('StartProcessCloudComponent', () => {
|
||||
component.processPayloadCloud.processDefinitionKey = 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);
|
||||
});
|
||||
}));
|
||||
@@ -113,7 +113,7 @@ describe('StartProcessCloudComponent', () => {
|
||||
component.name = 'My new process';
|
||||
component.appName = 'myApp';
|
||||
fixture.detectChanges();
|
||||
let change = new SimpleChange(null, 'MyApp', true);
|
||||
const change = new SimpleChange(null, 'MyApp', true);
|
||||
component.ngOnChanges({ 'appName': change });
|
||||
fixture.detectChanges();
|
||||
});
|
||||
@@ -126,7 +126,7 @@ describe('StartProcessCloudComponent', () => {
|
||||
|
||||
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);
|
||||
});
|
||||
});
|
||||
@@ -135,8 +135,8 @@ describe('StartProcessCloudComponent', () => {
|
||||
component.processDefinitionList = fakeProcessDefinitions;
|
||||
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();
|
||||
@@ -147,19 +147,19 @@ describe('StartProcessCloudComponent', () => {
|
||||
|
||||
it('should indicate an error to the user if process defs cannot be loaded', async(() => {
|
||||
getDefinitionsSpy = getDefinitionsSpy.and.returnValue(throwError({}));
|
||||
let change = new SimpleChange('myApp', 'myApp1', true);
|
||||
const change = new SimpleChange('myApp', 'myApp1', true);
|
||||
component.ngOnChanges({ appName: change });
|
||||
fixture.detectChanges();
|
||||
|
||||
fixture.whenStable().then(() => {
|
||||
let errorEl = fixture.nativeElement.querySelector('#error-message');
|
||||
const errorEl = fixture.nativeElement.querySelector('#error-message');
|
||||
expect(errorEl.innerText.trim()).toBe('ADF_CLOUD_PROCESS_LIST.ADF_CLOUD_START_PROCESS.ERROR.LOAD_PROCESS_DEFS');
|
||||
});
|
||||
}));
|
||||
|
||||
it('should show no process available message when no process definition is loaded', async(() => {
|
||||
getDefinitionsSpy = getDefinitionsSpy.and.returnValue(of([]));
|
||||
let change = new SimpleChange('myApp', 'myApp1', true);
|
||||
const change = new SimpleChange('myApp', 'myApp1', true);
|
||||
component.ngOnChanges({ appName: change });
|
||||
fixture.detectChanges();
|
||||
|
||||
@@ -182,7 +182,7 @@ describe('StartProcessCloudComponent', () => {
|
||||
|
||||
it('should select automatically the processDefinition if the app contain only one', async(() => {
|
||||
getDefinitionsSpy = getDefinitionsSpy.and.returnValue(of([fakeProcessDefinitions[0]]));
|
||||
let change = new SimpleChange('myApp', 'myApp1', true);
|
||||
const change = new SimpleChange('myApp', 'myApp1', true);
|
||||
component.ngOnChanges({ appName: change });
|
||||
fixture.detectChanges();
|
||||
fixture.whenStable().then(() => {
|
||||
@@ -210,7 +210,7 @@ describe('StartProcessCloudComponent', () => {
|
||||
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();
|
||||
});
|
||||
}));
|
||||
@@ -224,7 +224,7 @@ describe('StartProcessCloudComponent', () => {
|
||||
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();
|
||||
});
|
||||
}));
|
||||
@@ -237,7 +237,7 @@ describe('StartProcessCloudComponent', () => {
|
||||
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();
|
||||
});
|
||||
}));
|
||||
@@ -246,7 +246,7 @@ describe('StartProcessCloudComponent', () => {
|
||||
|
||||
describe('input changes', () => {
|
||||
|
||||
let change = new SimpleChange('myApp', 'myApp1', true);
|
||||
const change = new SimpleChange('myApp', 'myApp1', true);
|
||||
|
||||
beforeEach(async(() => {
|
||||
component.appName = 'myApp';
|
||||
@@ -294,7 +294,7 @@ describe('StartProcessCloudComponent', () => {
|
||||
component.processForm.controls['processInstanceName'].setValue('');
|
||||
component.processForm.controls['processDefinition'].setValue('');
|
||||
fixture.whenStable().then(() => {
|
||||
let startProcessButton = fixture.debugElement.query(By.css('[data-automation-id="btn-start"]'));
|
||||
const startProcessButton = fixture.debugElement.query(By.css('[data-automation-id="btn-start"]'));
|
||||
expect(startProcessButton.nativeElement.disabled).toBeTruthy();
|
||||
});
|
||||
}));
|
||||
@@ -308,7 +308,7 @@ describe('StartProcessCloudComponent', () => {
|
||||
}));
|
||||
|
||||
it('should call service to start process with the variables setted', async(() => {
|
||||
let inputProcessVariable: Map<string, object>[] = [];
|
||||
const inputProcessVariable: Map<string, object>[] = [];
|
||||
inputProcessVariable['name'] = {value: 'Josh'};
|
||||
|
||||
component.variables = inputProcessVariable;
|
||||
@@ -321,7 +321,7 @@ describe('StartProcessCloudComponent', () => {
|
||||
}));
|
||||
|
||||
it('should output start event when process started successfully', async(() => {
|
||||
let emitSpy = spyOn(component.success, 'emit');
|
||||
const emitSpy = spyOn(component.success, 'emit');
|
||||
component.processPayloadCloud = fakeProcessPayload;
|
||||
component.startProcess();
|
||||
fixture.whenStable().then(() => {
|
||||
@@ -330,8 +330,8 @@ describe('StartProcessCloudComponent', () => {
|
||||
}));
|
||||
|
||||
it('should throw error event when process cannot be started', async(() => {
|
||||
let errorSpy = spyOn(component.error, 'emit');
|
||||
let error = { message: 'My error' };
|
||||
const errorSpy = spyOn(component.error, 'emit');
|
||||
const error = { message: 'My error' };
|
||||
startProcessSpy = startProcessSpy.and.returnValue(throwError(error));
|
||||
component.processPayloadCloud = fakeProcessPayload;
|
||||
component.startProcess();
|
||||
@@ -342,19 +342,19 @@ describe('StartProcessCloudComponent', () => {
|
||||
|
||||
it('should indicate an error to the user if process cannot be started', async(() => {
|
||||
getDefinitionsSpy.and.returnValue(of(fakeProcessDefinitions));
|
||||
let change = new SimpleChange('myApp', 'myApp1', true);
|
||||
const change = new SimpleChange('myApp', 'myApp1', true);
|
||||
component.ngOnChanges({ appName: change });
|
||||
startProcessSpy = startProcessSpy.and.returnValue(throwError({}));
|
||||
component.startProcess();
|
||||
fixture.detectChanges();
|
||||
fixture.whenStable().then(() => {
|
||||
let errorEl = fixture.nativeElement.querySelector('#error-message');
|
||||
const errorEl = fixture.nativeElement.querySelector('#error-message');
|
||||
expect(errorEl.innerText.trim()).toBe('ADF_CLOUD_PROCESS_LIST.ADF_CLOUD_START_PROCESS.ERROR.START');
|
||||
});
|
||||
}));
|
||||
|
||||
it('should emit start event when start select a process and add a name', (done) => {
|
||||
let disposableStart = component.success.subscribe(() => {
|
||||
const disposableStart = component.success.subscribe(() => {
|
||||
disposableStart.unsubscribe();
|
||||
done();
|
||||
});
|
||||
@@ -369,7 +369,7 @@ describe('StartProcessCloudComponent', () => {
|
||||
component.processForm.controls['processInstanceName'].setValue('My Process 1');
|
||||
component.processForm.controls['processDefinition'].setValue('NewProcess 1');
|
||||
|
||||
let disposableStart = component.success.subscribe(() => {
|
||||
const disposableStart = component.success.subscribe(() => {
|
||||
disposableStart.unsubscribe();
|
||||
done();
|
||||
});
|
||||
@@ -381,7 +381,7 @@ describe('StartProcessCloudComponent', () => {
|
||||
component.maxNameLength = 2;
|
||||
component.ngOnInit();
|
||||
fixture.detectChanges();
|
||||
let processInstanceName = component.processForm.controls['processInstanceName'];
|
||||
const processInstanceName = component.processForm.controls['processInstanceName'];
|
||||
processInstanceName.setValue('task');
|
||||
fixture.detectChanges();
|
||||
expect(processInstanceName.valid).toBeFalsy();
|
||||
@@ -392,7 +392,7 @@ describe('StartProcessCloudComponent', () => {
|
||||
|
||||
it('should emit error when process name field is empty', () => {
|
||||
fixture.detectChanges();
|
||||
let processInstanceName = component.processForm.controls['processInstanceName'];
|
||||
const processInstanceName = component.processForm.controls['processInstanceName'];
|
||||
processInstanceName.setValue('');
|
||||
fixture.detectChanges();
|
||||
expect(processInstanceName.valid).toBeFalsy();
|
||||
|
@@ -140,7 +140,7 @@ export class StartProcessCloudComponent implements OnChanges, OnInit {
|
||||
}
|
||||
|
||||
private selectDefaultProcessDefinition() {
|
||||
let selectedProcess = this.getProcessDefinitionByName(this.processDefinitionName);
|
||||
const selectedProcess = this.getProcessDefinitionByName(this.processDefinitionName);
|
||||
if (selectedProcess) {
|
||||
this.processForm.controls['processDefinition'].setValue(selectedProcess.name);
|
||||
this.processPayloadCloud.processDefinitionKey = selectedProcess.key;
|
||||
|
@@ -47,7 +47,7 @@ export class StartProcessCloudService {
|
||||
getProcessDefinitions(appName: string): Observable<ProcessDefinitionCloud[]> {
|
||||
|
||||
if (appName) {
|
||||
let queryUrl = `${this.contextRoot}/${appName}-rb/v1/process-definitions`;
|
||||
const queryUrl = `${this.contextRoot}/${appName}-rb/v1/process-definitions`;
|
||||
|
||||
return from(this.alfrescoApiService.getInstance()
|
||||
.oauth2Auth.callCustomApi(queryUrl, 'GET',
|
||||
@@ -75,7 +75,7 @@ export class StartProcessCloudService {
|
||||
*/
|
||||
startProcess(appName: string, requestPayload: ProcessPayloadCloud): Observable<ProcessInstanceCloud> {
|
||||
|
||||
let queryUrl = `${this.contextRoot}/${appName}-rb/v1/process-instances`;
|
||||
const queryUrl = `${this.contextRoot}/${appName}-rb/v1/process-instances`;
|
||||
|
||||
return from(this.alfrescoApiService.getInstance()
|
||||
.oauth2Auth.callCustomApi(queryUrl, 'POST',
|
||||
|
@@ -103,7 +103,7 @@ export class TaskCloudService {
|
||||
claimTask(appName: string, taskId: string, assignee: string): Observable<TaskDetailsCloudModel> {
|
||||
if (appName && taskId) {
|
||||
|
||||
let queryUrl = `${this.contextRoot}/${appName}-rb/v1/tasks/${taskId}/claim?assignee=${assignee}`;
|
||||
const queryUrl = `${this.contextRoot}/${appName}-rb/v1/tasks/${taskId}/claim?assignee=${assignee}`;
|
||||
return from(this.apiService.getInstance()
|
||||
.oauth2Auth.callCustomApi(queryUrl, 'POST',
|
||||
null, null, null,
|
||||
@@ -131,7 +131,7 @@ export class TaskCloudService {
|
||||
unclaimTask(appName: string, taskId: string): Observable<TaskDetailsCloudModel> {
|
||||
if (appName && taskId) {
|
||||
|
||||
let queryUrl = `${this.contextRoot}/${appName}-rb/v1/tasks/${taskId}/release`;
|
||||
const queryUrl = `${this.contextRoot}/${appName}-rb/v1/tasks/${taskId}/release`;
|
||||
return from(this.apiService.getInstance()
|
||||
.oauth2Auth.callCustomApi(queryUrl, 'POST',
|
||||
null, null, null,
|
||||
@@ -159,7 +159,7 @@ export class TaskCloudService {
|
||||
getTaskById(appName: string, taskId: string): Observable<TaskDetailsCloudModel> {
|
||||
if (appName && taskId) {
|
||||
|
||||
let queryUrl = `${this.contextRoot}/${appName}-query/v1/tasks/${taskId}`;
|
||||
const queryUrl = `${this.contextRoot}/${appName}-query/v1/tasks/${taskId}`;
|
||||
return from(this.apiService.getInstance()
|
||||
.oauth2Auth.callCustomApi(queryUrl, 'GET',
|
||||
null, null, null,
|
||||
@@ -190,7 +190,7 @@ export class TaskCloudService {
|
||||
|
||||
updatePayload.payloadType = 'UpdateTaskPayload';
|
||||
|
||||
let queryUrl = `${this.contextRoot}/${appName}-rb/v1/tasks/${taskId}`;
|
||||
const queryUrl = `${this.contextRoot}/${appName}-rb/v1/tasks/${taskId}`;
|
||||
return from(this.apiService.getInstance()
|
||||
.oauth2Auth.callCustomApi(queryUrl, 'PUT',
|
||||
null, null, null,
|
||||
|
@@ -56,7 +56,7 @@ describe('PeopleCloudComponent', () => {
|
||||
it('should show the users if the typed result match', async(() => {
|
||||
component.searchUsers$ = of(<IdentityUserModel[]> mockUsers);
|
||||
fixture.detectChanges();
|
||||
let inputHTMLElement: HTMLInputElement = <HTMLInputElement> element.querySelector('input');
|
||||
const inputHTMLElement: HTMLInputElement = <HTMLInputElement> element.querySelector('input');
|
||||
inputHTMLElement.focus();
|
||||
inputHTMLElement.dispatchEvent(new Event('input'));
|
||||
inputHTMLElement.dispatchEvent(new Event('keyup'));
|
||||
@@ -71,7 +71,7 @@ describe('PeopleCloudComponent', () => {
|
||||
|
||||
it('should hide result list if input is empty', async(() => {
|
||||
fixture.detectChanges();
|
||||
let inputHTMLElement: HTMLInputElement = <HTMLInputElement> element.querySelector('input');
|
||||
const inputHTMLElement: HTMLInputElement = <HTMLInputElement> element.querySelector('input');
|
||||
inputHTMLElement.focus();
|
||||
inputHTMLElement.value = '';
|
||||
inputHTMLElement.dispatchEvent(new Event('keyup'));
|
||||
@@ -85,7 +85,7 @@ describe('PeopleCloudComponent', () => {
|
||||
|
||||
it('should emit selectedUser if option is valid', async(() => {
|
||||
fixture.detectChanges();
|
||||
let selectEmitSpy = spyOn(component.selectUser, 'emit');
|
||||
const selectEmitSpy = spyOn(component.selectUser, 'emit');
|
||||
component.onSelect(new IdentityUserModel({ username: 'username' }));
|
||||
fixture.whenStable().then(() => {
|
||||
expect(selectEmitSpy).toHaveBeenCalled();
|
||||
@@ -174,7 +174,7 @@ describe('PeopleCloudComponent', () => {
|
||||
|
||||
it('should emit removeUser when a selected user is removed if mode=multiple', async(() => {
|
||||
spyOn(identityService, 'getUsersByRolesWithCurrentUser').and.returnValue(Promise.resolve(mockUsers));
|
||||
let removeUserSpy = spyOn(component.removeUser, 'emit');
|
||||
const removeUserSpy = spyOn(component.removeUser, 'emit');
|
||||
|
||||
component.mode = 'multiple';
|
||||
component.preSelectUsers = <any> [{ id: mockUsers[1].id }, { id: mockUsers[2].id }];
|
||||
@@ -193,7 +193,7 @@ describe('PeopleCloudComponent', () => {
|
||||
it('should list users who have access to the app when appName is specified', async(() => {
|
||||
component.appName = 'sample-app';
|
||||
fixture.detectChanges();
|
||||
let inputHTMLElement: HTMLInputElement = <HTMLInputElement> element.querySelector('input');
|
||||
const inputHTMLElement: HTMLInputElement = <HTMLInputElement> element.querySelector('input');
|
||||
inputHTMLElement.focus();
|
||||
inputHTMLElement.value = 'M';
|
||||
inputHTMLElement.dispatchEvent(new Event('input'));
|
||||
@@ -210,7 +210,7 @@ describe('PeopleCloudComponent', () => {
|
||||
component.appName = 'sample-app';
|
||||
|
||||
fixture.detectChanges();
|
||||
let inputHTMLElement: HTMLInputElement = <HTMLInputElement> element.querySelector('input');
|
||||
const inputHTMLElement: HTMLInputElement = <HTMLInputElement> element.querySelector('input');
|
||||
inputHTMLElement.focus();
|
||||
inputHTMLElement.value = 'M';
|
||||
inputHTMLElement.dispatchEvent(new Event('input'));
|
||||
@@ -226,7 +226,7 @@ describe('PeopleCloudComponent', () => {
|
||||
component.appName = 'sample-app';
|
||||
|
||||
fixture.detectChanges();
|
||||
let inputHTMLElement: HTMLInputElement = <HTMLInputElement> element.querySelector('input');
|
||||
const inputHTMLElement: HTMLInputElement = <HTMLInputElement> element.querySelector('input');
|
||||
inputHTMLElement.focus();
|
||||
inputHTMLElement.value = 'M';
|
||||
inputHTMLElement.dispatchEvent(new Event('input'));
|
||||
@@ -239,7 +239,7 @@ describe('PeopleCloudComponent', () => {
|
||||
|
||||
it('should not validate access to the app when appName is not specified', async(() => {
|
||||
fixture.detectChanges();
|
||||
let inputHTMLElement: HTMLInputElement = <HTMLInputElement> element.querySelector('input');
|
||||
const inputHTMLElement: HTMLInputElement = <HTMLInputElement> element.querySelector('input');
|
||||
inputHTMLElement.focus();
|
||||
inputHTMLElement.value = 'M';
|
||||
inputHTMLElement.dispatchEvent(new Event('input'));
|
||||
@@ -254,7 +254,7 @@ describe('PeopleCloudComponent', () => {
|
||||
const checkUserHasRoleSpy = spyOn(identityService, 'checkUserHasRole').and.returnValue(of(true));
|
||||
component.roles = ['mock-role-1'];
|
||||
fixture.detectChanges();
|
||||
let inputHTMLElement: HTMLInputElement = <HTMLInputElement> element.querySelector('input');
|
||||
const inputHTMLElement: HTMLInputElement = <HTMLInputElement> element.querySelector('input');
|
||||
inputHTMLElement.focus();
|
||||
inputHTMLElement.value = 'M';
|
||||
inputHTMLElement.dispatchEvent(new Event('input'));
|
||||
@@ -270,7 +270,7 @@ describe('PeopleCloudComponent', () => {
|
||||
component.appName = '';
|
||||
component.roles = ['mock-role-10'];
|
||||
fixture.detectChanges();
|
||||
let inputHTMLElement: HTMLInputElement = <HTMLInputElement> element.querySelector('input');
|
||||
const inputHTMLElement: HTMLInputElement = <HTMLInputElement> element.querySelector('input');
|
||||
inputHTMLElement.focus();
|
||||
inputHTMLElement.value = 'M';
|
||||
inputHTMLElement.dispatchEvent(new Event('input'));
|
||||
@@ -286,7 +286,7 @@ describe('PeopleCloudComponent', () => {
|
||||
component.appName = '';
|
||||
component.roles = [];
|
||||
fixture.detectChanges();
|
||||
let inputHTMLElement: HTMLInputElement = <HTMLInputElement> element.querySelector('input');
|
||||
const inputHTMLElement: HTMLInputElement = <HTMLInputElement> element.querySelector('input');
|
||||
inputHTMLElement.focus();
|
||||
inputHTMLElement.value = 'M';
|
||||
inputHTMLElement.dispatchEvent(new Event('input'));
|
||||
@@ -320,7 +320,7 @@ describe('PeopleCloudComponent', () => {
|
||||
it('should not validate preselect values if preselectValidation flag is set to false', () => {
|
||||
component.mode = 'multiple';
|
||||
component.preSelectUsers = <any> [{ id: mockUsers[1].id }, { id: mockUsers[2].id }];
|
||||
let change = new SimpleChange(null, 'validate', false);
|
||||
const change = new SimpleChange(null, 'validate', false);
|
||||
component.ngOnChanges({'validate': change});
|
||||
fixture.whenStable().then(() => {
|
||||
fixture.detectChanges();
|
||||
|
@@ -314,7 +314,7 @@ export class PeopleCloudComponent implements OnInit, OnChanges {
|
||||
}
|
||||
|
||||
public async loadMultiplePreselectUsers() {
|
||||
let users = await this.validatePreselectUsers();
|
||||
const users = await this.validatePreselectUsers();
|
||||
this.checkPreselectValidationErrors();
|
||||
this.preSelectUsers = [...users];
|
||||
this.selectedUsersSubject.next(users);
|
||||
|
@@ -68,10 +68,10 @@ describe('StartTaskCloudComponent', () => {
|
||||
describe('create task', () => {
|
||||
|
||||
it('should create new task when start button is clicked', async(() => {
|
||||
let successSpy = spyOn(component.success, 'emit');
|
||||
const successSpy = spyOn(component.success, 'emit');
|
||||
component.taskForm.controls['name'].setValue('fakeName');
|
||||
fixture.detectChanges();
|
||||
let createTaskButton = <HTMLElement> element.querySelector('#button-start');
|
||||
const createTaskButton = <HTMLElement> element.querySelector('#button-start');
|
||||
createTaskButton.click();
|
||||
fixture.detectChanges();
|
||||
fixture.whenStable().then(() => {
|
||||
@@ -81,11 +81,11 @@ describe('StartTaskCloudComponent', () => {
|
||||
}));
|
||||
|
||||
it('should send on success event when the task is started', async(() => {
|
||||
let successSpy = spyOn(component.success, 'emit');
|
||||
const successSpy = spyOn(component.success, 'emit');
|
||||
component.taskForm.controls['name'].setValue('fakeName');
|
||||
component.assigneeName = 'fake-assignee';
|
||||
fixture.detectChanges();
|
||||
let createTaskButton = <HTMLElement> element.querySelector('#button-start');
|
||||
const createTaskButton = <HTMLElement> element.querySelector('#button-start');
|
||||
createTaskButton.click();
|
||||
fixture.detectChanges();
|
||||
fixture.whenStable().then(() => {
|
||||
@@ -94,10 +94,10 @@ describe('StartTaskCloudComponent', () => {
|
||||
}));
|
||||
|
||||
it('should send on success event when only name is given', async(() => {
|
||||
let successSpy = spyOn(component.success, 'emit');
|
||||
const successSpy = spyOn(component.success, 'emit');
|
||||
component.taskForm.controls['name'].setValue('fakeName');
|
||||
fixture.detectChanges();
|
||||
let createTaskButton = <HTMLElement> element.querySelector('#button-start');
|
||||
const createTaskButton = <HTMLElement> element.querySelector('#button-start');
|
||||
createTaskButton.click();
|
||||
fixture.detectChanges();
|
||||
fixture.whenStable().then(() => {
|
||||
@@ -106,10 +106,10 @@ describe('StartTaskCloudComponent', () => {
|
||||
}));
|
||||
|
||||
it('should not emit success event when data not present', () => {
|
||||
let successSpy = spyOn(component.success, 'emit');
|
||||
const successSpy = spyOn(component.success, 'emit');
|
||||
component.taskForm.controls['name'].setValue('');
|
||||
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();
|
||||
@@ -133,7 +133,7 @@ describe('StartTaskCloudComponent', () => {
|
||||
it('should assign task to the logged in user when assignee is not selected', async(() => {
|
||||
component.taskForm.controls['name'].setValue('fakeName');
|
||||
fixture.detectChanges();
|
||||
let createTaskButton = <HTMLElement> element.querySelector('#button-start');
|
||||
const createTaskButton = <HTMLElement> element.querySelector('#button-start');
|
||||
createTaskButton.click();
|
||||
fixture.detectChanges();
|
||||
fixture.whenStable().then(() => {
|
||||
@@ -160,14 +160,14 @@ describe('StartTaskCloudComponent', () => {
|
||||
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', () => {
|
||||
fixture.detectChanges();
|
||||
let emitSpy = spyOn(component.cancel, 'emit');
|
||||
let cancelTaskButton = fixture.nativeElement.querySelector('#button-cancel');
|
||||
const emitSpy = spyOn(component.cancel, 'emit');
|
||||
const cancelTaskButton = fixture.nativeElement.querySelector('#button-cancel');
|
||||
cancelTaskButton.click();
|
||||
expect(emitSpy).not.toBeNull();
|
||||
expect(emitSpy).toHaveBeenCalled();
|
||||
@@ -176,15 +176,15 @@ describe('StartTaskCloudComponent', () => {
|
||||
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 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');
|
||||
createNewTaskSpy.and.returnValue(throwError({}));
|
||||
let createTaskButton = <HTMLElement> element.querySelector('#button-start');
|
||||
const createTaskButton = <HTMLElement> element.querySelector('#button-start');
|
||||
fixture.detectChanges();
|
||||
createTaskButton.click();
|
||||
expect(errorSpy).toHaveBeenCalled();
|
||||
@@ -194,7 +194,7 @@ describe('StartTaskCloudComponent', () => {
|
||||
component.maxNameLength = 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();
|
||||
@@ -205,7 +205,7 @@ describe('StartTaskCloudComponent', () => {
|
||||
|
||||
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();
|
||||
@@ -215,7 +215,7 @@ describe('StartTaskCloudComponent', () => {
|
||||
});
|
||||
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();
|
||||
|
@@ -177,7 +177,7 @@ export class StartTaskCloudComponent implements OnInit, OnDestroy {
|
||||
this.dateError = false;
|
||||
|
||||
if (newDateValue) {
|
||||
let momentDate = moment(newDateValue, this.DATE_FORMAT, true);
|
||||
const momentDate = moment(newDateValue, this.DATE_FORMAT, true);
|
||||
if (!momentDate.isValid()) {
|
||||
this.dateError = true;
|
||||
}
|
||||
|
@@ -41,7 +41,7 @@ export class StartTaskCloudService {
|
||||
* @returns Details of the newly created task
|
||||
*/
|
||||
createNewTask(taskDetails: TaskDetailsCloudModel): Observable<TaskDetailsCloudModel> {
|
||||
let queryUrl = this.buildCreateTaskUrl(taskDetails.appName);
|
||||
const queryUrl = this.buildCreateTaskUrl(taskDetails.appName);
|
||||
const bodyParam = JSON.stringify(this.buildRequestBody(taskDetails));
|
||||
const pathParams = {}, queryParams = {}, headerParams = {},
|
||||
formParams = {}, contentTypes = ['application/json'], accepts = ['application/json'];
|
||||
|
@@ -67,7 +67,7 @@ describe('EditTaskFilterCloudComponent', () => {
|
||||
});
|
||||
|
||||
it('should fetch task filter by taskId', async(() => {
|
||||
let taskFilterIDchange = new SimpleChange(undefined, 'mock-task-filter-id', true);
|
||||
const taskFilterIDchange = new SimpleChange(undefined, 'mock-task-filter-id', true);
|
||||
component.ngOnChanges({ 'id': taskFilterIDchange});
|
||||
fixture.detectChanges();
|
||||
fixture.whenStable().then(() => {
|
||||
@@ -81,7 +81,7 @@ describe('EditTaskFilterCloudComponent', () => {
|
||||
}));
|
||||
|
||||
it('should display filter name as title', () => {
|
||||
let taskFilterIDchange = new SimpleChange(undefined, 'mock-task-filter-id', true);
|
||||
const taskFilterIDchange = new SimpleChange(undefined, 'mock-task-filter-id', true);
|
||||
component.ngOnChanges({ 'id': taskFilterIDchange});
|
||||
fixture.detectChanges();
|
||||
const title = fixture.debugElement.nativeElement.querySelector('#adf-edit-task-filter-title-id');
|
||||
@@ -95,7 +95,7 @@ describe('EditTaskFilterCloudComponent', () => {
|
||||
describe('EditTaskFilter form', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
let taskFilterIDchange = new SimpleChange(undefined, 'mock-task-filter-id', true);
|
||||
const taskFilterIDchange = new SimpleChange(undefined, 'mock-task-filter-id', true);
|
||||
component.ngOnChanges({'id': taskFilterIDchange});
|
||||
fixture.detectChanges();
|
||||
});
|
||||
@@ -126,22 +126,22 @@ describe('EditTaskFilterCloudComponent', () => {
|
||||
|
||||
it('should disable save button if the task filter is not changed', async(() => {
|
||||
component.toggleFilterActions = true;
|
||||
let expansionPanel = fixture.debugElement.nativeElement.querySelector('mat-expansion-panel-header');
|
||||
const expansionPanel = fixture.debugElement.nativeElement.querySelector('mat-expansion-panel-header');
|
||||
expansionPanel.click();
|
||||
fixture.detectChanges();
|
||||
fixture.whenStable().then(() => {
|
||||
let saveButton = fixture.debugElement.nativeElement.querySelector('[data-automation-id="adf-filter-action-save"]');
|
||||
const saveButton = fixture.debugElement.nativeElement.querySelector('[data-automation-id="adf-filter-action-save"]');
|
||||
expect(saveButton.disabled).toBe(true);
|
||||
});
|
||||
}));
|
||||
|
||||
it('should disable saveAs button if the task filter is not changed', async(() => {
|
||||
component.toggleFilterActions = true;
|
||||
let expansionPanel = fixture.debugElement.nativeElement.querySelector('mat-expansion-panel-header');
|
||||
const expansionPanel = fixture.debugElement.nativeElement.querySelector('mat-expansion-panel-header');
|
||||
expansionPanel.click();
|
||||
fixture.detectChanges();
|
||||
fixture.whenStable().then(() => {
|
||||
let saveButton = fixture.debugElement.nativeElement.querySelector('[data-automation-id="adf-filter-action-saveAs"]');
|
||||
const saveButton = fixture.debugElement.nativeElement.querySelector('[data-automation-id="adf-filter-action-saveAs"]');
|
||||
expect(saveButton.disabled).toBe(true);
|
||||
});
|
||||
}));
|
||||
@@ -149,11 +149,11 @@ describe('EditTaskFilterCloudComponent', () => {
|
||||
it('should enable delete button by default', async(() => {
|
||||
component.toggleFilterActions = true;
|
||||
fixture.detectChanges();
|
||||
let expansionPanel = fixture.debugElement.nativeElement.querySelector('mat-expansion-panel-header');
|
||||
const expansionPanel = fixture.debugElement.nativeElement.querySelector('mat-expansion-panel-header');
|
||||
expansionPanel.click();
|
||||
fixture.detectChanges();
|
||||
fixture.whenStable().then(() => {
|
||||
let deleteButton = fixture.debugElement.nativeElement.querySelector('[data-automation-id="adf-filter-action-delete"]');
|
||||
const deleteButton = fixture.debugElement.nativeElement.querySelector('[data-automation-id="adf-filter-action-delete"]');
|
||||
expect(deleteButton.disabled).toBe(false);
|
||||
});
|
||||
}));
|
||||
@@ -161,13 +161,13 @@ describe('EditTaskFilterCloudComponent', () => {
|
||||
it('should display current task filter details', async(() => {
|
||||
fixture.detectChanges();
|
||||
fixture.whenStable().then(() => {
|
||||
let expansionPanel = fixture.debugElement.nativeElement.querySelector('mat-expansion-panel-header');
|
||||
const expansionPanel = fixture.debugElement.nativeElement.querySelector('mat-expansion-panel-header');
|
||||
expansionPanel.click();
|
||||
fixture.detectChanges();
|
||||
let stateElement = fixture.debugElement.nativeElement.querySelector('[data-automation-id="adf-cloud-edit-task-property-status"]');
|
||||
let assigneeElement = fixture.debugElement.nativeElement.querySelector('[data-automation-id="adf-cloud-edit-task-property-assignee"]');
|
||||
let sortElement = fixture.debugElement.nativeElement.querySelector('[data-automation-id="adf-cloud-edit-task-property-sort"]');
|
||||
let orderElement = fixture.debugElement.nativeElement.querySelector('[data-automation-id="adf-cloud-edit-task-property-order"]');
|
||||
const stateElement = fixture.debugElement.nativeElement.querySelector('[data-automation-id="adf-cloud-edit-task-property-status"]');
|
||||
const assigneeElement = fixture.debugElement.nativeElement.querySelector('[data-automation-id="adf-cloud-edit-task-property-assignee"]');
|
||||
const sortElement = fixture.debugElement.nativeElement.querySelector('[data-automation-id="adf-cloud-edit-task-property-sort"]');
|
||||
const orderElement = fixture.debugElement.nativeElement.querySelector('[data-automation-id="adf-cloud-edit-task-property-order"]');
|
||||
expect(stateElement).toBeDefined();
|
||||
expect(assigneeElement).toBeDefined();
|
||||
expect(sortElement).toBeDefined();
|
||||
@@ -180,10 +180,10 @@ describe('EditTaskFilterCloudComponent', () => {
|
||||
|
||||
it('should display status drop down', async(() => {
|
||||
fixture.detectChanges();
|
||||
let expansionPanel = fixture.debugElement.nativeElement.querySelector('mat-expansion-panel-header');
|
||||
const expansionPanel = fixture.debugElement.nativeElement.querySelector('mat-expansion-panel-header');
|
||||
expansionPanel.click();
|
||||
fixture.detectChanges();
|
||||
let stateElement = fixture.debugElement.nativeElement.querySelector('[data-automation-id="adf-cloud-edit-task-property-status"] .mat-select-trigger');
|
||||
const stateElement = fixture.debugElement.nativeElement.querySelector('[data-automation-id="adf-cloud-edit-task-property-status"] .mat-select-trigger');
|
||||
stateElement.click();
|
||||
fixture.detectChanges();
|
||||
fixture.whenStable().then(() => {
|
||||
@@ -194,10 +194,10 @@ describe('EditTaskFilterCloudComponent', () => {
|
||||
|
||||
it('should display sort drop down', async(() => {
|
||||
fixture.detectChanges();
|
||||
let expansionPanel = fixture.debugElement.nativeElement.querySelector('mat-expansion-panel-header');
|
||||
const expansionPanel = fixture.debugElement.nativeElement.querySelector('mat-expansion-panel-header');
|
||||
expansionPanel.click();
|
||||
fixture.detectChanges();
|
||||
let sortElement = fixture.debugElement.nativeElement.querySelector('[data-automation-id="adf-cloud-edit-task-property-sort"]');
|
||||
const sortElement = fixture.debugElement.nativeElement.querySelector('[data-automation-id="adf-cloud-edit-task-property-sort"]');
|
||||
sortElement.click();
|
||||
fixture.detectChanges();
|
||||
fixture.whenStable().then(() => {
|
||||
@@ -208,10 +208,10 @@ describe('EditTaskFilterCloudComponent', () => {
|
||||
|
||||
it('should display order drop down', async(() => {
|
||||
fixture.detectChanges();
|
||||
let expansionPanel = fixture.debugElement.nativeElement.querySelector('mat-expansion-panel-header');
|
||||
const expansionPanel = fixture.debugElement.nativeElement.querySelector('mat-expansion-panel-header');
|
||||
expansionPanel.click();
|
||||
fixture.detectChanges();
|
||||
let orderElement = fixture.debugElement.nativeElement.querySelector('[data-automation-id="adf-cloud-edit-task-property-order"]');
|
||||
const orderElement = fixture.debugElement.nativeElement.querySelector('[data-automation-id="adf-cloud-edit-task-property-order"]');
|
||||
orderElement.click();
|
||||
fixture.detectChanges();
|
||||
fixture.whenStable().then(() => {
|
||||
@@ -221,7 +221,7 @@ describe('EditTaskFilterCloudComponent', () => {
|
||||
}));
|
||||
|
||||
it('should able to build a editTaskFilter form with default properties if input is empty', async(() => {
|
||||
let taskFilterIDchange = new SimpleChange(undefined, 'mock-task-filter-id', true);
|
||||
const taskFilterIDchange = new SimpleChange(undefined, 'mock-task-filter-id', true);
|
||||
component.ngOnChanges({ 'id': taskFilterIDchange});
|
||||
component.filterProperties = [];
|
||||
fixture.detectChanges();
|
||||
@@ -245,7 +245,7 @@ describe('EditTaskFilterCloudComponent', () => {
|
||||
it('should able to fetch running applications when appName property defined in the input', async(() => {
|
||||
component.filterProperties = ['appName', 'processInstanceId', 'priority'];
|
||||
fixture.detectChanges();
|
||||
let taskFilterIDchange = new SimpleChange(undefined, 'mock-task-filter-id', true);
|
||||
const taskFilterIDchange = new SimpleChange(undefined, 'mock-task-filter-id', true);
|
||||
component.ngOnChanges({ 'id': taskFilterIDchange});
|
||||
const appController = component.editTaskFilterForm.get('appName');
|
||||
fixture.detectChanges();
|
||||
@@ -260,13 +260,13 @@ describe('EditTaskFilterCloudComponent', () => {
|
||||
describe('sort properties', () => {
|
||||
|
||||
it('should display default sort properties', async(() => {
|
||||
let taskFilterIDchange = new SimpleChange(undefined, 'mock-task-filter-id', true);
|
||||
const taskFilterIDchange = new SimpleChange(undefined, 'mock-task-filter-id', true);
|
||||
component.ngOnChanges({ 'id': taskFilterIDchange});
|
||||
fixture.detectChanges();
|
||||
let expansionPanel = fixture.debugElement.nativeElement.querySelector('mat-expansion-panel-header');
|
||||
const expansionPanel = fixture.debugElement.nativeElement.querySelector('mat-expansion-panel-header');
|
||||
expansionPanel.click();
|
||||
fixture.detectChanges();
|
||||
let sortElement = fixture.debugElement.nativeElement.querySelector('[data-automation-id="adf-cloud-edit-task-property-sort"]');
|
||||
const sortElement = fixture.debugElement.nativeElement.querySelector('[data-automation-id="adf-cloud-edit-task-property-sort"]');
|
||||
sortElement.click();
|
||||
fixture.detectChanges();
|
||||
fixture.whenStable().then(() => {
|
||||
@@ -282,13 +282,13 @@ describe('EditTaskFilterCloudComponent', () => {
|
||||
component.sortProperties = ['id', 'name', 'processInstanceId'];
|
||||
getTaskFilterSpy.and.returnValue({ sort: 'my-custom-sort', processInstanceId: 'process-instance-id', priority: '12' });
|
||||
fixture.detectChanges();
|
||||
let taskFilterIDchange = new SimpleChange(undefined, 'mock-task-filter-id', true);
|
||||
const taskFilterIDchange = new SimpleChange(undefined, 'mock-task-filter-id', true);
|
||||
component.ngOnChanges({ 'id': taskFilterIDchange});
|
||||
fixture.detectChanges();
|
||||
let expansionPanel = fixture.debugElement.nativeElement.querySelector('mat-expansion-panel-header');
|
||||
const expansionPanel = fixture.debugElement.nativeElement.querySelector('mat-expansion-panel-header');
|
||||
expansionPanel.click();
|
||||
fixture.detectChanges();
|
||||
let sortElement = fixture.debugElement.nativeElement.querySelector('[data-automation-id="adf-cloud-edit-task-property-sort"]');
|
||||
const sortElement = fixture.debugElement.nativeElement.querySelector('[data-automation-id="adf-cloud-edit-task-property-sort"]');
|
||||
sortElement.click();
|
||||
fixture.detectChanges();
|
||||
fixture.whenStable().then(() => {
|
||||
@@ -303,15 +303,15 @@ describe('EditTaskFilterCloudComponent', () => {
|
||||
}));
|
||||
|
||||
it('should display default sort properties if input is empty', async(() => {
|
||||
let taskFilterIDchange = new SimpleChange(undefined, 'mock-task-filter-id', true);
|
||||
const taskFilterIDchange = new SimpleChange(undefined, 'mock-task-filter-id', true);
|
||||
component.ngOnChanges({ 'id': taskFilterIDchange});
|
||||
fixture.detectChanges();
|
||||
component.sortProperties = [];
|
||||
fixture.detectChanges();
|
||||
let expansionPanel = fixture.debugElement.nativeElement.querySelector('mat-expansion-panel-header');
|
||||
const expansionPanel = fixture.debugElement.nativeElement.querySelector('mat-expansion-panel-header');
|
||||
expansionPanel.click();
|
||||
fixture.detectChanges();
|
||||
let sortElement = fixture.debugElement.nativeElement.querySelector('[data-automation-id="adf-cloud-edit-task-property-sort"]');
|
||||
const sortElement = fixture.debugElement.nativeElement.querySelector('[data-automation-id="adf-cloud-edit-task-property-sort"]');
|
||||
sortElement.click();
|
||||
fixture.detectChanges();
|
||||
fixture.whenStable().then(() => {
|
||||
@@ -328,10 +328,10 @@ describe('EditTaskFilterCloudComponent', () => {
|
||||
|
||||
it('should display default filter actions', async(() => {
|
||||
component.toggleFilterActions = true;
|
||||
let taskFilterIDchange = new SimpleChange(undefined, 'mock-task-filter-id', true);
|
||||
const taskFilterIDchange = new SimpleChange(undefined, 'mock-task-filter-id', true);
|
||||
component.ngOnChanges({ 'id': taskFilterIDchange});
|
||||
fixture.detectChanges();
|
||||
let expansionPanel = fixture.debugElement.nativeElement.querySelector('mat-expansion-panel-header');
|
||||
const expansionPanel = fixture.debugElement.nativeElement.querySelector('mat-expansion-panel-header');
|
||||
expansionPanel.click();
|
||||
fixture.detectChanges();
|
||||
fixture.whenStable().then(() => {
|
||||
@@ -352,12 +352,12 @@ describe('EditTaskFilterCloudComponent', () => {
|
||||
it('should display filter actions when input actions are specified', async(() => {
|
||||
component.actions = ['save'];
|
||||
fixture.detectChanges();
|
||||
let taskFilterIDchange = new SimpleChange(undefined, 'mock-task-filter-id', true);
|
||||
const taskFilterIDchange = new SimpleChange(undefined, 'mock-task-filter-id', true);
|
||||
component.ngOnChanges({ 'id': taskFilterIDchange});
|
||||
fixture.detectChanges();
|
||||
component.toggleFilterActions = true;
|
||||
fixture.detectChanges();
|
||||
let expansionPanel = fixture.debugElement.nativeElement.querySelector('mat-expansion-panel-header');
|
||||
const expansionPanel = fixture.debugElement.nativeElement.querySelector('mat-expansion-panel-header');
|
||||
expansionPanel.click();
|
||||
fixture.detectChanges();
|
||||
fixture.whenStable().then(() => {
|
||||
@@ -372,10 +372,10 @@ describe('EditTaskFilterCloudComponent', () => {
|
||||
it('should display default filter actions if input is empty', async(() => {
|
||||
component.toggleFilterActions = true;
|
||||
component.actions = [];
|
||||
let taskFilterIDchange = new SimpleChange(undefined, 'mock-task-filter-id', true);
|
||||
const taskFilterIDchange = new SimpleChange(undefined, 'mock-task-filter-id', true);
|
||||
component.ngOnChanges({ 'id': taskFilterIDchange});
|
||||
fixture.detectChanges();
|
||||
let expansionPanel = fixture.debugElement.nativeElement.querySelector('mat-expansion-panel-header');
|
||||
const expansionPanel = fixture.debugElement.nativeElement.querySelector('mat-expansion-panel-header');
|
||||
expansionPanel.click();
|
||||
fixture.detectChanges();
|
||||
fixture.whenStable().then(() => {
|
||||
@@ -397,7 +397,7 @@ describe('EditTaskFilterCloudComponent', () => {
|
||||
describe('edit filter actions', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
let taskFilterIDchange = new SimpleChange(undefined, 'mock-task-filter-id', true);
|
||||
const taskFilterIDchange = new SimpleChange(undefined, 'mock-task-filter-id', true);
|
||||
component.ngOnChanges({ 'id': taskFilterIDchange});
|
||||
fixture.detectChanges();
|
||||
|
||||
@@ -406,12 +406,12 @@ describe('EditTaskFilterCloudComponent', () => {
|
||||
it('should emit save event and save the filter on click save button', async(() => {
|
||||
component.toggleFilterActions = true;
|
||||
const saveFilterSpy = spyOn(service, 'updateFilter').and.returnValue(fakeFilter);
|
||||
let saveSpy: jasmine.Spy = spyOn(component.action, 'emit');
|
||||
const saveSpy: jasmine.Spy = spyOn(component.action, 'emit');
|
||||
fixture.detectChanges();
|
||||
let expansionPanel = fixture.debugElement.nativeElement.querySelector('mat-expansion-panel-header');
|
||||
const expansionPanel = fixture.debugElement.nativeElement.querySelector('mat-expansion-panel-header');
|
||||
expansionPanel.click();
|
||||
fixture.detectChanges();
|
||||
let stateElement = fixture.debugElement.nativeElement.querySelector('[data-automation-id="adf-cloud-edit-task-property-sort"] .mat-select-trigger');
|
||||
const stateElement = fixture.debugElement.nativeElement.querySelector('[data-automation-id="adf-cloud-edit-task-property-sort"] .mat-select-trigger');
|
||||
stateElement.click();
|
||||
fixture.detectChanges();
|
||||
const sortOptions = fixture.debugElement.queryAll(By.css('.mat-option-text'));
|
||||
@@ -429,15 +429,15 @@ describe('EditTaskFilterCloudComponent', () => {
|
||||
it('should emit delete event and delete the filter on click of delete button', async(() => {
|
||||
component.toggleFilterActions = true;
|
||||
const deleteFilterSpy = spyOn(service, 'deleteFilter').and.callThrough();
|
||||
let deleteSpy: jasmine.Spy = spyOn(component.action, 'emit');
|
||||
const deleteSpy: jasmine.Spy = spyOn(component.action, 'emit');
|
||||
fixture.detectChanges();
|
||||
let expansionPanel = fixture.debugElement.nativeElement.querySelector('mat-expansion-panel-header');
|
||||
const expansionPanel = fixture.debugElement.nativeElement.querySelector('mat-expansion-panel-header');
|
||||
expansionPanel.click();
|
||||
fixture.detectChanges();
|
||||
let stateElement = fixture.debugElement.nativeElement.querySelector('[data-automation-id="adf-cloud-edit-task-property-sort"] .mat-select-trigger');
|
||||
const stateElement = fixture.debugElement.nativeElement.querySelector('[data-automation-id="adf-cloud-edit-task-property-sort"] .mat-select-trigger');
|
||||
stateElement.click();
|
||||
fixture.detectChanges();
|
||||
let deleteButton = fixture.debugElement.nativeElement.querySelector('[data-automation-id="adf-filter-action-delete"]');
|
||||
const deleteButton = fixture.debugElement.nativeElement.querySelector('[data-automation-id="adf-filter-action-delete"]');
|
||||
deleteButton.click();
|
||||
fixture.detectChanges();
|
||||
fixture.whenStable().then(() => {
|
||||
@@ -449,12 +449,12 @@ describe('EditTaskFilterCloudComponent', () => {
|
||||
it('should emit saveAs event and add filter on click saveAs button', async(() => {
|
||||
component.toggleFilterActions = true;
|
||||
const saveAsFilterSpy = spyOn(service, 'addFilter').and.callThrough();
|
||||
let saveAsSpy: jasmine.Spy = spyOn(component.action, 'emit');
|
||||
const saveAsSpy: jasmine.Spy = spyOn(component.action, 'emit');
|
||||
fixture.detectChanges();
|
||||
let expansionPanel = fixture.debugElement.nativeElement.querySelector('mat-expansion-panel-header');
|
||||
const expansionPanel = fixture.debugElement.nativeElement.querySelector('mat-expansion-panel-header');
|
||||
expansionPanel.click();
|
||||
fixture.detectChanges();
|
||||
let sortElement = fixture.debugElement.nativeElement.querySelector('[data-automation-id="adf-cloud-edit-task-property-sort"] .mat-select-trigger');
|
||||
const sortElement = fixture.debugElement.nativeElement.querySelector('[data-automation-id="adf-cloud-edit-task-property-sort"] .mat-select-trigger');
|
||||
sortElement.click();
|
||||
fixture.detectChanges();
|
||||
const saveAsButton = fixture.debugElement.nativeElement.querySelector('[data-automation-id="adf-filter-action-saveAs"]');
|
||||
|
@@ -259,7 +259,7 @@ export class EditTaskFilterCloudComponent implements OnInit, OnChanges {
|
||||
|
||||
onDateChanged(newDateValue: any, dateProperty: TaskFilterProperties) {
|
||||
if (newDateValue) {
|
||||
let momentDate = moment(newDateValue, this.FORMAT_DATE, true);
|
||||
const momentDate = moment(newDateValue, this.FORMAT_DATE, true);
|
||||
|
||||
if (momentDate.isValid()) {
|
||||
this.getPropertyController(dateProperty).setValue(momentDate.toDate());
|
||||
|
@@ -62,13 +62,13 @@ describe('TaskFilterDialogCloudComponent', () => {
|
||||
|
||||
it('should display title', () => {
|
||||
fixture.detectChanges();
|
||||
let titleElement = fixture.debugElement.nativeElement.querySelector('#adf-task-filter-dialog-title');
|
||||
const titleElement = fixture.debugElement.nativeElement.querySelector('#adf-task-filter-dialog-title');
|
||||
expect(titleElement.textContent).toEqual(' ADF_CLOUD_EDIT_TASK_FILTER.DIALOG.TITLE ');
|
||||
});
|
||||
|
||||
it('should enable save button if form is valid', async(() => {
|
||||
fixture.detectChanges();
|
||||
let saveButton = fixture.debugElement.nativeElement.querySelector('#adf-save-button-id');
|
||||
const saveButton = fixture.debugElement.nativeElement.querySelector('#adf-save-button-id');
|
||||
const inputElement = fixture.debugElement.nativeElement.querySelector('#adf-filter-name-id');
|
||||
inputElement.value = 'My custom Name';
|
||||
inputElement.dispatchEvent(new Event('input'));
|
||||
@@ -85,7 +85,7 @@ describe('TaskFilterDialogCloudComponent', () => {
|
||||
inputElement.value = '';
|
||||
inputElement.dispatchEvent(new Event('input'));
|
||||
fixture.whenStable().then(() => {
|
||||
let saveButton = fixture.debugElement.nativeElement.querySelector('#adf-save-button-id');
|
||||
const saveButton = fixture.debugElement.nativeElement.querySelector('#adf-save-button-id');
|
||||
fixture.detectChanges();
|
||||
expect(saveButton).toBeDefined();
|
||||
expect(saveButton.disabled).toBe(true);
|
||||
@@ -98,7 +98,7 @@ describe('TaskFilterDialogCloudComponent', () => {
|
||||
inputElement.value = 'My custom Name';
|
||||
inputElement.dispatchEvent(new Event('input'));
|
||||
fixture.whenStable().then(() => {
|
||||
let saveButton = fixture.debugElement.nativeElement.querySelector('#adf-save-button-id');
|
||||
const saveButton = fixture.debugElement.nativeElement.querySelector('#adf-save-button-id');
|
||||
fixture.detectChanges();
|
||||
saveButton.click();
|
||||
expect(saveButton).toBeDefined();
|
||||
@@ -109,7 +109,7 @@ describe('TaskFilterDialogCloudComponent', () => {
|
||||
|
||||
it('should able close dialog on click of cancel button', () => {
|
||||
component.data = { data: { name: '' } };
|
||||
let cancelButton = fixture.debugElement.nativeElement.querySelector('#adf-cancel-button-id');
|
||||
const cancelButton = fixture.debugElement.nativeElement.querySelector('#adf-cancel-button-id');
|
||||
fixture.detectChanges();
|
||||
cancelButton.click();
|
||||
expect(cancelButton).toBeDefined();
|
||||
|
@@ -31,21 +31,21 @@ describe('TaskFiltersCloudComponent', () => {
|
||||
|
||||
let taskFilterService: TaskFilterCloudService;
|
||||
|
||||
let fakeGlobalFilterObservable =
|
||||
const fakeGlobalFilterObservable =
|
||||
new Observable(function(observer) {
|
||||
observer.next(fakeGlobalFilter);
|
||||
observer.complete();
|
||||
});
|
||||
|
||||
let fakeGlobalFilterPromise = new Promise(function (resolve, reject) {
|
||||
const fakeGlobalFilterPromise = new Promise(function (resolve, reject) {
|
||||
resolve(fakeGlobalFilter);
|
||||
});
|
||||
|
||||
let mockErrorFilterList = {
|
||||
const mockErrorFilterList = {
|
||||
error: 'wrong request'
|
||||
};
|
||||
|
||||
let mockErrorFilterPromise = Promise.reject(mockErrorFilterList);
|
||||
const mockErrorFilterPromise = Promise.reject(mockErrorFilterList);
|
||||
|
||||
let component: TaskFiltersCloudComponent;
|
||||
let fixture: ComponentFixture<TaskFiltersCloudComponent>;
|
||||
@@ -64,14 +64,14 @@ describe('TaskFiltersCloudComponent', () => {
|
||||
|
||||
it('should attach specific icon for each filter if hasIcon is true', async(() => {
|
||||
spyOn(taskFilterService, 'getTaskListFilters').and.returnValue(fakeGlobalFilterObservable);
|
||||
let change = new SimpleChange(undefined, 'my-app-1', true);
|
||||
const change = new SimpleChange(undefined, 'my-app-1', true);
|
||||
component.ngOnChanges({'appName': change});
|
||||
fixture.detectChanges();
|
||||
component.showIcons = true;
|
||||
fixture.whenStable().then(() => {
|
||||
fixture.detectChanges();
|
||||
expect(component.filters.length).toBe(3);
|
||||
let filters = fixture.nativeElement.querySelectorAll('.adf-filters__entry-icon');
|
||||
const filters = fixture.nativeElement.querySelectorAll('.adf-filters__entry-icon');
|
||||
expect(filters.length).toBe(3);
|
||||
expect(filters[0].innerText).toContain('adjust');
|
||||
expect(filters[1].innerText).toContain('done');
|
||||
@@ -83,13 +83,13 @@ describe('TaskFiltersCloudComponent', () => {
|
||||
spyOn(taskFilterService, 'getTaskListFilters').and.returnValue(from(fakeGlobalFilterPromise));
|
||||
|
||||
component.showIcons = false;
|
||||
let change = new SimpleChange(undefined, 'my-app-1', true);
|
||||
const change = new SimpleChange(undefined, 'my-app-1', true);
|
||||
component.ngOnChanges({'appName': 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();
|
||||
});
|
||||
@@ -97,13 +97,13 @@ describe('TaskFiltersCloudComponent', () => {
|
||||
|
||||
it('should display the filters', async(() => {
|
||||
spyOn(taskFilterService, 'getTaskListFilters').and.returnValue(fakeGlobalFilterObservable);
|
||||
let change = new SimpleChange(undefined, 'my-app-1', true);
|
||||
const change = new SimpleChange(undefined, 'my-app-1', true);
|
||||
component.ngOnChanges({'appName': change});
|
||||
fixture.detectChanges();
|
||||
component.showIcons = true;
|
||||
fixture.whenStable().then(() => {
|
||||
fixture.detectChanges();
|
||||
let filters = fixture.debugElement.queryAll(By.css('mat-list-item[class*="adf-filters__entry"]'));
|
||||
const filters = fixture.debugElement.queryAll(By.css('mat-list-item[class*="adf-filters__entry"]'));
|
||||
expect(component.filters.length).toBe(3);
|
||||
expect(filters.length).toBe(3);
|
||||
expect(filters[0].nativeElement.innerText).toContain('FakeInvolvedTasks');
|
||||
@@ -116,7 +116,7 @@ describe('TaskFiltersCloudComponent', () => {
|
||||
spyOn(taskFilterService, 'getTaskListFilters').and.returnValue(from(mockErrorFilterPromise));
|
||||
|
||||
const appName = 'my-app-1';
|
||||
let change = new SimpleChange(null, appName, true);
|
||||
const change = new SimpleChange(null, appName, true);
|
||||
component.ngOnChanges({'appName': change});
|
||||
|
||||
component.error.subscribe((err) => {
|
||||
@@ -128,7 +128,7 @@ describe('TaskFiltersCloudComponent', () => {
|
||||
it('should return the filter task list', (done) => {
|
||||
spyOn(taskFilterService, 'getTaskListFilters').and.returnValue(from(fakeGlobalFilterPromise));
|
||||
const appName = 'my-app-1';
|
||||
let change = new SimpleChange(null, appName, true);
|
||||
const change = new SimpleChange(null, appName, true);
|
||||
component.ngOnChanges({ 'appName': change });
|
||||
|
||||
component.success.subscribe((res) => {
|
||||
@@ -142,7 +142,7 @@ describe('TaskFiltersCloudComponent', () => {
|
||||
it('should return the filter task list, filtered By Name', (done) => {
|
||||
spyOn(taskFilterService, 'getTaskListFilters').and.returnValue(from(fakeGlobalFilterPromise));
|
||||
const appName = 'my-app-1';
|
||||
let change = new SimpleChange(null, appName, true);
|
||||
const change = new SimpleChange(null, appName, true);
|
||||
component.ngOnChanges({ 'appName': change });
|
||||
|
||||
component.success.subscribe((res) => {
|
||||
@@ -159,7 +159,7 @@ describe('TaskFiltersCloudComponent', () => {
|
||||
spyOn(taskFilterService, 'getTaskListFilters').and.returnValue(fakeGlobalFilterObservable);
|
||||
|
||||
const appName = 'my-app-1';
|
||||
let change = new SimpleChange(null, appName, true);
|
||||
const change = new SimpleChange(null, appName, true);
|
||||
|
||||
fixture.detectChanges();
|
||||
component.ngOnChanges({ 'appName': change });
|
||||
@@ -177,7 +177,7 @@ describe('TaskFiltersCloudComponent', () => {
|
||||
|
||||
component.filterParam = new FilterParamsModel({ name: 'FakeMyTasks1' });
|
||||
const appName = 'my-app-1';
|
||||
let change = new SimpleChange(null, appName, true);
|
||||
const change = new SimpleChange(null, appName, true);
|
||||
|
||||
fixture.detectChanges();
|
||||
component.ngOnChanges({ 'appName': change });
|
||||
@@ -196,7 +196,7 @@ describe('TaskFiltersCloudComponent', () => {
|
||||
component.filterParam = new FilterParamsModel({ name: 'UnexistableFilter' });
|
||||
|
||||
const appName = 'my-app-1';
|
||||
let change = new SimpleChange(null, appName, true);
|
||||
const change = new SimpleChange(null, appName, true);
|
||||
|
||||
fixture.detectChanges();
|
||||
component.ngOnChanges({ 'appName': change });
|
||||
@@ -215,7 +215,7 @@ describe('TaskFiltersCloudComponent', () => {
|
||||
component.filterParam = new FilterParamsModel({ index: 2 });
|
||||
|
||||
const appName = 'my-app-1';
|
||||
let change = new SimpleChange(null, appName, true);
|
||||
const change = new SimpleChange(null, appName, true);
|
||||
|
||||
fixture.detectChanges();
|
||||
component.ngOnChanges({ 'appName': change });
|
||||
@@ -233,7 +233,7 @@ describe('TaskFiltersCloudComponent', () => {
|
||||
|
||||
component.filterParam = new FilterParamsModel({ id: 12 });
|
||||
const appName = 'my-app-1';
|
||||
let change = new SimpleChange(null, appName, true);
|
||||
const change = new SimpleChange(null, appName, true);
|
||||
|
||||
fixture.detectChanges();
|
||||
component.ngOnChanges({ 'appName': change });
|
||||
@@ -252,12 +252,12 @@ describe('TaskFiltersCloudComponent', () => {
|
||||
component.filterParam = new FilterParamsModel({ id: 12 });
|
||||
|
||||
const appName = 'my-app-1';
|
||||
let change = new SimpleChange(null, appName, true);
|
||||
const change = new SimpleChange(null, appName, true);
|
||||
component.ngOnChanges({ 'appName': change });
|
||||
|
||||
fixture.detectChanges();
|
||||
spyOn(component, 'selectFilterAndEmit').and.stub();
|
||||
let filterButton = fixture.debugElement.nativeElement.querySelector('span[data-automation-id="fake-my-tast1-filter"]');
|
||||
const filterButton = fixture.debugElement.nativeElement.querySelector('span[data-automation-id="fake-my-tast1-filter"]');
|
||||
filterButton.click();
|
||||
expect(component.selectFilterAndEmit).toHaveBeenCalledWith({id: fakeGlobalFilter[1].id});
|
||||
}));
|
||||
@@ -266,7 +266,7 @@ describe('TaskFiltersCloudComponent', () => {
|
||||
spyOn(component, 'getFilters').and.stub();
|
||||
const appName = 'my-app-1';
|
||||
|
||||
let change = new SimpleChange(null, appName, true);
|
||||
const change = new SimpleChange(null, appName, true);
|
||||
component.ngOnChanges({ 'appName': change });
|
||||
|
||||
expect(component.getFilters).toHaveBeenCalledWith(appName);
|
||||
@@ -313,14 +313,14 @@ describe('TaskFiltersCloudComponent', () => {
|
||||
spyOn(component, 'getFilters').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.getFilters).toHaveBeenCalledWith(appName);
|
||||
});
|
||||
|
||||
it('should return the current filter after one is selected', () => {
|
||||
let filter = new FilterParamsModel({ name: 'FakeInvolvedTasks' });
|
||||
const filter = new FilterParamsModel({ name: 'FakeInvolvedTasks' });
|
||||
component.filters = fakeGlobalFilter;
|
||||
|
||||
expect(component.currentFilter).toBeUndefined();
|
||||
|
@@ -36,10 +36,10 @@ export class TaskFilterCloudService {
|
||||
* @returns Observable of default filters just created
|
||||
*/
|
||||
private createDefaultFilters(appName: string) {
|
||||
let myTasksFilter = this.getMyTasksFilterInstance(appName);
|
||||
const myTasksFilter = this.getMyTasksFilterInstance(appName);
|
||||
this.addFilter(myTasksFilter);
|
||||
|
||||
let completedTasksFilter = this.getCompletedTasksFilterInstance(appName);
|
||||
const completedTasksFilter = this.getCompletedTasksFilterInstance(appName);
|
||||
this.addFilter(completedTasksFilter);
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ export class TaskFilterCloudService {
|
||||
*/
|
||||
getTaskListFilters(appName?: string): Observable<TaskFilterCloudModel[]> {
|
||||
const username = this.getUsername();
|
||||
let key = `task-filters-${appName}-${username}`;
|
||||
const key = `task-filters-${appName}-${username}`;
|
||||
const filters = JSON.parse(this.storage.getItem(key) || '[]');
|
||||
|
||||
if (filters.length === 0) {
|
||||
@@ -69,7 +69,7 @@ export class TaskFilterCloudService {
|
||||
*/
|
||||
getTaskFilterById(appName: string, id: string): TaskFilterCloudModel {
|
||||
const username = this.getUsername();
|
||||
let key = `task-filters-${appName}-${username}`;
|
||||
const key = `task-filters-${appName}-${username}`;
|
||||
let filters = [];
|
||||
filters = JSON.parse(this.storage.getItem(key)) || [];
|
||||
return filters.filter((filterTmp: TaskFilterCloudModel) => id === filterTmp.id)[0];
|
||||
@@ -83,7 +83,7 @@ export class TaskFilterCloudService {
|
||||
addFilter(filter: TaskFilterCloudModel) {
|
||||
const username = this.getUsername();
|
||||
const key = `task-filters-${filter.appName}-${username}`;
|
||||
let filters = JSON.parse(this.storage.getItem(key) || '[]');
|
||||
const filters = JSON.parse(this.storage.getItem(key) || '[]');
|
||||
|
||||
filters.push(filter);
|
||||
|
||||
@@ -104,8 +104,8 @@ export class TaskFilterCloudService {
|
||||
const username = this.getUsername();
|
||||
const key = `task-filters-${filter.appName}-${username}`;
|
||||
if (key) {
|
||||
let filters = JSON.parse(this.storage.getItem(key) || '[]');
|
||||
let itemIndex = filters.findIndex((flt: TaskFilterCloudModel) => flt.id === filter.id);
|
||||
const filters = JSON.parse(this.storage.getItem(key) || '[]');
|
||||
const itemIndex = filters.findIndex((flt: TaskFilterCloudModel) => flt.id === filter.id);
|
||||
filters[itemIndex] = filter;
|
||||
this.storage.setItem(key, JSON.stringify(filters));
|
||||
this.addFiltersToStream(filters);
|
||||
|
@@ -62,7 +62,7 @@ describe('TaskHeaderCloudComponent', () => {
|
||||
fixture.detectChanges();
|
||||
|
||||
fixture.whenStable().then(() => {
|
||||
let formNameEl = fixture.debugElement.query(By.css('[data-automation-id="card-textitem-value-assignee"] span'));
|
||||
const formNameEl = fixture.debugElement.query(By.css('[data-automation-id="card-textitem-value-assignee"] span'));
|
||||
expect(formNameEl.nativeElement.innerText).toBe('Wilbur Adams');
|
||||
});
|
||||
}));
|
||||
@@ -73,7 +73,7 @@ describe('TaskHeaderCloudComponent', () => {
|
||||
fixture.detectChanges();
|
||||
|
||||
fixture.whenStable().then(() => {
|
||||
let valueEl = fixture.debugElement.query(By.css('[data-automation-id="card-textitem-value-assignee"] span'));
|
||||
const valueEl = fixture.debugElement.query(By.css('[data-automation-id="card-textitem-value-assignee"] span'));
|
||||
expect(valueEl.nativeElement.innerText).toBe('ADF_CLOUD_TASK_HEADER.PROPERTIES.ASSIGNEE_DEFAULT');
|
||||
});
|
||||
|
||||
@@ -84,7 +84,7 @@ describe('TaskHeaderCloudComponent', () => {
|
||||
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('5');
|
||||
});
|
||||
}));
|
||||
@@ -94,7 +94,7 @@ describe('TaskHeaderCloudComponent', () => {
|
||||
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('Dec 18 2018');
|
||||
});
|
||||
}));
|
||||
@@ -105,7 +105,7 @@ describe('TaskHeaderCloudComponent', () => {
|
||||
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_CLOUD_TASK_HEADER.PROPERTIES.DUE_DATE_DEFAULT');
|
||||
});
|
||||
}));
|
||||
@@ -116,7 +116,7 @@ describe('TaskHeaderCloudComponent', () => {
|
||||
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_CLOUD_TASK_HEADER.PROPERTIES.PARENT_NAME_DEFAULT');
|
||||
});
|
||||
}));
|
||||
@@ -127,7 +127,7 @@ describe('TaskHeaderCloudComponent', () => {
|
||||
spyOn(appConfigService, 'get').and.returnValue(['assignee', 'status']);
|
||||
component.ngOnInit();
|
||||
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();
|
||||
@@ -145,7 +145,7 @@ describe('TaskHeaderCloudComponent', () => {
|
||||
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);
|
||||
|
@@ -127,7 +127,7 @@ describe('TaskListCloudComponent', () => {
|
||||
|
||||
it('should return the results if an application name is given', (done) => {
|
||||
spyOn(taskListCloudService, 'getTaskByRequest').and.returnValue(of(fakeGlobalTask));
|
||||
let appName = new SimpleChange(null, 'FAKE-APP-NAME', true);
|
||||
const appName = new SimpleChange(null, 'FAKE-APP-NAME', true);
|
||||
component.success.subscribe((res) => {
|
||||
expect(res).toBeDefined();
|
||||
expect(component.rows).toBeDefined();
|
||||
@@ -174,12 +174,12 @@ describe('TaskListCloudComponent', () => {
|
||||
});
|
||||
|
||||
it('should emit row click event', (done) => {
|
||||
let row = new ObjectDataRow({
|
||||
const row = new ObjectDataRow({
|
||||
entry: {
|
||||
id: '999'
|
||||
}
|
||||
});
|
||||
let rowEvent = new DataRowEvent(row, null);
|
||||
const rowEvent = new DataRowEvent(row, null);
|
||||
component.rowClick.subscribe((taskId) => {
|
||||
expect(taskId).toEqual('999');
|
||||
expect(component.getCurrentId()).toEqual('999');
|
||||
|
@@ -180,7 +180,7 @@ export class TaskListCloudComponent extends DataTableSchema implements OnChanges
|
||||
}
|
||||
|
||||
private isPropertyChanged(changes: SimpleChanges): boolean {
|
||||
for (let property in changes) {
|
||||
for (const property in changes) {
|
||||
if (changes.hasOwnProperty(property)) {
|
||||
if (changes[property] &&
|
||||
(changes[property].currentValue !== changes[property].previousValue)) {
|
||||
@@ -250,7 +250,7 @@ export class TaskListCloudComponent extends DataTableSchema implements OnChanges
|
||||
|
||||
private createRequestNode() {
|
||||
|
||||
let requestNode = {
|
||||
const requestNode = {
|
||||
appName: this.appName,
|
||||
assignee: this.assignee,
|
||||
id: this.id,
|
||||
|
@@ -71,7 +71,7 @@ describe('Activiti TaskList Cloud Service', () => {
|
||||
}));
|
||||
|
||||
it('should return the tasks', (done) => {
|
||||
let taskRequest: TaskQueryCloudRequestModel = <TaskQueryCloudRequestModel> { appName: 'fakeName' };
|
||||
const taskRequest: TaskQueryCloudRequestModel = <TaskQueryCloudRequestModel> { appName: 'fakeName' };
|
||||
spyOn(alfrescoApiMock, 'getInstance').and.callFake(returnFakeTaskListResults);
|
||||
service.getTaskByRequest(taskRequest).subscribe((res) => {
|
||||
expect(res).toBeDefined();
|
||||
@@ -84,7 +84,7 @@ describe('Activiti TaskList Cloud Service', () => {
|
||||
});
|
||||
|
||||
it('should append to the call all the parameters', (done) => {
|
||||
let taskRequest: TaskQueryCloudRequestModel = <TaskQueryCloudRequestModel> { appName: 'fakeName', skipCount: 0, maxItems: 20, service: 'fake-service' };
|
||||
const taskRequest: TaskQueryCloudRequestModel = <TaskQueryCloudRequestModel> { appName: 'fakeName', skipCount: 0, maxItems: 20, service: 'fake-service' };
|
||||
spyOn(alfrescoApiMock, 'getInstance').and.callFake(returnCallQueryParameters);
|
||||
service.getTaskByRequest(taskRequest).subscribe((res) => {
|
||||
expect(res).toBeDefined();
|
||||
@@ -97,7 +97,7 @@ describe('Activiti TaskList Cloud Service', () => {
|
||||
});
|
||||
|
||||
it('should concat the app name to the request url', (done) => {
|
||||
let taskRequest: TaskQueryCloudRequestModel = <TaskQueryCloudRequestModel> { appName: 'fakeName', skipCount: 0, maxItems: 20, service: 'fake-service' };
|
||||
const taskRequest: TaskQueryCloudRequestModel = <TaskQueryCloudRequestModel> { appName: 'fakeName', skipCount: 0, maxItems: 20, service: 'fake-service' };
|
||||
spyOn(alfrescoApiMock, 'getInstance').and.callFake(returnCallUrl);
|
||||
service.getTaskByRequest(taskRequest).subscribe((requestUrl) => {
|
||||
expect(requestUrl).toBeDefined();
|
||||
@@ -108,7 +108,7 @@ describe('Activiti TaskList Cloud Service', () => {
|
||||
});
|
||||
|
||||
it('should concat the sorting to append as parameters', (done) => {
|
||||
let taskRequest: TaskQueryCloudRequestModel = <TaskQueryCloudRequestModel> { appName: 'fakeName', skipCount: 0, maxItems: 20, service: 'fake-service',
|
||||
const taskRequest: TaskQueryCloudRequestModel = <TaskQueryCloudRequestModel> { appName: 'fakeName', skipCount: 0, maxItems: 20, service: 'fake-service',
|
||||
sorting: [{ orderBy: 'NAME', direction: 'DESC'}, { orderBy: 'TITLE', direction: 'ASC'}] };
|
||||
spyOn(alfrescoApiMock, 'getInstance').and.callFake(returnCallQueryParameters);
|
||||
service.getTaskByRequest(taskRequest).subscribe((res) => {
|
||||
@@ -120,7 +120,7 @@ describe('Activiti TaskList Cloud Service', () => {
|
||||
});
|
||||
|
||||
it('should return an error when app name is not specified', (done) => {
|
||||
let taskRequest: TaskQueryCloudRequestModel = <TaskQueryCloudRequestModel> { appName: null };
|
||||
const taskRequest: TaskQueryCloudRequestModel = <TaskQueryCloudRequestModel> { appName: null };
|
||||
spyOn(alfrescoApiMock, 'getInstance').and.callFake(returnCallUrl);
|
||||
service.getTaskByRequest(taskRequest).subscribe(
|
||||
() => { },
|
||||
|
@@ -39,9 +39,9 @@ export class TaskListCloudService {
|
||||
*/
|
||||
getTaskByRequest(requestNode: TaskQueryCloudRequestModel): Observable<any> {
|
||||
if (requestNode.appName) {
|
||||
let queryUrl = this.buildQueryUrl(requestNode);
|
||||
let queryParams = this.buildQueryParams(requestNode);
|
||||
let sortingParams = this.buildSortingParam(requestNode.sorting);
|
||||
const queryUrl = this.buildQueryUrl(requestNode);
|
||||
const queryParams = this.buildQueryParams(requestNode);
|
||||
const sortingParams = this.buildSortingParam(requestNode.sorting);
|
||||
if (sortingParams) {
|
||||
queryParams['sort'] = sortingParams;
|
||||
}
|
||||
@@ -62,8 +62,8 @@ export class TaskListCloudService {
|
||||
}
|
||||
|
||||
private buildQueryParams(requestNode: TaskQueryCloudRequestModel) {
|
||||
let queryParam = {};
|
||||
for (let property in requestNode) {
|
||||
const queryParam = {};
|
||||
for (const property in requestNode) {
|
||||
if (requestNode.hasOwnProperty(property) &&
|
||||
!this.isExcludedField(property) &&
|
||||
this.isPropertyValueValid(requestNode, property)) {
|
||||
@@ -84,7 +84,7 @@ export class TaskListCloudService {
|
||||
private buildSortingParam(sortings: TaskListCloudSortingModel[]): string {
|
||||
let finalSorting: string = '';
|
||||
if (sortings) {
|
||||
for (let sort of sortings) {
|
||||
for (const sort of sortings) {
|
||||
if (!finalSorting) {
|
||||
finalSorting = `${sort.orderBy},${sort.direction}`;
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user