Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 6989a66

Browse files
test(example): add updateOn blur control
1 parent 1e60b87 commit 6989a66

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

‎angular.json‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,5 +123,8 @@
123123
}
124124
}
125125
},
126-
"defaultProject": "testing-library-app"
126+
"defaultProject": "testing-library-app",
127+
"cli": {
128+
"analytics": false
129+
}
127130
}

‎src/app/examples/03-forms.spec.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ test('is possible to fill in a form and verify error messages (with the help of
2020
expect(nameControl).toBeInvalid();
2121
component.type(nameControl, 'Tim');
2222
component.type(scoreControl, '12');
23+
component.blur(scoreControl);
2324
component.selectOptions(colorControl, 'Green');
2425

2526
expect(component.queryByText('name is required')).not.toBeInTheDocument();
@@ -28,6 +29,7 @@ test('is possible to fill in a form and verify error messages (with the help of
2829

2930
expect(scoreControl).toBeInvalid();
3031
component.type(scoreControl, 7);
32+
component.blur(scoreControl);
3133
expect(scoreControl).toBeValid();
3234

3335
expect(errors).not.toBeInTheDocument();

‎src/app/examples/03-forms.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export class FormsComponent {
3333
colors = [{ id: 'R', value: 'Red' }, { id: 'B', value: 'Blue' }, { id: 'G', value: 'Green' }];
3434
form = this.formBuilder.group({
3535
name: ['', Validators.required],
36-
score: [0, [Validators.min(1), Validators.max(10)]],
36+
score: [0, {validators: [Validators.min(1), Validators.max(10)],updateOn: 'blur'}],
3737
color: ['', Validators.required],
3838
});
3939

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /