fix(forms): improve error message for invalid value accessors (#22731)

Signed-off-by: Dirk Luijk <mail@dirkluijk.nl>

PR Close #22731
This commit is contained in:
Dirk Luijk
2018-03-13 19:34:18 +01:00
committed by Alex Rickabaugh
parent ae76eeca6a
commit dd615950d5
3 changed files with 11 additions and 1 deletions

View File

@ -55,6 +55,12 @@ function asyncValidator(expected: any, timeout = 0) {
it('should throw when given an empty array',
() => { expect(() => selectValueAccessor(dir, [])).toThrowError(); });
it('should throw when accessor is not provided as array', () => {
expect(() => selectValueAccessor(dir, {} as any[]))
.toThrowError(
`Value accessor was not provided as an array for form control with unspecified name attribute`);
});
it('should return the default value accessor when no other provided',
() => { expect(selectValueAccessor(dir, [defaultAccessor])).toEqual(defaultAccessor); });