feat(validators): Add a pending state to AbstractControl
Add a pending state to AbstractControl and a function to set that state on themselves and their parents. This will be used for both individual async validators and when the imperitive mode is used. [Design Doc](https://docs.google.com/document/d/1EnJ3-_iFpVKFz1ifN1LkXSGQ7h3A72OQGry2g8eo7IA/edit?pli=1#heading=h.j53rt81eegm4)
This commit is contained in:
@@ -479,6 +479,24 @@ export function main() {
|
||||
});
|
||||
});
|
||||
|
||||
describe("pending", () => {
|
||||
var c: Control;
|
||||
var a: ControlArray;
|
||||
|
||||
beforeEach(() => {
|
||||
c = new Control('value');
|
||||
a = new ControlArray([c]);
|
||||
});
|
||||
|
||||
it("should be false after creating a control", () => { expect(a.pending).toEqual(false); });
|
||||
|
||||
it("should be false after changing the value of the control", () => {
|
||||
c.markAsPending();
|
||||
|
||||
expect(a.pending).toEqual(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe("valueChanges", () => {
|
||||
var a: ControlArray;
|
||||
var c1, c2;
|
||||
|
||||
@@ -47,7 +47,9 @@ var NG_API = [
|
||||
'AbstractControl.getError()',
|
||||
'AbstractControl.hasError()',
|
||||
'AbstractControl.markAsDirty()',
|
||||
'AbstractControl.markAsPending()',
|
||||
'AbstractControl.markAsTouched()',
|
||||
'AbstractControl.pending',
|
||||
'AbstractControl.pristine',
|
||||
'AbstractControl.setParent()',
|
||||
'AbstractControl.status',
|
||||
@@ -277,7 +279,9 @@ var NG_API = [
|
||||
'Control.getError()',
|
||||
'Control.hasError()',
|
||||
'Control.markAsDirty()',
|
||||
'Control.markAsPending()',
|
||||
'Control.markAsTouched()',
|
||||
'Control.pending',
|
||||
'Control.pristine',
|
||||
'Control.registerOnChange()',
|
||||
'Control.setParent()',
|
||||
@@ -304,7 +308,9 @@ var NG_API = [
|
||||
'ControlArray.insert()',
|
||||
'ControlArray.length',
|
||||
'ControlArray.markAsDirty()',
|
||||
'ControlArray.markAsPending()',
|
||||
'ControlArray.markAsTouched()',
|
||||
'ControlArray.pending',
|
||||
'ControlArray.pristine',
|
||||
'ControlArray.push()',
|
||||
'ControlArray.removeAt()',
|
||||
@@ -345,7 +351,9 @@ var NG_API = [
|
||||
'ControlGroup.hasError()',
|
||||
'ControlGroup.include()',
|
||||
'ControlGroup.markAsDirty()',
|
||||
'ControlGroup.markAsPending()',
|
||||
'ControlGroup.markAsTouched()',
|
||||
'ControlGroup.pending',
|
||||
'ControlGroup.pristine',
|
||||
'ControlGroup.removeControl()',
|
||||
'ControlGroup.setParent()',
|
||||
|
||||
Reference in New Issue
Block a user