test(forms): verify that an object is not a boxed value if only `disabled` field is present (#39801)
The value of a `FormControl` is treated in a special way (called boxed values) when it's an object with exactly 2 fields: `value` and `disabled`. This commit adds a test which verifies that an object is not treated as a boxed value when `disabled` field is present, but `value` is missing. PR Close #39801
This commit is contained in:
parent
3e1e5a15ba
commit
b668768c0a
|
@ -45,6 +45,13 @@ describe('FormControl', () => {
|
|||
expect(c.status).toBe('DISABLED');
|
||||
});
|
||||
|
||||
it('should not treat objects as boxed values when `disabled` field is present, but `value` is missing',
|
||||
() => {
|
||||
const c = new FormControl({disabled: true});
|
||||
expect(c.value).toEqual({disabled: true});
|
||||
expect(c.disabled).toBe(false);
|
||||
});
|
||||
|
||||
it('should honor boxed value with disabled control when validating', () => {
|
||||
const c = new FormControl({value: '', disabled: true}, Validators.required);
|
||||
expect(c.disabled).toBe(true);
|
||||
|
|
Loading…
Reference in New Issue