revert: fix(forms): temp roll back breaking change with min/max directives
This reverts commit 232bd9395d
.
This commit is contained in:
@ -879,99 +879,95 @@ export function main() {
|
||||
|
||||
describe('validation directives', () => {
|
||||
|
||||
// TODO(kara): activate when we start exporting max validator dir
|
||||
xit('should should validate max', fakeAsync(() => {
|
||||
const fixture = initTest(NgModelMaxValidator);
|
||||
fixture.componentInstance.max = 10;
|
||||
fixture.detectChanges();
|
||||
tick();
|
||||
it('should should validate max', fakeAsync(() => {
|
||||
const fixture = initTest(NgModelMaxValidator);
|
||||
fixture.componentInstance.max = 10;
|
||||
fixture.detectChanges();
|
||||
tick();
|
||||
|
||||
const max = fixture.debugElement.query(By.css('input'));
|
||||
const form = fixture.debugElement.children[0].injector.get(NgForm);
|
||||
const max = fixture.debugElement.query(By.css('input'));
|
||||
const form = fixture.debugElement.children[0].injector.get(NgForm);
|
||||
|
||||
max.nativeElement.value = '';
|
||||
dispatchEvent(max.nativeElement, 'input');
|
||||
fixture.detectChanges();
|
||||
expect(form.valid).toEqual(true);
|
||||
max.nativeElement.value = '';
|
||||
dispatchEvent(max.nativeElement, 'input');
|
||||
fixture.detectChanges();
|
||||
expect(form.valid).toEqual(true);
|
||||
|
||||
max.nativeElement.value = 11;
|
||||
dispatchEvent(max.nativeElement, 'input');
|
||||
fixture.detectChanges();
|
||||
expect(form.valid).toEqual(false);
|
||||
max.nativeElement.value = 11;
|
||||
dispatchEvent(max.nativeElement, 'input');
|
||||
fixture.detectChanges();
|
||||
expect(form.valid).toEqual(false);
|
||||
|
||||
max.nativeElement.value = 9;
|
||||
dispatchEvent(max.nativeElement, 'input');
|
||||
fixture.detectChanges();
|
||||
expect(form.valid).toEqual(true);
|
||||
}));
|
||||
max.nativeElement.value = 9;
|
||||
dispatchEvent(max.nativeElement, 'input');
|
||||
fixture.detectChanges();
|
||||
expect(form.valid).toEqual(true);
|
||||
}));
|
||||
|
||||
// TODO(kara): activate when we start exporting max validator dir
|
||||
xit('should validate max for strings', fakeAsync(() => {
|
||||
const fixture = initTest(NgModelMaxValidator);
|
||||
fixture.componentInstance.max = 10;
|
||||
fixture.detectChanges();
|
||||
tick();
|
||||
it('should validate max for strings', fakeAsync(() => {
|
||||
const fixture = initTest(NgModelMaxValidator);
|
||||
fixture.componentInstance.max = 10;
|
||||
fixture.detectChanges();
|
||||
tick();
|
||||
|
||||
const max = fixture.debugElement.query(By.css('input'));
|
||||
const form = fixture.debugElement.children[0].injector.get(NgForm);
|
||||
const max = fixture.debugElement.query(By.css('input'));
|
||||
const form = fixture.debugElement.children[0].injector.get(NgForm);
|
||||
|
||||
max.nativeElement.value = '11';
|
||||
dispatchEvent(max.nativeElement, 'input');
|
||||
fixture.detectChanges();
|
||||
expect(form.valid).toEqual(false);
|
||||
max.nativeElement.value = '11';
|
||||
dispatchEvent(max.nativeElement, 'input');
|
||||
fixture.detectChanges();
|
||||
expect(form.valid).toEqual(false);
|
||||
|
||||
max.nativeElement.value = '9';
|
||||
dispatchEvent(max.nativeElement, 'input');
|
||||
fixture.detectChanges();
|
||||
expect(form.valid).toEqual(true);
|
||||
}));
|
||||
max.nativeElement.value = '9';
|
||||
dispatchEvent(max.nativeElement, 'input');
|
||||
fixture.detectChanges();
|
||||
expect(form.valid).toEqual(true);
|
||||
}));
|
||||
|
||||
// TODO(kara): activate when we start exporting min validator dir
|
||||
xit('should should validate min', fakeAsync(() => {
|
||||
const fixture = initTest(NgModelMinValidator);
|
||||
fixture.componentInstance.min = 10;
|
||||
fixture.detectChanges();
|
||||
tick();
|
||||
it('should should validate min', fakeAsync(() => {
|
||||
const fixture = initTest(NgModelMinValidator);
|
||||
fixture.componentInstance.min = 10;
|
||||
fixture.detectChanges();
|
||||
tick();
|
||||
|
||||
const min = fixture.debugElement.query(By.css('input'));
|
||||
const form = fixture.debugElement.children[0].injector.get(NgForm);
|
||||
const min = fixture.debugElement.query(By.css('input'));
|
||||
const form = fixture.debugElement.children[0].injector.get(NgForm);
|
||||
|
||||
min.nativeElement.value = '';
|
||||
dispatchEvent(min.nativeElement, 'input');
|
||||
fixture.detectChanges();
|
||||
expect(form.valid).toEqual(true);
|
||||
min.nativeElement.value = '';
|
||||
dispatchEvent(min.nativeElement, 'input');
|
||||
fixture.detectChanges();
|
||||
expect(form.valid).toEqual(true);
|
||||
|
||||
min.nativeElement.value = 11;
|
||||
dispatchEvent(min.nativeElement, 'input');
|
||||
fixture.detectChanges();
|
||||
expect(form.valid).toEqual(true);
|
||||
min.nativeElement.value = 11;
|
||||
dispatchEvent(min.nativeElement, 'input');
|
||||
fixture.detectChanges();
|
||||
expect(form.valid).toEqual(true);
|
||||
|
||||
min.nativeElement.value = 9;
|
||||
dispatchEvent(min.nativeElement, 'input');
|
||||
fixture.detectChanges();
|
||||
expect(form.valid).toEqual(false);
|
||||
}));
|
||||
min.nativeElement.value = 9;
|
||||
dispatchEvent(min.nativeElement, 'input');
|
||||
fixture.detectChanges();
|
||||
expect(form.valid).toEqual(false);
|
||||
}));
|
||||
|
||||
// TODO(kara): activate when we start exporting min validator dir
|
||||
xit('should should validate min for strings', fakeAsync(() => {
|
||||
const fixture = initTest(NgModelMinValidator);
|
||||
fixture.componentInstance.min = 10;
|
||||
fixture.detectChanges();
|
||||
tick();
|
||||
it('should should validate min for strings', fakeAsync(() => {
|
||||
const fixture = initTest(NgModelMinValidator);
|
||||
fixture.componentInstance.min = 10;
|
||||
fixture.detectChanges();
|
||||
tick();
|
||||
|
||||
const min = fixture.debugElement.query(By.css('input'));
|
||||
const form = fixture.debugElement.children[0].injector.get(NgForm);
|
||||
const min = fixture.debugElement.query(By.css('input'));
|
||||
const form = fixture.debugElement.children[0].injector.get(NgForm);
|
||||
|
||||
min.nativeElement.value = '11';
|
||||
dispatchEvent(min.nativeElement, 'input');
|
||||
fixture.detectChanges();
|
||||
expect(form.valid).toEqual(true);
|
||||
min.nativeElement.value = '11';
|
||||
dispatchEvent(min.nativeElement, 'input');
|
||||
fixture.detectChanges();
|
||||
expect(form.valid).toEqual(true);
|
||||
|
||||
min.nativeElement.value = '9';
|
||||
dispatchEvent(min.nativeElement, 'input');
|
||||
fixture.detectChanges();
|
||||
expect(form.valid).toEqual(false);
|
||||
}));
|
||||
min.nativeElement.value = '9';
|
||||
dispatchEvent(min.nativeElement, 'input');
|
||||
fixture.detectChanges();
|
||||
expect(form.valid).toEqual(false);
|
||||
}));
|
||||
|
||||
|
||||
it('required validator should validate checkbox', fakeAsync(() => {
|
||||
|
Reference in New Issue
Block a user