@@ -638,7 +638,7 @@ describe('MdInputContainer', function () {
638638 } ) ;
639639 } ) ) ;
640640
641- it ( 'should hide the error messages once the input becomes valid' , async ( ( ) => {
641+ it ( 'should hide the errors and show the hints once the input becomes valid' , async ( ( ) => {
642642 testComponent . formControl . markAsTouched ( ) ;
643643 fixture . detectChanges ( ) ;
644644
@@ -647,6 +647,8 @@ describe('MdInputContainer', function () {
647647 . toContain ( 'mat-input-invalid' , 'Expected container to have the invalid CSS class.' ) ;
648648 expect ( containerEl . querySelectorAll ( 'md-error' ) . length )
649649 . toBe ( 1 , 'Expected one error message to have been rendered.' ) ;
650+ expect ( containerEl . querySelectorAll ( 'md-hint' ) . length )
651+ . toBe ( 0 , 'Expected no hints to be shown.' ) ;
650652
651653 testComponent . formControl . setValue ( 'something' ) ;
652654 fixture . detectChanges ( ) ;
@@ -656,39 +658,12 @@ describe('MdInputContainer', function () {
656658 'Expected container not to have the invalid class when valid.' ) ;
657659 expect ( containerEl . querySelectorAll ( 'md-error' ) . length )
658660 . toBe ( 0 , 'Expected no error messages when the input is valid.' ) ;
661+ expect ( containerEl . querySelectorAll ( 'md-hint' ) . length )
662+ . toBe ( 1 , 'Expected one hint to be shown once the input is valid.' ) ;
659663 } ) ;
660664 } ) ;
661665 } ) ) ;
662666
663- it ( 'should hide the hints when there are errors and not show them again when' +
664- ' the input becomes valid' , async ( ( ) => {
665-
666- expect ( containerEl . querySelectorAll ( 'md-hint' ) . length )
667- . toBe ( 1 , 'Expected one hint to be shown on load.' ) ;
668- expect ( containerEl . querySelectorAll ( 'md-error' ) . length )
669- . toBe ( 0 , 'Expected no errors to be shown on load.' ) ;
670-
671- testComponent . formControl . markAsTouched ( ) ;
672- fixture . detectChanges ( ) ;
673-
674- fixture . whenStable ( ) . then ( ( ) => {
675- expect ( containerEl . querySelectorAll ( 'md-hint' ) . length )
676- . toBe ( 0 , 'Expected no hints to be shown after interaction.' ) ;
677- expect ( containerEl . querySelectorAll ( 'md-error' ) . length )
678- . toBe ( 1 , 'Expected one error to be shown after interaction.' ) ;
679-
680- testComponent . formControl . setValue ( 'something' ) ;
681- fixture . detectChanges ( ) ;
682-
683- fixture . whenStable ( ) . then ( ( ) => {
684- expect ( containerEl . querySelectorAll ( 'md-hint' ) . length )
685- . toBe ( 0 , 'Expected no hints to be shown after the value is set.' ) ;
686- expect ( containerEl . querySelectorAll ( 'md-error' ) . length )
687- . toBe ( 0 , 'Expected no errors to be shown after the value is set.' ) ;
688- } ) ;
689- } ) ;
690- } ) ) ;
691-
692667 it ( 'should not hide the hint if there are no error messages' , async ( ( ) => {
693668 testComponent . renderError = false ;
694669 fixture . detectChanges ( ) ;
0 commit comments