feat(forms): add novalidate by default (#13092)
This commit is contained in:

committed by
Victor Berchet

parent
e9f307f948
commit
4c35be3e07
@ -61,6 +61,16 @@ export function main() {
|
||||
expect(form.valid).toBe(false);
|
||||
}));
|
||||
|
||||
it('should add novalidate by default to form element', fakeAsync(() => {
|
||||
const fixture = TestBed.createComponent(NgModelForm);
|
||||
|
||||
fixture.detectChanges();
|
||||
tick();
|
||||
|
||||
const form = fixture.debugElement.query(By.css('form'));
|
||||
expect(form.nativeElement.getAttribute('novalidate')).toEqual('');
|
||||
}));
|
||||
|
||||
it('should support ngModelGroup', fakeAsync(() => {
|
||||
const fixture = TestBed.createComponent(NgModelGroupForm);
|
||||
fixture.componentInstance.first = 'Nancy';
|
||||
@ -217,6 +227,13 @@ export function main() {
|
||||
fixture.detectChanges();
|
||||
expect(fixture.debugElement.children[0].providerTokens.length).toEqual(0);
|
||||
});
|
||||
|
||||
it('should not add novalidate when ngNoForm is used', () => {
|
||||
const fixture = TestBed.createComponent(NgNoFormComp);
|
||||
fixture.detectChanges();
|
||||
const form = fixture.debugElement.query(By.css('form'));
|
||||
expect(form.nativeElement.hasAttribute('novalidate')).toBeFalsy();
|
||||
});
|
||||
});
|
||||
|
||||
describe('name and ngModelOptions', () => {
|
||||
|
Reference in New Issue
Block a user