parent
297c54ebb3
commit
3ca1a57f81
|
@ -10,6 +10,7 @@ ts_library(
|
||||||
"//packages/forms",
|
"//packages/forms",
|
||||||
"//packages/platform-browser",
|
"//packages/platform-browser",
|
||||||
"//packages/platform-browser/testing",
|
"//packages/platform-browser/testing",
|
||||||
|
"//packages/private/testing",
|
||||||
"@rxjs",
|
"@rxjs",
|
||||||
"@rxjs//operators",
|
"@rxjs//operators",
|
||||||
],
|
],
|
||||||
|
@ -18,9 +19,6 @@ ts_library(
|
||||||
jasmine_node_test(
|
jasmine_node_test(
|
||||||
name = "test",
|
name = "test",
|
||||||
bootstrap = ["angular/tools/testing/init_node_spec.js"],
|
bootstrap = ["angular/tools/testing/init_node_spec.js"],
|
||||||
tags = [
|
|
||||||
"fixme-ivy-aot",
|
|
||||||
],
|
|
||||||
deps = [
|
deps = [
|
||||||
":test_lib",
|
":test_lib",
|
||||||
"//tools/testing:node",
|
"//tools/testing:node",
|
||||||
|
@ -29,9 +27,6 @@ jasmine_node_test(
|
||||||
|
|
||||||
ts_web_test_suite(
|
ts_web_test_suite(
|
||||||
name = "test_web",
|
name = "test_web",
|
||||||
tags = [
|
|
||||||
"fixme-ivy-aot",
|
|
||||||
],
|
|
||||||
deps = [
|
deps = [
|
||||||
":test_lib",
|
":test_lib",
|
||||||
],
|
],
|
||||||
|
|
|
@ -12,6 +12,7 @@ import {AbstractControl, AsyncValidator, AsyncValidatorFn, COMPOSITION_BUFFER_MO
|
||||||
import {By} from '@angular/platform-browser/src/dom/debug/by';
|
import {By} from '@angular/platform-browser/src/dom/debug/by';
|
||||||
import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
|
import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
|
||||||
import {dispatchEvent} from '@angular/platform-browser/testing/src/browser_util';
|
import {dispatchEvent} from '@angular/platform-browser/testing/src/browser_util';
|
||||||
|
import {fixmeIvy} from '@angular/private/testing';
|
||||||
import {merge, timer} from 'rxjs';
|
import {merge, timer} from 'rxjs';
|
||||||
import {tap} from 'rxjs/operators';
|
import {tap} from 'rxjs/operators';
|
||||||
|
|
||||||
|
@ -712,6 +713,7 @@ import {MyInput, MyInputForm} from './value_accessor_integration_spec';
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
fixmeIvy('Host bindings to styles do not yet work') &&
|
||||||
describe('setting status classes', () => {
|
describe('setting status classes', () => {
|
||||||
it('should work with single fields', () => {
|
it('should work with single fields', () => {
|
||||||
const fixture = initTest(FormControlComp);
|
const fixture = initTest(FormControlComp);
|
||||||
|
@ -741,7 +743,9 @@ import {MyInput, MyInputForm} from './value_accessor_integration_spec';
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
|
|
||||||
const input = fixture.debugElement.query(By.css('input')).nativeElement;
|
const input = fixture.debugElement.query(By.css('input')).nativeElement;
|
||||||
expect(sortedClassList(input)).toEqual(['ng-pending', 'ng-pristine', 'ng-untouched']);
|
expect(sortedClassList(input)).toEqual([
|
||||||
|
'ng-pending', 'ng-pristine', 'ng-untouched'
|
||||||
|
]);
|
||||||
|
|
||||||
dispatchEvent(input, 'blur');
|
dispatchEvent(input, 'blur');
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
|
@ -755,7 +759,8 @@ import {MyInput, MyInputForm} from './value_accessor_integration_spec';
|
||||||
expect(sortedClassList(input)).toEqual(['ng-dirty', 'ng-touched', 'ng-valid']);
|
expect(sortedClassList(input)).toEqual(['ng-dirty', 'ng-touched', 'ng-valid']);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should work with single fields that combines async and sync validators', fakeAsync(() => {
|
it('should work with single fields that combines async and sync validators',
|
||||||
|
fakeAsync(() => {
|
||||||
const fixture = initTest(FormControlComp);
|
const fixture = initTest(FormControlComp);
|
||||||
const control =
|
const control =
|
||||||
new FormControl('', Validators.required, uniqLoginAsyncValidator('good'));
|
new FormControl('', Validators.required, uniqLoginAsyncValidator('good'));
|
||||||
|
@ -763,7 +768,9 @@ import {MyInput, MyInputForm} from './value_accessor_integration_spec';
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
|
|
||||||
const input = fixture.debugElement.query(By.css('input')).nativeElement;
|
const input = fixture.debugElement.query(By.css('input')).nativeElement;
|
||||||
expect(sortedClassList(input)).toEqual(['ng-invalid', 'ng-pristine', 'ng-untouched']);
|
expect(sortedClassList(input)).toEqual([
|
||||||
|
'ng-invalid', 'ng-pristine', 'ng-untouched'
|
||||||
|
]);
|
||||||
|
|
||||||
dispatchEvent(input, 'blur');
|
dispatchEvent(input, 'blur');
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
|
@ -1911,6 +1918,7 @@ import {MyInput, MyInputForm} from './value_accessor_integration_spec';
|
||||||
expect(form.valid).toEqual(true);
|
expect(form.valid).toEqual(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
fixmeIvy('host attribute instructions are not generated properly') &&
|
||||||
it('changes on bound properties should change the validation state of the form', () => {
|
it('changes on bound properties should change the validation state of the form', () => {
|
||||||
const fixture = initTest(ValidationBindingsForm);
|
const fixture = initTest(ValidationBindingsForm);
|
||||||
const form = new FormGroup({
|
const form = new FormGroup({
|
||||||
|
|
|
@ -12,6 +12,7 @@ import {AbstractControl, AsyncValidator, COMPOSITION_BUFFER_MODE, FormControl, F
|
||||||
import {By} from '@angular/platform-browser/src/dom/debug/by';
|
import {By} from '@angular/platform-browser/src/dom/debug/by';
|
||||||
import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
|
import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
|
||||||
import {dispatchEvent} from '@angular/platform-browser/testing/src/browser_util';
|
import {dispatchEvent} from '@angular/platform-browser/testing/src/browser_util';
|
||||||
|
import {fixmeIvy} from '@angular/private/testing';
|
||||||
import {merge} from 'rxjs';
|
import {merge} from 'rxjs';
|
||||||
|
|
||||||
import {NgModelCustomComp, NgModelCustomWrapper} from './value_accessor_integration_spec';
|
import {NgModelCustomComp, NgModelCustomWrapper} from './value_accessor_integration_spec';
|
||||||
|
@ -148,6 +149,7 @@ import {NgModelCustomComp, NgModelCustomWrapper} from './value_accessor_integrat
|
||||||
expect(form.value).toEqual({});
|
expect(form.value).toEqual({});
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
fixmeIvy('whenStable not working') &&
|
||||||
it('should set status classes with ngModel', async(() => {
|
it('should set status classes with ngModel', async(() => {
|
||||||
const fixture = initTest(NgModelForm);
|
const fixture = initTest(NgModelForm);
|
||||||
fixture.componentInstance.name = 'aa';
|
fixture.componentInstance.name = 'aa';
|
||||||
|
@ -156,12 +158,16 @@ import {NgModelCustomComp, NgModelCustomWrapper} from './value_accessor_integrat
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
|
|
||||||
const input = fixture.debugElement.query(By.css('input')).nativeElement;
|
const input = fixture.debugElement.query(By.css('input')).nativeElement;
|
||||||
expect(sortedClassList(input)).toEqual(['ng-invalid', 'ng-pristine', 'ng-untouched']);
|
expect(sortedClassList(input)).toEqual([
|
||||||
|
'ng-invalid', 'ng-pristine', 'ng-untouched'
|
||||||
|
]);
|
||||||
|
|
||||||
dispatchEvent(input, 'blur');
|
dispatchEvent(input, 'blur');
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
|
|
||||||
expect(sortedClassList(input)).toEqual(['ng-invalid', 'ng-pristine', 'ng-touched']);
|
expect(sortedClassList(input)).toEqual([
|
||||||
|
'ng-invalid', 'ng-pristine', 'ng-touched'
|
||||||
|
]);
|
||||||
|
|
||||||
input.value = 'updatedValue';
|
input.value = 'updatedValue';
|
||||||
dispatchEvent(input, 'input');
|
dispatchEvent(input, 'input');
|
||||||
|
@ -170,6 +176,7 @@ import {NgModelCustomComp, NgModelCustomWrapper} from './value_accessor_integrat
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
fixmeIvy('whenStable not working') &&
|
||||||
it('should set status classes with ngModel and async validators', fakeAsync(() => {
|
it('should set status classes with ngModel and async validators', fakeAsync(() => {
|
||||||
|
|
||||||
const fixture = initTest(NgModelAsyncValidation, NgAsyncValidator);
|
const fixture = initTest(NgModelAsyncValidation, NgAsyncValidator);
|
||||||
|
@ -177,12 +184,16 @@ import {NgModelCustomComp, NgModelCustomWrapper} from './value_accessor_integrat
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
|
|
||||||
const input = fixture.debugElement.query(By.css('input')).nativeElement;
|
const input = fixture.debugElement.query(By.css('input')).nativeElement;
|
||||||
expect(sortedClassList(input)).toEqual(['ng-pending', 'ng-pristine', 'ng-untouched']);
|
expect(sortedClassList(input)).toEqual([
|
||||||
|
'ng-pending', 'ng-pristine', 'ng-untouched'
|
||||||
|
]);
|
||||||
|
|
||||||
dispatchEvent(input, 'blur');
|
dispatchEvent(input, 'blur');
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
|
|
||||||
expect(sortedClassList(input)).toEqual(['ng-pending', 'ng-pristine', 'ng-touched']);
|
expect(sortedClassList(input)).toEqual([
|
||||||
|
'ng-pending', 'ng-pristine', 'ng-touched'
|
||||||
|
]);
|
||||||
|
|
||||||
input.value = 'updatedValue';
|
input.value = 'updatedValue';
|
||||||
dispatchEvent(input, 'input');
|
dispatchEvent(input, 'input');
|
||||||
|
@ -193,13 +204,15 @@ import {NgModelCustomComp, NgModelCustomWrapper} from './value_accessor_integrat
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
fixmeIvy('whenStable not working') &&
|
||||||
it('should set status classes with ngModelGroup and ngForm', async(() => {
|
it('should set status classes with ngModelGroup and ngForm', async(() => {
|
||||||
const fixture = initTest(NgModelGroupForm);
|
const fixture = initTest(NgModelGroupForm);
|
||||||
fixture.componentInstance.first = '';
|
fixture.componentInstance.first = '';
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
|
|
||||||
const form = fixture.debugElement.query(By.css('form')).nativeElement;
|
const form = fixture.debugElement.query(By.css('form')).nativeElement;
|
||||||
const modelGroup = fixture.debugElement.query(By.css('[ngModelGroup]')).nativeElement;
|
const modelGroup =
|
||||||
|
fixture.debugElement.query(By.css('[ngModelGroup]')).nativeElement;
|
||||||
const input = fixture.debugElement.query(By.css('input')).nativeElement;
|
const input = fixture.debugElement.query(By.css('input')).nativeElement;
|
||||||
|
|
||||||
// ngModelGroup creates its control asynchronously
|
// ngModelGroup creates its control asynchronously
|
||||||
|
@ -209,7 +222,9 @@ import {NgModelCustomComp, NgModelCustomWrapper} from './value_accessor_integrat
|
||||||
'ng-invalid', 'ng-pristine', 'ng-untouched'
|
'ng-invalid', 'ng-pristine', 'ng-untouched'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
expect(sortedClassList(form)).toEqual(['ng-invalid', 'ng-pristine', 'ng-untouched']);
|
expect(sortedClassList(form)).toEqual([
|
||||||
|
'ng-invalid', 'ng-pristine', 'ng-untouched'
|
||||||
|
]);
|
||||||
|
|
||||||
dispatchEvent(input, 'blur');
|
dispatchEvent(input, 'blur');
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
|
@ -223,7 +238,9 @@ import {NgModelCustomComp, NgModelCustomWrapper} from './value_accessor_integrat
|
||||||
dispatchEvent(input, 'input');
|
dispatchEvent(input, 'input');
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
|
|
||||||
expect(sortedClassList(modelGroup)).toEqual(['ng-dirty', 'ng-touched', 'ng-valid']);
|
expect(sortedClassList(modelGroup)).toEqual([
|
||||||
|
'ng-dirty', 'ng-touched', 'ng-valid'
|
||||||
|
]);
|
||||||
expect(sortedClassList(form)).toEqual(['ng-dirty', 'ng-touched', 'ng-valid']);
|
expect(sortedClassList(form)).toEqual(['ng-dirty', 'ng-touched', 'ng-valid']);
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
|
@ -1167,6 +1184,7 @@ import {NgModelCustomComp, NgModelCustomWrapper} from './value_accessor_integrat
|
||||||
expect(input.nativeElement.disabled).toBe(true);
|
expect(input.nativeElement.disabled).toBe(true);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
fixmeIvy('whenStable not working') &&
|
||||||
it('should disable a custom control if disabled attr is added', async(() => {
|
it('should disable a custom control if disabled attr is added', async(() => {
|
||||||
const fixture = initTest(NgModelCustomWrapper, NgModelCustomComp);
|
const fixture = initTest(NgModelCustomWrapper, NgModelCustomComp);
|
||||||
fixture.componentInstance.name = 'Nancy';
|
fixture.componentInstance.name = 'Nancy';
|
||||||
|
@ -1213,6 +1231,7 @@ import {NgModelCustomComp, NgModelCustomWrapper} from './value_accessor_integrat
|
||||||
|
|
||||||
describe('validation directives', () => {
|
describe('validation directives', () => {
|
||||||
|
|
||||||
|
fixmeIvy('RequiredValidator provided instead of CheckboxRequiredValidator') &&
|
||||||
it('required validator should validate checkbox', fakeAsync(() => {
|
it('required validator should validate checkbox', fakeAsync(() => {
|
||||||
const fixture = initTest(NgModelCheckboxRequiredValidator);
|
const fixture = initTest(NgModelCheckboxRequiredValidator);
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
|
@ -1401,6 +1420,7 @@ import {NgModelCustomComp, NgModelCustomWrapper} from './value_accessor_integrat
|
||||||
expect(form.control.hasError('minlength', ['tovalidate'])).toBeTruthy();
|
expect(form.control.hasError('minlength', ['tovalidate'])).toBeTruthy();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
fixmeIvy('host attribute instructions are not generated properly') &&
|
||||||
it('changes on bound properties should change the validation state of the form',
|
it('changes on bound properties should change the validation state of the form',
|
||||||
fakeAsync(() => {
|
fakeAsync(() => {
|
||||||
const fixture = initTest(NgModelValidationBindings);
|
const fixture = initTest(NgModelValidationBindings);
|
||||||
|
@ -1472,6 +1492,7 @@ import {NgModelCustomComp, NgModelCustomWrapper} from './value_accessor_integrat
|
||||||
expect(required.nativeElement.getAttribute('pattern')).toEqual(null);
|
expect(required.nativeElement.getAttribute('pattern')).toEqual(null);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
fixmeIvy('ngModelChange callback never called') &&
|
||||||
it('should update control status', fakeAsync(() => {
|
it('should update control status', fakeAsync(() => {
|
||||||
const fixture = initTest(NgModelChangeState);
|
const fixture = initTest(NgModelChangeState);
|
||||||
const inputEl = fixture.debugElement.query(By.css('input'));
|
const inputEl = fixture.debugElement.query(By.css('input'));
|
||||||
|
|
|
@ -11,6 +11,7 @@ import {ComponentFixture, TestBed, async, fakeAsync, tick} from '@angular/core/t
|
||||||
import {AbstractControl, ControlValueAccessor, FormControl, FormGroup, FormsModule, NG_VALIDATORS, NG_VALUE_ACCESSOR, NgControl, NgForm, NgModel, ReactiveFormsModule, Validators} from '@angular/forms';
|
import {AbstractControl, ControlValueAccessor, FormControl, FormGroup, FormsModule, NG_VALIDATORS, NG_VALUE_ACCESSOR, NgControl, NgForm, NgModel, ReactiveFormsModule, Validators} from '@angular/forms';
|
||||||
import {By} from '@angular/platform-browser/src/dom/debug/by';
|
import {By} from '@angular/platform-browser/src/dom/debug/by';
|
||||||
import {dispatchEvent} from '@angular/platform-browser/testing/src/browser_util';
|
import {dispatchEvent} from '@angular/platform-browser/testing/src/browser_util';
|
||||||
|
import {fixmeIvy} from '@angular/private/testing';
|
||||||
|
|
||||||
{
|
{
|
||||||
describe('value accessors', () => {
|
describe('value accessors', () => {
|
||||||
|
@ -1058,6 +1059,7 @@ import {dispatchEvent} from '@angular/platform-browser/testing/src/browser_util'
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('in template-driven forms', () => {
|
describe('in template-driven forms', () => {
|
||||||
|
fixmeIvy('whenStable not working') &&
|
||||||
it('should support standard writing to view and model', async(() => {
|
it('should support standard writing to view and model', async(() => {
|
||||||
const fixture = initTest(NgModelCustomWrapper, NgModelCustomComp);
|
const fixture = initTest(NgModelCustomWrapper, NgModelCustomComp);
|
||||||
fixture.componentInstance.name = 'Nancy';
|
fixture.componentInstance.name = 'Nancy';
|
||||||
|
|
Loading…
Reference in New Issue