@@ -641,7 +641,7 @@ describe('MdInputContainer', function () {
641641 } ) ;
642642 } ) ) ;
643643
644- it ( 'should hide the error messages once the input becomes valid' , async ( ( ) => {
644+ it ( 'should hide the errors and show the hints once the input becomes valid' , async ( ( ) => {
645645 testComponent . formControl . markAsTouched ( ) ;
646646 fixture . detectChanges ( ) ;
647647
@@ -650,6 +650,8 @@ describe('MdInputContainer', function () {
650650 . toContain ( 'mat-input-invalid' , 'Expected container to have the invalid CSS class.' ) ;
651651 expect ( containerEl . querySelectorAll ( 'md-error' ) . length )
652652 . toBe ( 1 , 'Expected one error message to have been rendered.' ) ;
653+ expect ( containerEl . querySelectorAll ( 'md-hint' ) . length )
654+ . toBe ( 0 , 'Expected no hints to be shown.' ) ;
653655
654656 testComponent . formControl . setValue ( 'something' ) ;
655657 fixture . detectChanges ( ) ;
@@ -659,39 +661,12 @@ describe('MdInputContainer', function () {
659661 'Expected container not to have the invalid class when valid.' ) ;
660662 expect ( containerEl . querySelectorAll ( 'md-error' ) . length )
661663 . toBe ( 0 , 'Expected no error messages when the input is valid.' ) ;
664+ expect ( containerEl . querySelectorAll ( 'md-hint' ) . length )
665+ . toBe ( 1 , 'Expected one hint to be shown once the input is valid.' ) ;
662666 } ) ;
663667 } ) ;
664668 } ) ) ;
665669
666- it ( 'should hide the hints when there are errors and not show them again when' +
667- ' the input becomes valid' , async ( ( ) => {
668-
669- expect ( containerEl . querySelectorAll ( 'md-hint' ) . length )
670- . toBe ( 1 , 'Expected one hint to be shown on load.' ) ;
671- expect ( containerEl . querySelectorAll ( 'md-error' ) . length )
672- . toBe ( 0 , 'Expected no errors to be shown on load.' ) ;
673-
674- testComponent . formControl . markAsTouched ( ) ;
675- fixture . detectChanges ( ) ;
676-
677- fixture . whenStable ( ) . then ( ( ) => {
678- expect ( containerEl . querySelectorAll ( 'md-hint' ) . length )
679- . toBe ( 0 , 'Expected no hints to be shown after interaction.' ) ;
680- expect ( containerEl . querySelectorAll ( 'md-error' ) . length )
681- . toBe ( 1 , 'Expected one error to be shown after interaction.' ) ;
682-
683- testComponent . formControl . setValue ( 'something' ) ;
684- fixture . detectChanges ( ) ;
685-
686- fixture . whenStable ( ) . then ( ( ) => {
687- expect ( containerEl . querySelectorAll ( 'md-hint' ) . length )
688- . toBe ( 0 , 'Expected no hints to be shown after the value is set.' ) ;
689- expect ( containerEl . querySelectorAll ( 'md-error' ) . length )
690- . toBe ( 0 , 'Expected no errors to be shown after the value is set.' ) ;
691- } ) ;
692- } ) ;
693- } ) ) ;
694-
695670 it ( 'should not hide the hint if there are no error messages' , async ( ( ) => {
696671 testComponent . renderError = false ;
697672 fixture . detectChanges ( ) ;
0 commit comments