[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

@@ -762,7 +762,7 @@ describe('FormComponent', () => {
expect(formComponent.isOutcomeButtonEnabled(outcome)).toBeTruthy();
});
it('should disable oucome buttons for invalid form', () => {
it('should disable outcome buttons for invalid form', () => {
let formModel = new FormModel();
let field = new FormFieldModel(formModel, {
type: 'text',

View File

@@ -126,7 +126,7 @@ describe('StartFormComponent', () => {
expect(component.outcomesContainer).toBeTruthy();
});
it('should fetch start form detasils by processDefinitionId ', () => {
it('should fetch start form details by processDefinitionId ', () => {
getStartFormSpy.and.returnValue(of(startMockForm));
component.processDefinitionId = exampleId1;
component.showOutcomeButtons = true;
@@ -136,7 +136,7 @@ describe('StartFormComponent', () => {
expect(getStartFormSpy).toHaveBeenCalled();
});
describe('Disply widgets', () => {
describe('Display widgets', () => {
it('should be able to display a textWidget from a process definition', () => {
getStartFormSpy.and.returnValue(of(startFormTextDefinitionMock));
@@ -280,7 +280,7 @@ describe('StartFormComponent', () => {
});
});
it('should disply start form with fields ', async(() => {
it('should display start form with fields ', async(() => {
getStartFormSpy.and.returnValue(of(startMockForm));
component.processDefinitionId = exampleId1;
component.showOutcomeButtons = true;
@@ -315,6 +315,7 @@ describe('StartFormComponent', () => {
const refreshElement = fixture.debugElement.nativeElement.querySelector('.mat-card-actions>button');
refreshElement.click();
fixture.detectChanges();
/* cspell:disable-next-line */
const selectElement = fixture.debugElement.nativeElement.querySelector('#claimtype');
const selectLabelElement = fixture.debugElement.nativeElement.querySelector('.adf-dropdown-widget > .adf-label');
expect(refreshElement).toBeDefined();
@@ -323,7 +324,7 @@ describe('StartFormComponent', () => {
});
}));
it('should difine custom-tabs ', async(() => {
it('should define custom-tabs ', async(() => {
getStartFormSpy.and.returnValue(of(startMockFormWithTab));
component.processDefinitionId = exampleId1;
component.showOutcomeButtons = true;
@@ -341,7 +342,7 @@ describe('StartFormComponent', () => {
});
}));
it('should difine title and [custom-action-buttons]', async(() => {
it('should define title and [custom-action-buttons]', async(() => {
getStartFormSpy.and.returnValue(of(startMockFormWithTab));
component.processDefinitionId = exampleId1;
component.showOutcomeButtons = true;

View File

@@ -115,7 +115,7 @@ export class StartFormComponent extends FormComponent implements OnChanges, OnIn
}
loadStartForm(processId: string) {
this.formService.getProcessIntance(processId)
this.formService.getProcessInstance(processId)
.subscribe((instance: any) => {
this.formService
.getStartFormInstance(processId)

View File

@@ -133,7 +133,7 @@ describe('ContentWidgetComponent', () => {
created: 1490354907883,
createdBy: {
id: 2,
firstName: 'dasdas', 'lastName': 'dasads', 'email': 'administrator@admin.com'
firstName: 'admin', 'lastName': 'admin', 'email': 'administrator@admin.com'
},
relatedContent: false,
contentAvailable: true,
@@ -176,7 +176,7 @@ describe('ContentWidgetComponent', () => {
created: 1490354907883,
createdBy: {
id: 2,
firstName: 'dasdas', 'lastName': 'dasads', 'email': 'administrator@admin.com'
firstName: 'admin', 'lastName': 'admin', 'email': 'administrator@admin.com'
},
relatedContent: false,
contentAvailable: true,
@@ -215,7 +215,7 @@ describe('ContentWidgetComponent', () => {
created: 1490354907883,
createdBy: {
id: 2,
firstName: 'dasdas', 'lastName': 'dasads', 'email': 'administrator@admin.com'
firstName: 'admin', 'lastName': 'admin', 'email': 'administrator@admin.com'
},
relatedContent: false,
contentAvailable: false,
@@ -239,7 +239,7 @@ describe('ContentWidgetComponent', () => {
created: 1490354907883,
createdBy: {
id: 2,
firstName: 'dasdas', 'lastName': 'dasads', 'email': 'administrator@admin.com'
firstName: 'admin', 'lastName': 'admin', 'email': 'administrator@admin.com'
},
relatedContent: false,
contentAvailable: true,
@@ -273,7 +273,7 @@ describe('ContentWidgetComponent', () => {
created: 1490354907883,
createdBy: {
id: 2,
firstName: 'dasdas', 'lastName': 'dasads', 'email': 'administrator@admin.com'
firstName: 'admin', 'lastName': 'admin', 'email': 'administrator@admin.com'
},
relatedContent: false,
contentAvailable: true,

View File

@@ -36,7 +36,7 @@ export class FormFieldModel extends FormWidgetModel {
private _required: boolean = false;
readonly defaultDateFormat: string = 'D-M-YYYY';
readonly deafultDateTimeFormat: string = 'D-M-YYYY hh:mm A';
readonly defaultDateTimeFormat: string = 'D-M-YYYY hh:mm A';
// model members
fieldType: string;
@@ -209,10 +209,10 @@ export class FormFieldModel extends FormWidgetModel {
jsonField.params.field) {
originalType = jsonField.params.field.type;
}
return originalType === FormFieldTypes.DATETIME ? this.deafultDateTimeFormat : this.defaultDateFormat;
return originalType === FormFieldTypes.DATETIME ? this.defaultDateTimeFormat : this.defaultDateFormat;
}
private isTypeaHeadFieldType(type: string): boolean {
private isTypeaheadFieldType(type: string): boolean {
return type === 'typeahead' ? true : false;
}
@@ -222,7 +222,7 @@ export class FormFieldModel extends FormWidgetModel {
private getProcessVariableValue(field: any, form: FormModel) {
let fieldName = field.name;
if (this.isTypeaHeadFieldType(field.type)) {
if (this.isTypeaheadFieldType(field.type)) {
fieldName = this.getFieldNameWithLabel(field.id);
}
return this.findProcessVariableValue(fieldName, form);
@@ -400,6 +400,7 @@ export class FormFieldModel extends FormWidgetModel {
case FormFieldTypes.DATETIME:
const dateTimeValue = moment(this.value, this.dateDisplayFormat, true);
if (dateTimeValue && dateTimeValue.isValid()) {
/* cspell:disable-next-line */
this.form.values[this.id] = dateTimeValue.format('YYYY-MM-DDTHH:mm:ssZ');
} else {
this.form.values[this.id] = null;

View File

@@ -58,7 +58,7 @@ export class DateTimeWidgetComponent extends WidgetComponent implements OnInit {
this.dateAdapter.setLocale(locale);
});
let momentDateAdapter = <MomentDateAdapter> this.dateAdapter;
momentDateAdapter.overrideDisplyaFormat = this.field.dateDisplayFormat;
momentDateAdapter.overrideDisplayFormat = this.field.dateDisplayFormat;
if (this.field) {
if (this.field.minValue) {

View File

@@ -55,7 +55,7 @@ export class DateWidgetComponent extends WidgetComponent implements OnInit {
this.dateAdapter.setLocale(locale);
});
let momentDateAdapter = <MomentDateAdapter> this.dateAdapter;
momentDateAdapter.overrideDisplyaFormat = this.field.dateDisplayFormat;
momentDateAdapter.overrideDisplayFormat = this.field.dateDisplayFormat;
if (this.field) {
if (this.field.minValue) {

View File

@@ -114,7 +114,7 @@ describe('DynamicTableWidgetComponent', () => {
expect(widget.content.selectedRow).toBe(row);
});
it('should requre table to select clicked row', () => {
it('should require table to select clicked row', () => {
let row = <DynamicTableRow> {selected: false};
widget.content = null;
widget.onRowClicked(row);

View File

@@ -95,8 +95,8 @@ export class DynamicTableWidgetComponent extends WidgetComponent implements OnIn
}
}
private isEnterOrSpacePressed(keycode) {
return this.selectArrayCode.indexOf(keycode) !== -1;
private isEnterOrSpacePressed(keyCode) {
return this.selectArrayCode.indexOf(keyCode) !== -1;
}
hasSelection(): boolean {

View File

@@ -63,7 +63,7 @@ export class DateEditorComponent implements OnInit {
this.dateAdapter.setLocale(locale);
});
let momentDateAdapter = <MomentDateAdapter> this.dateAdapter;
momentDateAdapter.overrideDisplyaFormat = this.DATE_FORMAT;
momentDateAdapter.overrideDisplayFormat = this.DATE_FORMAT;
this.value = moment(this.table.getCellValue(this.row, this.column), 'YYYY-MM-DD');
}

View File

@@ -68,7 +68,7 @@ export class DateTimeEditorComponent implements OnInit {
this.dateAdapter.setLocale(locale);
});
let momentDateAdapter = <MomentDateAdapter> this.dateAdapter;
momentDateAdapter.overrideDisplyaFormat = this.DATE_FORMAT;
momentDateAdapter.overrideDisplayFormat = this.DATE_FORMAT;
this.value = moment(this.table.getCellValue(this.row, this.column), this.DATE_FORMAT);
}

View File

@@ -140,7 +140,7 @@ describe('DropdownEditorComponent', () => {
expect(component.value).toBe(row.value[column.id]);
});
it('should handle REST error gettig options with task id', () => {
it('should handle REST error getting options with task id', () => {
column.optionType = 'rest';
const error = 'error';

View File

@@ -117,7 +117,7 @@ describe('TextWidgetComponent', () => {
params: {inputMask: '##-##0,00%'},
type: FormFieldTypes.TEXT,
readOnly: false,
placeholder: 'simple palceholder'
placeholder: 'simple placeholder'
});
fixture.detectChanges();
@@ -132,7 +132,7 @@ describe('TextWidgetComponent', () => {
it('should show the field placeholder', () => {
expect(inputElement).toBeDefined();
expect(inputElement).not.toBeNull();
expect(inputElement.placeholder).toBe('simple palceholder');
expect(inputElement.placeholder).toBe('simple placeholder');
});
it('should show the field placeholder when clicked', async(() => {
@@ -142,7 +142,7 @@ describe('TextWidgetComponent', () => {
fixture.detectChanges();
expect(inputElement).toBeDefined();
expect(inputElement).not.toBeNull();
expect(inputElement.placeholder).toBe('simple palceholder');
expect(inputElement.placeholder).toBe('simple placeholder');
});
}));
@@ -194,7 +194,7 @@ describe('TextWidgetComponent', () => {
});
}));
it('should autofill masked configured value on keyUp event', async(() => {
it('should auto-fill masked configured value on keyUp event', async(() => {
expect(element.querySelector('#text-id')).not.toBeNull();
inputElement.value = '12345678';
@@ -263,7 +263,7 @@ describe('TextWidgetComponent', () => {
params: {inputMask: '##-##0,00%', inputMaskPlaceholder: 'Phone : (__) ___-___'},
type: FormFieldTypes.TEXT,
readOnly: false,
placeholder: 'simple palceholder'
placeholder: 'simple placeholder'
});
fixture.detectChanges();

View File

@@ -294,13 +294,13 @@ describe('TypeaheadWidgetComponent', () => {
}));
it('should show typeahead options', async(() => {
let typeahedElement = fixture.debugElement.query(By.css('#typeahead-id'));
let typeahedHTMLElement: HTMLInputElement = <HTMLInputElement> typeahedElement.nativeElement;
typeahedHTMLElement.focus();
let typeaheadElement = fixture.debugElement.query(By.css('#typeahead-id'));
let typeaheadHTMLElement: HTMLInputElement = <HTMLInputElement> typeaheadElement.nativeElement;
typeaheadHTMLElement.focus();
typeaheadWidgetComponent.value = 'F';
typeahedHTMLElement.value = 'F';
typeahedHTMLElement.dispatchEvent(new Event('keyup'));
typeahedHTMLElement.dispatchEvent(new Event('input'));
typeaheadHTMLElement.value = 'F';
typeaheadHTMLElement.dispatchEvent(new Event('keyup'));
typeaheadHTMLElement.dispatchEvent(new Event('input'));
fixture.detectChanges();
fixture.whenStable().then(() => {
fixture.detectChanges();
@@ -311,21 +311,21 @@ describe('TypeaheadWidgetComponent', () => {
}));
it('should hide the option when the value is empty', async(() => {
let typeahedElement = fixture.debugElement.query(By.css('#typeahead-id'));
let typeahedHTMLElement: HTMLInputElement = <HTMLInputElement> typeahedElement.nativeElement;
typeahedHTMLElement.focus();
let typeaheadElement = fixture.debugElement.query(By.css('#typeahead-id'));
let typeaheadHTMLElement: HTMLInputElement = <HTMLInputElement> typeaheadElement.nativeElement;
typeaheadHTMLElement.focus();
typeaheadWidgetComponent.value = 'F';
typeahedHTMLElement.value = 'F';
typeahedHTMLElement.dispatchEvent(new Event('keyup'));
typeahedHTMLElement.dispatchEvent(new Event('input'));
typeaheadHTMLElement.value = 'F';
typeaheadHTMLElement.dispatchEvent(new Event('keyup'));
typeaheadHTMLElement.dispatchEvent(new Event('input'));
fixture.detectChanges();
fixture.whenStable().then(() => {
fixture.detectChanges();
expect(fixture.debugElement.query(By.css('[id="typeahead-name_option_1"]'))).not.toBeNull();
typeahedHTMLElement.focus();
typeaheadHTMLElement.focus();
typeaheadWidgetComponent.value = '';
typeahedHTMLElement.dispatchEvent(new Event('keyup'));
typeahedHTMLElement.dispatchEvent(new Event('input'));
typeaheadHTMLElement.dispatchEvent(new Event('keyup'));
typeaheadHTMLElement.dispatchEvent(new Event('input'));
fixture.detectChanges();
fixture.whenStable().then(() => {
fixture.detectChanges();

View File

@@ -301,6 +301,7 @@ describe('UploadWidgetComponent', () => {
}));
it('should show correctly the file name when is formed with French characters', async(() => {
// cspell: disable-next
uploadWidgetComponent.field.value.push(fakeCreationFile('Àâæçéèêëïîôœùûüÿ.jpg', 12));
fixture.detectChanges();
@@ -309,11 +310,13 @@ describe('UploadWidgetComponent', () => {
fixture.detectChanges();
let jpegElement = element.querySelector('#file-12');
expect(jpegElement).not.toBeNull();
// cspell: disable-next
expect(jpegElement.textContent).toBe('Àâæçéèêëïîôœùûüÿ.jpg');
});
}));
it('should show correctly the file name when is formed with Greek characters', async(() => {
// cspell: disable-next
uploadWidgetComponent.field.value.push(fakeCreationFile('άέήίϊϊΐόύϋΰώθωερτψυιοπασδφγηςκλζχξωβνμ.jpg', 13));
fixture.detectChanges();
@@ -322,6 +325,7 @@ describe('UploadWidgetComponent', () => {
fixture.detectChanges();
let jpegElement = element.querySelector('#file-13');
expect(jpegElement).not.toBeNull();
// cspell: disable-next
expect(jpegElement.textContent).toBe('άέήίϊϊΐόύϋΰώθωερτψυιοπασδφγηςκλζχξωβνμ.jpg');
});
}));
@@ -351,6 +355,7 @@ describe('UploadWidgetComponent', () => {
}));
it('should show correctly the file name when is formed with Swedish characters', async(() => {
// cspell: disable-next
uploadWidgetComponent.field.value.push(fakeCreationFile('Äåéö.jpg', 16));
fixture.detectChanges();
@@ -358,6 +363,7 @@ describe('UploadWidgetComponent', () => {
fixture.detectChanges();
let jpegElement = element.querySelector('#file-16');
expect(jpegElement).not.toBeNull();
// cspell: disable-next
expect(jpegElement.textContent).toBe('Äåéö.jpg');
});
}));

View File

@@ -70,7 +70,7 @@ export class WidgetComponent implements AfterViewInit {
}
// Note for developers:
// returns <any> object to be able binding it to the <element reguired="required"> attribute
// returns <any> object to be able binding it to the <element required="required"> attribute
isRequired(): any {
if (this.field && this.field.required) {
return true;

View File

@@ -110,8 +110,8 @@ export class EcmModelService {
typeCreated => {
this.logService.info('type Created', typeCreated);
this.addPropertyToAType(EcmModelService.MODEL_NAME, formName, form).subscribe(
properyAdded => {
this.logService.info('property Added', properyAdded);
propertyAdded => {
this.logService.info('property Added', propertyAdded);
observer.next(typeCreated);
observer.complete();
},

View File

@@ -49,7 +49,7 @@ describe('FormRenderingService', () => {
expect(type).toBe(UploadWidgetComponent);
});
it('should resolve Uknown widget for unknown field type', () => {
it('should resolve Unknown widget for unknown field type', () => {
let resolver = service.getComponentTypeResolver('missing-type');
let type = resolver(null);
expect(type).toBe(UnknownWidgetComponent);

View File

@@ -328,11 +328,11 @@ describe('Form service', () => {
});
it('should search for Form with modelType=2', (done) => {
let response = { data: [{ id: 1, name: 'findme' }, { id: 2, name: 'testform' }] };
let response = { data: [{ id: 1, name: 'findMe' }, { id: 2, name: 'testForm' }] };
service.searchFrom('findme').subscribe(result => {
service.searchFrom('findMe').subscribe(result => {
expect(jasmine.Ajax.requests.mostRecent().url.endsWith('models?modelType=2')).toBeTruthy();
expect(result.name).toEqual('findme');
expect(result.name).toEqual('findMe');
expect(result.id).toEqual(1);
done();
});

View File

@@ -193,7 +193,7 @@ export class FormService {
)
.pipe(
map(function (forms: any) {
return forms.data.find(formdata => formdata.name === name);
return forms.data.find(formData => formData.name === name);
}),
catchError(err => this.handleError(err))
);
@@ -232,7 +232,7 @@ export class FormService {
* @param processInstanceId ID of the target process
* @returns List of instance variable information
*/
getProcessVarablesById(processInstanceId: string): Observable<any[]> {
getProcessVariablesById(processInstanceId: string): Observable<any[]> {
return from(this.processInstanceVariablesApi.getProcessInstanceVariables(processInstanceId))
.pipe(
map(this.toJson),
@@ -363,7 +363,7 @@ export class FormService {
* @param processId ID of the process to get
* @returns Process instance
*/
getProcessIntance(processId: string): Observable<any> {
getProcessInstance(processId: string): Observable<any> {
return from(this.processApi.getProcessInstance(processId))
.pipe(
map(this.toJson),

View File

@@ -149,7 +149,7 @@ export class ProcessContentService {
* Associates an uploaded file with a process instance.
* @param processInstanceId ID of the target process instance
* @param content File to associate
* @param opts Options supported by JSAPI
* @param opts Options supported by JS-API
* @returns Details of created content
*/
createProcessRelatedContent(processInstanceId: string, content: any, opts?: any): Observable<any> {
@@ -161,7 +161,7 @@ export class ProcessContentService {
* Associates an uploaded file with a task instance.
* @param taskId ID of the target task
* @param file File to associate
* @param opts Options supported by JSAPI
* @param opts Options supported by JS-API
* @returns Details of created content
*/
createTaskRelatedContent(taskId: string, file: any, opts?: any) {

View File

@@ -185,7 +185,7 @@ describe('WidgetVisibilityService', () => {
});
});
describe('should retrive the process variables', () => {
describe('should retrieve the process variables', () => {
let fakeFormWithField = new FormModel(fakeFormJson);
let visibilityObjTest: WidgetVisibilityModel;
let chainedVisibilityObj = new WidgetVisibilityModel();
@@ -528,7 +528,7 @@ describe('WidgetVisibilityService', () => {
});
it('should return undefined for not existing form variable', () => {
let varValue = service.getVariableValue(fakeForm, 'MISTERY_FORM_VARIABLE', null);
let varValue = service.getVariableValue(fakeForm, 'MYSTERY_FORM_VARIABLE', null);
expect(varValue).toBeUndefined();
});