@@ -398,6 +398,15 @@ describe('FormControl', () => {
398398 expect ( c . hasValidator ( minValidator ) ) . toEqual ( true ) ;
399399 expect ( c . hasValidator ( Validators . min ( 5 ) ) ) . toEqual ( false ) ;
400400 } ) ;
401+
402+ it ( 'should error if passed an async validator instead of a validator' , fakeAsync ( ( ) => {
403+ // @ts -expect-error
404+ const c = new FormControl ( 'value' , asyncValidator ( 'expected' ) ) ;
405+ tick ( ) ;
406+
407+ expect ( c . valid ) . toEqual ( false ) ;
408+ expect ( c . errors ) . not . toEqual ( { 'async' : true } ) ;
409+ } ) ) ;
401410 } ) ;
402411
403412 describe ( 'asyncValidator' , ( ) => {
@@ -590,16 +599,16 @@ describe('FormControl', () => {
590599 } ) ) ;
591600
592601 it ( 'should clear async validators' , fakeAsync ( ( ) => {
593- const c = new FormControl ( 'value' , [ asyncValidator ( 'expected' ) , otherAsyncValidator ] ) ;
602+ const c = new FormControl ( 'value' , [ ] , [ asyncValidator ( 'expected' ) , otherAsyncValidator ] ) ;
594603
595- c . clearValidators ( ) ;
604+ c . clearAsyncValidators ( ) ;
596605
597606 expect ( c . asyncValidator ) . toEqual ( null ) ;
598607 } ) ) ;
599608
600609 it ( 'should not change validity state if control is disabled while async validating' ,
601610 fakeAsync ( ( ) => {
602- const c = new FormControl ( 'value' , [ asyncValidator ( 'expected' ) ] ) ;
611+ const c = new FormControl ( 'value' , [ ] , [ asyncValidator ( 'expected' ) ] ) ;
603612 c . disable ( ) ;
604613 tick ( ) ;
605614 expect ( c . status ) . toEqual ( 'DISABLED' ) ;
0 commit comments