feat(forms): add status to `AbstractControlDirective`

This commit is contained in:
Fabian Wiles 2017-08-05 09:59:32 +12:00 committed by Hans
parent 9320f34f19
commit 233ef93e88
3 changed files with 9 additions and 0 deletions

View File

@ -36,6 +36,8 @@ export abstract class AbstractControlDirective {
get touched(): boolean|null { return this.control ? this.control.touched : null; } get touched(): boolean|null { return this.control ? this.control.touched : null; }
get status(): string|null { return this.control ? this.control.status : null; }
get untouched(): boolean|null { return this.control ? this.control.untouched : null; } get untouched(): boolean|null { return this.control ? this.control.untouched : null; }
get disabled(): boolean|null { return this.control ? this.control.disabled : null; } get disabled(): boolean|null { return this.control ? this.control.disabled : null; }

View File

@ -332,6 +332,7 @@ export function main() {
expect(form.touched).toBe(formModel.touched); expect(form.touched).toBe(formModel.touched);
expect(form.untouched).toBe(formModel.untouched); expect(form.untouched).toBe(formModel.untouched);
expect(form.statusChanges).toBe(formModel.statusChanges); expect(form.statusChanges).toBe(formModel.statusChanges);
expect(form.status).toBe(formModel.status);
expect(form.valueChanges).toBe(formModel.valueChanges); expect(form.valueChanges).toBe(formModel.valueChanges);
expect(form.disabled).toBe(formModel.disabled); expect(form.disabled).toBe(formModel.disabled);
expect(form.enabled).toBe(formModel.enabled); expect(form.enabled).toBe(formModel.enabled);
@ -419,6 +420,7 @@ export function main() {
expect(controlGroupDir.touched).toBe(formModel.touched); expect(controlGroupDir.touched).toBe(formModel.touched);
expect(controlGroupDir.untouched).toBe(formModel.untouched); expect(controlGroupDir.untouched).toBe(formModel.untouched);
expect(controlGroupDir.statusChanges).toBe(formModel.statusChanges); expect(controlGroupDir.statusChanges).toBe(formModel.statusChanges);
expect(controlGroupDir.status).toBe(formModel.status);
expect(controlGroupDir.valueChanges).toBe(formModel.valueChanges); expect(controlGroupDir.valueChanges).toBe(formModel.valueChanges);
expect(controlGroupDir.disabled).toBe(formModel.disabled); expect(controlGroupDir.disabled).toBe(formModel.disabled);
expect(controlGroupDir.enabled).toBe(formModel.enabled); expect(controlGroupDir.enabled).toBe(formModel.enabled);
@ -456,6 +458,7 @@ export function main() {
expect(formArrayDir.pristine).toBe(formModel.pristine); expect(formArrayDir.pristine).toBe(formModel.pristine);
expect(formArrayDir.dirty).toBe(formModel.dirty); expect(formArrayDir.dirty).toBe(formModel.dirty);
expect(formArrayDir.touched).toBe(formModel.touched); expect(formArrayDir.touched).toBe(formModel.touched);
expect(formArrayDir.status).toBe(formModel.status);
expect(formArrayDir.untouched).toBe(formModel.untouched); expect(formArrayDir.untouched).toBe(formModel.untouched);
expect(formArrayDir.disabled).toBe(formModel.disabled); expect(formArrayDir.disabled).toBe(formModel.disabled);
expect(formArrayDir.enabled).toBe(formModel.enabled); expect(formArrayDir.enabled).toBe(formModel.enabled);
@ -486,6 +489,7 @@ export function main() {
expect(controlDir.touched).toBe(control.touched); expect(controlDir.touched).toBe(control.touched);
expect(controlDir.untouched).toBe(control.untouched); expect(controlDir.untouched).toBe(control.untouched);
expect(controlDir.statusChanges).toBe(control.statusChanges); expect(controlDir.statusChanges).toBe(control.statusChanges);
expect(controlDir.status).toBe(control.status);
expect(controlDir.valueChanges).toBe(control.valueChanges); expect(controlDir.valueChanges).toBe(control.valueChanges);
expect(controlDir.disabled).toBe(control.disabled); expect(controlDir.disabled).toBe(control.disabled);
expect(controlDir.enabled).toBe(control.enabled); expect(controlDir.enabled).toBe(control.enabled);
@ -551,6 +555,7 @@ export function main() {
expect(ngModel.touched).toBe(control.touched); expect(ngModel.touched).toBe(control.touched);
expect(ngModel.untouched).toBe(control.untouched); expect(ngModel.untouched).toBe(control.untouched);
expect(ngModel.statusChanges).toBe(control.statusChanges); expect(ngModel.statusChanges).toBe(control.statusChanges);
expect(ngModel.status).toBe(control.status);
expect(ngModel.valueChanges).toBe(control.valueChanges); expect(ngModel.valueChanges).toBe(control.valueChanges);
expect(ngModel.disabled).toBe(control.disabled); expect(ngModel.disabled).toBe(control.disabled);
expect(ngModel.enabled).toBe(control.enabled); expect(ngModel.enabled).toBe(control.enabled);
@ -660,6 +665,7 @@ export function main() {
expect(controlNameDir.touched).toBe(formModel.touched); expect(controlNameDir.touched).toBe(formModel.touched);
expect(controlNameDir.untouched).toBe(formModel.untouched); expect(controlNameDir.untouched).toBe(formModel.untouched);
expect(controlNameDir.statusChanges).toBe(formModel.statusChanges); expect(controlNameDir.statusChanges).toBe(formModel.statusChanges);
expect(controlNameDir.status).toBe(formModel.status);
expect(controlNameDir.valueChanges).toBe(formModel.valueChanges); expect(controlNameDir.valueChanges).toBe(formModel.valueChanges);
expect(controlNameDir.disabled).toBe(formModel.disabled); expect(controlNameDir.disabled).toBe(formModel.disabled);
expect(controlNameDir.enabled).toBe(formModel.enabled); expect(controlNameDir.enabled).toBe(formModel.enabled);

View File

@ -74,6 +74,7 @@ export declare abstract class AbstractControlDirective {
readonly path: string[] | null; readonly path: string[] | null;
readonly pending: boolean | null; readonly pending: boolean | null;
readonly pristine: boolean | null; readonly pristine: boolean | null;
readonly status: string | null;
readonly statusChanges: Observable<any> | null; readonly statusChanges: Observable<any> | null;
readonly touched: boolean | null; readonly touched: boolean | null;
readonly untouched: boolean | null; readonly untouched: boolean | null;