revert: fix(forms): temp roll back breaking change with min/max directives

This reverts commit 232bd9395d.
This commit is contained in:
Hans Larsen 2017-06-19 16:18:43 -07:00 committed by Hans
parent 2447bd1bac
commit 6c8e7dd63e
4 changed files with 91 additions and 77 deletions

View File

@ -58,7 +58,9 @@ export const SHARED_FORM_DIRECTIVES: Type<any>[] = [
NgControlStatus,
NgControlStatusGroup,
RequiredValidator,
MinValidator,
MinLengthValidator,
MaxValidator,
MaxLengthValidator,
PatternValidator,
CheckboxRequiredValidator,

View File

@ -38,7 +38,7 @@ export {FormArrayName} from './directives/reactive_directives/form_group_name';
export {FormGroupName} from './directives/reactive_directives/form_group_name';
export {NgSelectOption, SelectControlValueAccessor} from './directives/select_control_value_accessor';
export {SelectMultipleControlValueAccessor} from './directives/select_multiple_control_value_accessor';
export {AsyncValidator, AsyncValidatorFn, CheckboxRequiredValidator, EmailValidator, MaxLengthValidator, MinLengthValidator, PatternValidator, RequiredValidator, ValidationErrors, Validator, ValidatorFn} from './directives/validators';
export {AsyncValidator, AsyncValidatorFn, CheckboxRequiredValidator, EmailValidator, MaxLengthValidator, MaxValidator, MinLengthValidator, MinValidator, PatternValidator, RequiredValidator, ValidationErrors, Validator, ValidatorFn} from './directives/validators';
export {FormBuilder} from './form_builder';
export {AbstractControl, FormArray, FormControl, FormGroup} from './model';
export {NG_ASYNC_VALIDATORS, NG_VALIDATORS, Validators} from './validators';

View File

@ -879,8 +879,7 @@ export function main() {
describe('validation directives', () => {
// TODO(kara): activate when we start exporting max validator dir
xit('should should validate max', fakeAsync(() => {
it('should should validate max', fakeAsync(() => {
const fixture = initTest(NgModelMaxValidator);
fixture.componentInstance.max = 10;
fixture.detectChanges();
@ -905,8 +904,7 @@ export function main() {
expect(form.valid).toEqual(true);
}));
// TODO(kara): activate when we start exporting max validator dir
xit('should validate max for strings', fakeAsync(() => {
it('should validate max for strings', fakeAsync(() => {
const fixture = initTest(NgModelMaxValidator);
fixture.componentInstance.max = 10;
fixture.detectChanges();
@ -926,8 +924,7 @@ export function main() {
expect(form.valid).toEqual(true);
}));
// TODO(kara): activate when we start exporting min validator dir
xit('should should validate min', fakeAsync(() => {
it('should should validate min', fakeAsync(() => {
const fixture = initTest(NgModelMinValidator);
fixture.componentInstance.min = 10;
fixture.detectChanges();
@ -952,8 +949,7 @@ export function main() {
expect(form.valid).toEqual(false);
}));
// TODO(kara): activate when we start exporting min validator dir
xit('should should validate min for strings', fakeAsync(() => {
it('should should validate min for strings', fakeAsync(() => {
const fixture = initTest(NgModelMinValidator);
fixture.componentInstance.min = 10;
fixture.detectChanges();

View File

@ -352,6 +352,14 @@ export declare class MaxLengthValidator implements Validator, OnChanges {
validate(c: AbstractControl): ValidationErrors | null;
}
/** @experimental */
export declare class MaxValidator implements Validator, OnChanges {
max: string;
ngOnChanges(changes: SimpleChanges): void;
registerOnValidatorChange(fn: () => void): void;
validate(c: AbstractControl): ValidationErrors | null;
}
/** @stable */
export declare class MinLengthValidator implements Validator, OnChanges {
minlength: string;
@ -360,6 +368,14 @@ export declare class MinLengthValidator implements Validator, OnChanges {
validate(c: AbstractControl): ValidationErrors | null;
}
/** @experimental */
export declare class MinValidator implements Validator, OnChanges {
min: string;
ngOnChanges(changes: SimpleChanges): void;
registerOnValidatorChange(fn: () => void): void;
validate(c: AbstractControl): ValidationErrors | null;
}
/** @stable */
export declare const NG_ASYNC_VALIDATORS: InjectionToken<(Function | Validator)[]>;