feat(forms): add option to use browser's native validation and angular forms (#13566)
Also renames NgNovalidate -> NgNoValidate Closes #13573
This commit is contained in:

committed by
Victor Berchet

parent
551fe50ebd
commit
874243279d
@ -97,6 +97,16 @@ export function main() {
|
||||
expect(form.nativeElement.getAttribute('novalidate')).toEqual('');
|
||||
}));
|
||||
|
||||
it('should be possible to use native validation and angular forms', fakeAsync(() => {
|
||||
const fixture = initTest(NgModelNativeValidateForm);
|
||||
|
||||
fixture.detectChanges();
|
||||
tick();
|
||||
|
||||
const form = fixture.debugElement.query(By.css('form'));
|
||||
expect(form.nativeElement.hasAttribute('novalidate')).toEqual(false);
|
||||
}));
|
||||
|
||||
it('should support ngModelGroup', fakeAsync(() => {
|
||||
const fixture = initTest(NgModelGroupForm);
|
||||
fixture.componentInstance.first = 'Nancy';
|
||||
@ -258,7 +268,7 @@ export function main() {
|
||||
const fixture = initTest(NgNoFormComp);
|
||||
fixture.detectChanges();
|
||||
const form = fixture.debugElement.query(By.css('form'));
|
||||
expect(form.nativeElement.hasAttribute('novalidate')).toBeFalsy();
|
||||
expect(form.nativeElement.hasAttribute('novalidate')).toEqual(false);
|
||||
});
|
||||
});
|
||||
|
||||
@ -1222,6 +1232,10 @@ class NgModelForm {
|
||||
onReset() {}
|
||||
}
|
||||
|
||||
@Component({selector: 'ng-model-native-validate-form', template: `<form ngNativeValidate></form>`})
|
||||
class NgModelNativeValidateForm {
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'ng-model-group-form',
|
||||
template: `
|
||||
|
Reference in New Issue
Block a user