Prettier.
This commit is contained in:
parent
be6660ab65
commit
51bdbbbb6a
@ -101,7 +101,11 @@
|
|||||||
<p>Enter all as number of minutes, <em>eg.</em> 45</p>
|
<p>Enter all as number of minutes, <em>eg.</em> 45</p>
|
||||||
<mat-form-field>
|
<mat-form-field>
|
||||||
<mat-label>Preparation Time (minutes)</mat-label>
|
<mat-label>Preparation Time (minutes)</mat-label>
|
||||||
<input matInput [formControl]="recipeFormGroup.controls.preparationTime" data-test-role="preparation-time-input" />
|
<input
|
||||||
|
matInput
|
||||||
|
[formControl]="recipeFormGroup.controls.preparationTime"
|
||||||
|
data-test-role="preparation-time-input"
|
||||||
|
/>
|
||||||
@if (recipeFormGroup.controls.preparationTime.hasError("pattern")) {
|
@if (recipeFormGroup.controls.preparationTime.hasError("pattern")) {
|
||||||
<mat-error data-test-role="preparation-time-error">Must be a valid number.</mat-error>
|
<mat-error data-test-role="preparation-time-error">Must be a valid number.</mat-error>
|
||||||
}
|
}
|
||||||
|
|||||||
@ -67,16 +67,10 @@ describe('EnterRecipeData', () => {
|
|||||||
expect(component).toBeTruthy();
|
expect(component).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
|
||||||
const testTimeInput = (
|
const testTimeInput = (describeBlockName: string, inputRole: string, errorRole: string) => {
|
||||||
describeBlockName: string,
|
|
||||||
inputRole: string,
|
|
||||||
errorRole: string,
|
|
||||||
) => {
|
|
||||||
describe(describeBlockName, () => {
|
describe(describeBlockName, () => {
|
||||||
it('should accept a number input with no error presented', () => {
|
it('should accept a number input with no error presented', () => {
|
||||||
const preparationTimeInputDebug = fixture.debugElement.query(
|
const preparationTimeInputDebug = fixture.debugElement.query(By.css(`[data-test-role=${inputRole}]`));
|
||||||
By.css(`[data-test-role=${inputRole}]`),
|
|
||||||
);
|
|
||||||
expect(preparationTimeInputDebug).toBeTruthy();
|
expect(preparationTimeInputDebug).toBeTruthy();
|
||||||
const preparationTimeInput: HTMLInputElement = preparationTimeInputDebug.nativeElement;
|
const preparationTimeInput: HTMLInputElement = preparationTimeInputDebug.nativeElement;
|
||||||
preparationTimeInput.value = '1234';
|
preparationTimeInput.value = '1234';
|
||||||
@ -107,9 +101,7 @@ describe('EnterRecipeData', () => {
|
|||||||
|
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
|
|
||||||
const errorDebug = fixture.debugElement.query(
|
const errorDebug = fixture.debugElement.query(By.css(`[data-test-role=${errorRole}]`));
|
||||||
By.css(`[data-test-role=${errorRole}]`),
|
|
||||||
);
|
|
||||||
expect(errorDebug).toBeTruthy();
|
expect(errorDebug).toBeTruthy();
|
||||||
expect(errorDebug.nativeElement.textContent).toContain('Must be a valid number.');
|
expect(errorDebug.nativeElement.textContent).toContain('Must be a valid number.');
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user