fix(forms): disabled controls should never be invalid (#11257)

Closes #11253
This commit is contained in:
Kara
2016-09-01 16:51:42 -07:00
committed by Martin Probst
parent 2581c0851a
commit 043493cb62
2 changed files with 8 additions and 1 deletions

View File

@ -56,6 +56,13 @@ export function main() {
expect(c.status).toBe('DISABLED');
});
it('should honor boxed value with disabled control when validating', () => {
const c = new FormControl({value: '', disabled: true}, Validators.required);
expect(c.disabled).toBe(true);
expect(c.valid).toBe(false);
expect(c.status).toBe('DISABLED');
});
it('should not treat objects as boxed values if they have more than two props', () => {
const c = new FormControl({value: '', disabled: true, test: 'test'}, null, null);
expect(c.value).toEqual({value: '', disabled: true, test: 'test'});