[ADF-3591] spellcheck support for code (#3827)

* setup spellcheck
This commit is contained in:
Denys Vuika
2018-10-23 15:05:38 +01:00
committed by Eugenio Romano
parent 53d96679ea
commit e39a2b149b
262 changed files with 1561 additions and 1005 deletions

View File

@@ -47,7 +47,7 @@ export class ChecklistComponent implements OnChanges {
@Output()
checklistTaskCreated: EventEmitter<TaskDetailsModel> = new EventEmitter<TaskDetailsModel>();
/** Emitted when a checklitst task is deleted. */
/** Emitted when a checklist task is deleted. */
@Output()
checklistTaskDeleted: EventEmitter<string> = new EventEmitter<string>();

View File

@@ -11,7 +11,7 @@
<input matInput
class="adf-grid-full-width"
placeholder="{{'ADF_TASK_LIST.START_TASK.FORM.LABEL.NAME'|translate}}"
[(ngModel)]="startTaskmodel.name"
[(ngModel)]="startTaskModel.name"
required
id="name_id">
</mat-form-field>
@@ -23,7 +23,7 @@
matInput
class="adf-grid-full-width"
placeholder="{{'ADF_TASK_LIST.START_TASK.FORM.LABEL.DESCRIPTION'|translate}}"
[(ngModel)]="startTaskmodel.description"
[(ngModel)]="startTaskModel.description"
rows="1"
id="description_id">
</textarea>
@@ -40,7 +40,7 @@
(keyup)="onDateChanged($event.srcElement.value)"
(dateInput)="onDateChanged($event.value)"
placeholder="{{'ADF_TASK_LIST.START_TASK.FORM.LABEL.DATE'|translate}}"
[(ngModel)]="startTaskmodel.dueDate"
[(ngModel)]="startTaskModel.dueDate"
id="date_id">
<mat-datepicker-toggle matSuffix [for]="taskDatePicker"></mat-datepicker-toggle>
<mat-datepicker #taskDatePicker
@@ -79,7 +79,7 @@
<button mat-button (click)="onCancel()" id="button-cancel">
{{'ADF_TASK_LIST.START_TASK.FORM.ACTION.CANCEL'|translate}}
</button>
<button color="primary" mat-button [disabled]="!startTaskmodel.name || dateError" (click)="start()" id="button-start">
<button color="primary" mat-button [disabled]="!startTaskModel.name || dateError" (click)="start()" id="button-start">
{{'ADF_TASK_LIST.START_TASK.FORM.ACTION.START'|translate}}
</button>
</div>

View File

@@ -30,7 +30,7 @@ describe('StartTaskComponent', () => {
let fixture: ComponentFixture<StartTaskComponent>;
let service: TaskListService;
let element: HTMLElement;
let getFormlistSpy: jasmine.Spy;
let getFormListSpy: jasmine.Spy;
let createNewTaskSpy: jasmine.Spy;
let fakeForms = [
{
@@ -54,7 +54,7 @@ describe('StartTaskComponent', () => {
element = fixture.nativeElement;
service = TestBed.get(TaskListService);
getFormlistSpy = spyOn(service, 'getFormList').and.returnValue(of(fakeForms));
getFormListSpy = spyOn(service, 'getFormList').and.returnValue(of(fakeForms));
fixture.detectChanges();
}));
@@ -63,13 +63,13 @@ describe('StartTaskComponent', () => {
expect(fixture.componentInstance instanceof StartTaskComponent).toBe(true, 'should create StartTaskComponent');
});
it('should fetch fakeform on ngonint', () => {
it('should fetch fake form on init', () => {
component.ngOnInit();
expect(component.forms).toEqual(fakeForms);
expect(component.forms[0].name).toEqual('Display Data');
expect(component.forms[1].name).toEqual('Employee Info');
expect(component.forms[1].id).toEqual(1111);
expect(getFormlistSpy).toHaveBeenCalled();
expect(getFormListSpy).toHaveBeenCalled();
});
describe('create task', () => {
@@ -88,7 +88,7 @@ describe('StartTaskComponent', () => {
it('should create new task when start is clicked', () => {
let successSpy = spyOn(component.success, 'emit');
component.appId = 42;
component.startTaskmodel = new StartTaskModel(startTaskMock);
component.startTaskModel = new StartTaskModel(startTaskMock);
fixture.detectChanges();
let createTaskButton = <HTMLElement> element.querySelector('#button-start');
createTaskButton.click();
@@ -98,7 +98,7 @@ describe('StartTaskComponent', () => {
it('should send on success event when the task is started', () => {
let successSpy = spyOn(component.success, 'emit');
component.appId = 42;
component.startTaskmodel = new StartTaskModel(startTaskMock);
component.startTaskModel = new StartTaskModel(startTaskMock);
fixture.detectChanges();
let createTaskButton = <HTMLElement> element.querySelector('#button-start');
createTaskButton.click();
@@ -113,7 +113,7 @@ describe('StartTaskComponent', () => {
it('should send on success event when only name is given', () => {
let successSpy = spyOn(component.success, 'emit');
component.appId = 42;
component.startTaskmodel.name = 'fakeName';
component.startTaskModel.name = 'fakeName';
fixture.detectChanges();
let createTaskButton = <HTMLElement> element.querySelector('#button-start');
createTaskButton.click();
@@ -122,7 +122,7 @@ describe('StartTaskComponent', () => {
it('should not emit success event when data not present', () => {
let successSpy = spyOn(component.success, 'emit');
component.startTaskmodel = new StartTaskModel(null);
component.startTaskModel = new StartTaskModel(null);
fixture.detectChanges();
let createTaskButton = <HTMLElement> element.querySelector('#button-start');
createTaskButton.click();
@@ -154,7 +154,7 @@ describe('StartTaskComponent', () => {
it('should attach form to the task when a form is selected', () => {
let successSpy = spyOn(component.success, 'emit');
component.appId = 42;
component.startTaskmodel = new StartTaskModel(startTaskMock);
component.startTaskModel = new StartTaskModel(startTaskMock);
component.formKey = 1204;
fixture.detectChanges();
let createTaskButton = <HTMLElement> element.querySelector('#button-start');
@@ -170,7 +170,7 @@ describe('StartTaskComponent', () => {
it('should not attach form to the task when a no form is selected', () => {
let successSpy = spyOn(component.success, 'emit');
component.appId = 42;
component.startTaskmodel = new StartTaskModel(startTaskMock);
component.startTaskModel = new StartTaskModel(startTaskMock);
component.formKey = null;
fixture.detectChanges();
let createTaskButton = <HTMLElement> element.querySelector('#button-start');
@@ -215,7 +215,7 @@ describe('StartTaskComponent', () => {
it('should assign task when an assignee is selected', () => {
let successSpy = spyOn(component.success, 'emit');
component.appId = 42;
component.startTaskmodel = new StartTaskModel(startTaskMock);
component.startTaskModel = new StartTaskModel(startTaskMock);
component.formKey = 1204;
component.assigneeId = testUser.id;
fixture.detectChanges();
@@ -234,7 +234,7 @@ describe('StartTaskComponent', () => {
component.appId = 42;
component.formKey = 1204;
component.assigneeId = null;
component.startTaskmodel = new StartTaskModel(startTaskMock);
component.startTaskModel = new StartTaskModel(startTaskMock);
fixture.detectChanges();
let createTaskButton = <HTMLElement> element.querySelector('#button-start');
createTaskButton.click();
@@ -249,7 +249,7 @@ describe('StartTaskComponent', () => {
it('should assign task with id of selected user assigned', () => {
let successSpy = spyOn(component.success, 'emit');
component.appId = 42;
component.startTaskmodel = new StartTaskModel(startTaskMock);
component.startTaskModel = new StartTaskModel(startTaskMock);
component.formKey = 1204;
component.getAssigneeId(testUser.id);
fixture.detectChanges();
@@ -264,7 +264,7 @@ describe('StartTaskComponent', () => {
});
});
it('should not attach a form when a form id is not slected', () => {
it('should not attach a form when a form id is not selected', () => {
let attachFormToATask = spyOn(service, 'attachFormToATask').and.returnValue(of());
spyOn(service, 'createNewTask').and.callFake(
function() {
@@ -274,7 +274,7 @@ describe('StartTaskComponent', () => {
});
});
let createTaskButton = <HTMLElement> element.querySelector('#button-start');
component.startTaskmodel.name = 'fake-name';
component.startTaskModel.name = 'fake-name';
fixture.detectChanges();
createTaskButton.click();
expect(attachFormToATask).not.toHaveBeenCalled();
@@ -294,7 +294,7 @@ describe('StartTaskComponent', () => {
});
it('should disable start button if name is empty', () => {
component.startTaskmodel.name = '';
component.startTaskModel.name = '';
fixture.detectChanges();
let createTaskButton = fixture.nativeElement.querySelector('#button-start');
expect(createTaskButton.disabled).toBeTruthy();
@@ -303,7 +303,7 @@ describe('StartTaskComponent', () => {
it('should cancel start task on cancel button click', () => {
let emitSpy = spyOn(component.cancel, 'emit');
let cancelTaskButton = fixture.nativeElement.querySelector('#button-cancel');
component.startTaskmodel.name = '';
component.startTaskModel.name = '';
fixture.detectChanges();
cancelTaskButton.click();
expect(emitSpy).not.toBeNull();
@@ -311,7 +311,7 @@ describe('StartTaskComponent', () => {
});
it('should enable start button if name is filled out', () => {
component.startTaskmodel.name = 'fakeName';
component.startTaskModel.name = 'fakeName';
fixture.detectChanges();
let createTaskButton = fixture.nativeElement.querySelector('#button-start');
expect(createTaskButton.disabled).toBeFalsy();
@@ -324,28 +324,28 @@ describe('StartTaskComponent', () => {
expect(selectElement.attributes['aria-label'].value).toContain('ADF_TASK_LIST.START_TASK.FORM.LABEL.FORM');
});
it('should get formatted fullname', () => {
it('should get formatted full name', () => {
let testUser1 = {'id': 1001, 'firstName': 'Wilbur', 'lastName': 'Adams', 'email': 'wilbur@app.activiti.com'};
let testUser2 = {'id': 1002, 'firstName': '', 'lastName': 'Adams', 'email': 'adams@app.activiti.com'};
let testUser3 = {'id': 1003, 'firstName': 'Wilbur', 'lastName': '', 'email': 'wilbur@app.activiti.com'};
let testUser4 = {'id': 1004, 'firstName': '', 'lastName': '', 'email': 'test@app.activiti.com'};
let testFullname1 = component.getDisplayUser(testUser1.firstName, testUser1.lastName, ' ');
let testFullname2 = component.getDisplayUser(testUser2.firstName, testUser2.lastName, ' ');
let testFullname3 = component.getDisplayUser(testUser3.firstName, testUser3.lastName, ' ');
let testFullname4 = component.getDisplayUser(testUser4.firstName, testUser4.lastName, ' ');
let testFullName1 = component.getDisplayUser(testUser1.firstName, testUser1.lastName, ' ');
let testFullName2 = component.getDisplayUser(testUser2.firstName, testUser2.lastName, ' ');
let testFullName3 = component.getDisplayUser(testUser3.firstName, testUser3.lastName, ' ');
let testFullName4 = component.getDisplayUser(testUser4.firstName, testUser4.lastName, ' ');
expect(testFullname1.trim()).toBe('Wilbur Adams');
expect(testFullname2.trim()).toBe('Adams');
expect(testFullname3.trim()).toBe('Wilbur');
expect(testFullname4.trim()).toBe('');
expect(testFullName1.trim()).toBe('Wilbur Adams');
expect(testFullName2.trim()).toBe('Adams');
expect(testFullName3.trim()).toBe('Wilbur');
expect(testFullName4.trim()).toBe('');
});
it('should emit error when there is an error while creating task', () => {
let errorSpy = spyOn(component.error, 'emit');
spyOn(service, 'createNewTask').and.returnValue(throwError({}));
let createTaskButton = <HTMLElement> element.querySelector('#button-start');
component.startTaskmodel.name = 'fake-name';
component.startTaskModel.name = 'fake-name';
fixture.detectChanges();
createTaskButton.click();
expect(errorSpy).toHaveBeenCalled();

View File

@@ -57,7 +57,7 @@ export class StartTaskComponent implements OnInit {
@Output()
error: EventEmitter<any> = new EventEmitter<any>();
startTaskmodel: StartTaskModel = new StartTaskModel();
startTaskModel: StartTaskModel = new StartTaskModel();
forms: Form[];
@@ -92,11 +92,11 @@ export class StartTaskComponent implements OnInit {
}
public start(): void {
if (this.startTaskmodel.name) {
if (this.startTaskModel.name) {
if (this.appId) {
this.startTaskmodel.category = this.appId.toString();
this.startTaskModel.category = this.appId.toString();
}
this.taskService.createNewTask(new TaskDetailsModel(this.startTaskmodel))
this.taskService.createNewTask(new TaskDetailsModel(this.startTaskModel))
.pipe(
switchMap((createRes: any) =>
this.attachForm(createRes.id, this.formKey).pipe(
@@ -181,7 +181,7 @@ export class StartTaskComponent implements OnInit {
clearDateInput() {
const emptyValue = '';
this.startTaskmodel.dueDate = emptyValue;
this.startTaskModel.dueDate = emptyValue;
this.onDateChanged(emptyValue);
}
}

View File

@@ -120,7 +120,8 @@ describe('TaskAuditDirective', () => {
component.fileName = 'FakeAuditName';
component.format = 'json';
component.download = true;
const auditJson = { taskId: '77', taskName: 'Fake Task Naem', assignee: 'FirstName LastName', formData: [], selectedOutcome: null, comments: [] };
const auditJson = { taskId: '77', taskName: 'Fake Task Name', assignee: 'FirstName LastName', formData: [], selectedOutcome: null, comments: [] };
spyOn(service, 'fetchTaskAuditJsonById').and.returnValue(of(auditJson));
spyOn(component, 'onAuditClick').and.callThrough();
@@ -137,7 +138,7 @@ describe('TaskAuditDirective', () => {
}));
it('should fetch the pdf Blob as default when the format is UNKNOW', fakeAsync(() => {
it('should fetch the pdf Blob as default when the format is UNKNOWN', fakeAsync(() => {
component.fileName = 'FakeAuditName';
component.format = 'fakeFormat';
let blob = createFakePdfBlob();

View File

@@ -111,7 +111,7 @@
<adf-info-drawer-tab label="{{ 'ADF_TASK_LIST.DETAILS.LABELS.INFO_DRAWER_TAB_ACTIVITY_TITLE' | translate }}">
<mat-card *ngIf="showComments">
<mat-card-content>
<adf-comments #activiticomments
<adf-comments #activitiComments
[readOnly]="isReadOnlyComment()"
[taskId]="taskDetails.id">
</adf-comments>
@@ -123,7 +123,7 @@
<div *ngIf="showHeaderContent" class="adf-task-details-core-sidebar-checklist">
<div *ngIf="showChecklist">
<adf-checklist #activitichecklist
<adf-checklist #activitiChecklist
[readOnly]="internalReadOnlyForm"
[taskId]="taskDetails.id"
[assignee]="taskDetails?.assignee?.id"

View File

@@ -395,7 +395,7 @@ describe('TaskDetailsComponent', () => {
component.taskDetails.endDate = new Date('2017-10-03T17:03:57.311+0000');
fixture.detectChanges();
expect((component.activiticomments as any).readOnly).toBe(true);
expect((component.activitiComments as any).readOnly).toBe(true);
});
it('should comments be readonly if the task is complete and user are NOT involved', () => {
@@ -407,7 +407,7 @@ describe('TaskDetailsComponent', () => {
component.taskDetails.endDate = new Date('2017-10-03T17:03:57.311+0000');
fixture.detectChanges();
expect((component.activiticomments as any).readOnly).toBe(true);
expect((component.activitiComments as any).readOnly).toBe(true);
});
it('should comments NOT be readonly if the task is NOT complete and user are NOT involved', () => {
@@ -419,7 +419,7 @@ describe('TaskDetailsComponent', () => {
component.taskDetails.endDate = null;
fixture.detectChanges();
expect((component.activiticomments as any).readOnly).toBe(false);
expect((component.activitiComments as any).readOnly).toBe(false);
});
it('should comments NOT be readonly if the task is complete and user are involved', () => {
@@ -431,7 +431,7 @@ describe('TaskDetailsComponent', () => {
component.taskDetails.endDate = new Date('2017-10-03T17:03:57.311+0000');
fixture.detectChanges();
expect((component.activiticomments as any).readOnly).toBe(false);
expect((component.activitiComments as any).readOnly).toBe(false);
});
it('should comments be present if showComments is true', () => {
@@ -442,7 +442,7 @@ describe('TaskDetailsComponent', () => {
component.taskDetails = new TaskDetailsModel(taskDetailsMock);
fixture.detectChanges();
expect(component.activiticomments).toBeDefined();
expect(component.activitiComments).toBeDefined();
});
it('should comments NOT be present if showComments is false', () => {
@@ -452,7 +452,7 @@ describe('TaskDetailsComponent', () => {
component.taskDetails = new TaskDetailsModel(taskDetailsMock);
fixture.detectChanges();
expect(component.activiticomments).not.toBeDefined();
expect(component.activitiComments).not.toBeDefined();
});
});

View File

@@ -53,11 +53,11 @@ import { share } from 'rxjs/operators';
})
export class TaskDetailsComponent implements OnInit, OnChanges {
@ViewChild('activiticomments')
activiticomments: CommentsComponent;
@ViewChild('activitiComments')
activitiComments: CommentsComponent;
@ViewChild('activitichecklist')
activitichecklist: any;
@ViewChild('activitiChecklist')
activitiChecklist: any;
@ViewChild('errorDialog')
errorDialog: TemplateRef<any>;

View File

@@ -333,7 +333,7 @@ describe('TaskFiltersComponent', () => {
expect(component.getCurrentFilter()).toBe(filter);
});
it('should load default list when appid is null', () => {
it('should load default list when app id is null', () => {
spyOn(component, 'getFiltersByAppId').and.stub();
let change = new SimpleChange(undefined, null, true);

View File

@@ -214,7 +214,7 @@ describe('TaskHeaderComponent', () => {
});
}));
it('should display the claime button if the task is claimable by candidates members', async(() => {
it('should display the claim button if the task is claimable by candidates members', async(() => {
component.taskDetails = new TaskDetailsModel(claimableTaskDetailsMock);
component.refreshData();
fixture.detectChanges();
@@ -240,7 +240,7 @@ describe('TaskHeaderComponent', () => {
});
}));
it('should call the service\'s unclaim method on unclaiming', async(() => {
it('should call the service unclaim method on un-claiming', async(() => {
spyOn(service, 'unclaimTask').and.returnValue(of(true));
component.taskDetails = new TaskDetailsModel(claimedTaskDetailsMock);
component.refreshData();
@@ -254,7 +254,7 @@ describe('TaskHeaderComponent', () => {
});
}));
it('should trigger the unclaim event on successful unclaiming', async(() => {
it('should trigger the unclaim event on successful un-claiming', async(() => {
let unclaimed: boolean = false;
spyOn(service, 'unclaimTask').and.returnValue(of(true));
component.taskDetails = new TaskDetailsModel(claimedTaskDetailsMock);

View File

@@ -226,7 +226,7 @@ export class TaskHeaderComponent implements OnChanges, OnInit {
}
/**
* Returns true if the task is assigne to logged in user
* Returns true if the task is assigned to logged in user
*/
public isAssignedTo(userId): boolean {
return this.hasAssignee() ? this.taskDetails.assignee.id === userId : false;

View File

@@ -23,7 +23,7 @@ import { DataRowEvent, ObjectDataRow } from '@alfresco/adf-core';
import { TaskListService } from '../services/tasklist.service';
import { TaskListComponent } from './task-list.component';
import { ProcessTestingModule } from '../../testing/process.testing.module';
import { fakeGlobalTask, fakeCutomSchema } from '../../mock';
import { fakeGlobalTask, fakeCustomSchema } from '../../mock';
import { TranslateService } from '@ngx-translate/core';
import { of } from 'rxjs';
@@ -50,7 +50,7 @@ describe('TaskListComponent', () => {
appConfig.config = Object.assign(appConfig.config, {
'adf-task-list': {
'presets': {
'fakeCutomSchema': [
'fakeCustomSchema': [
{
'key': 'fakeName',
'type': 'text',
@@ -86,14 +86,14 @@ describe('TaskListComponent', () => {
});
it('should use the custom schemaColumn from app.config.json', () => {
component.presetColumn = 'fakeCutomSchema';
component.presetColumn = 'fakeCustomSchema';
component.ngAfterContentInit();
fixture.detectChanges();
expect(component.columns).toEqual(fakeCutomSchema);
expect(component.columns).toEqual(fakeCustomSchema);
});
it('should fetch custom schemaColumn when the input presetColumn is defined', () => {
component.presetColumn = 'fakeCutomSchema';
component.presetColumn = 'fakeCustomSchema';
fixture.detectChanges();
expect(component.columns).toBeDefined();
expect(component.columns.length).toEqual(2);
@@ -151,6 +151,7 @@ describe('TaskListComponent', () => {
it('should return the filtered task list by processDefinitionKey', (done) => {
let state = new SimpleChange(null, 'open', true);
/* cspell:disable-next-line */
let processDefinitionKey = new SimpleChange(null, 'fakeprocess', true);
let assignment = new SimpleChange(null, 'fake-assignee', true);
@@ -250,6 +251,7 @@ describe('TaskListComponent', () => {
it('should return the filtered task list for all state', (done) => {
let state = new SimpleChange(null, 'all', true);
/* cspell:disable-next-line */
let processInstanceId = new SimpleChange(null, 'fakeprocessId', true);
component.success.subscribe((res) => {

View File

@@ -61,10 +61,10 @@ describe('TaskStandaloneComponent', () => {
it('should show No form message if isCompleted is false', async(() => {
component.isCompleted = false;
fixture.detectChanges();
const noformElement = fixture.debugElement.nativeElement.querySelector('#adf-no-form-message');
const noFormElement = fixture.debugElement.nativeElement.querySelector('#adf-no-form-message');
fixture.whenStable().then(() => {
expect(noformElement).toBeDefined();
expect(noformElement.innerText).toBe('ADF_TASK_LIST.STANDALONE_TASK.NO_FORM_MESSAGE');
expect(noFormElement).toBeDefined();
expect(noFormElement.innerText).toBe('ADF_TASK_LIST.STANDALONE_TASK.NO_FORM_MESSAGE');
expect(element.querySelector('#adf-completed-form-message')).toBeNull();
expect(element.querySelector('.adf-no-form-submessage')).toBeNull();
});

View File

@@ -174,14 +174,14 @@ describe('Activiti Task filter Service', () => {
it('should add a filter', (done) => {
let filterFake = new FilterRepresentationModel({
name: 'FakeNameFilter',
assignment: 'fake-assignement'
assignment: 'fake-assignment'
});
service.addFilter(filterFake).subscribe((res: FilterRepresentationModel) => {
expect(res).toBeDefined();
expect(res.id).not.toEqual(null);
expect(res.name).toEqual('FakeNameFilter');
expect(res.filter.assignment).toEqual('fake-assignement');
expect(res.filter.assignment).toEqual('fake-assignment');
done();
});
@@ -189,7 +189,7 @@ describe('Activiti Task filter Service', () => {
'status': 200,
contentType: 'application/json',
responseText: JSON.stringify({
id: '2233', name: 'FakeNameFilter', filter: { assignment: 'fake-assignement' }
id: '2233', name: 'FakeNameFilter', filter: { assignment: 'fake-assignment' }
})
});
});

View File

@@ -466,7 +466,7 @@ describe('Activiti TaskList Service', () => {
let taskId = '1';
let filterFake = new FilterRepresentationModel({
name: 'FakeNameFilter',
assignment: 'fake-assignement',
assignment: 'fake-assignment',
filter: {
processDefinitionKey: '1',
assignment: 'fake',

View File

@@ -342,7 +342,7 @@ export class TaskListService {
}
/**
* Unclaims a task for the current user.
* Un-claims a task for the current user.
* @param taskId ID of the task to unclaim
* @returns Null response notifying when the operation is complete
*/