@@ -501,6 +501,36 @@ describe('ValidateMixin', () => {
501501 expect ( cbInfo . callCount ) . to . equal ( 2 ) ;
502502 expect ( cbSuccess . callCount ) . to . equal ( 1 ) ;
503503 } ) ;
504+
505+ it ( 'removes invalid states whenever modelValue becomes undefined' , async ( ) => {
506+ const el = await fixture ( html `
507+ < ${ tag }
508+ .errorValidators=${ [ [ minLength , { min : 3 } ] ] }
509+ .warningValidators=${ [ [ minLength , { min : 5 } ] ] }
510+ .infoValidators=${ [ [ minLength , { min : 7 } ] ] }
511+ .successValidators=${ [ [ alwaysFalse ] ] }
512+ > ${ lightDom } </ ${ tag } >
513+ ` ) ;
514+
515+ el . modelValue = 'a' ;
516+ expect ( el . warningState ) . to . equal ( true ) ;
517+ expect ( el . infoState ) . to . equal ( true ) ;
518+ expect ( el . successState ) . to . equal ( true ) ;
519+ expect ( el . error ) . to . not . eql ( { } ) ;
520+ expect ( el . warning ) . to . not . eql ( { } ) ;
521+ expect ( el . info ) . to . not . eql ( { } ) ;
522+ expect ( el . success ) . to . not . eql ( { } ) ;
523+
524+ el . modelValue = undefined ;
525+ expect ( el . errorState ) . to . equal ( false ) ;
526+ expect ( el . warningState ) . to . equal ( false ) ;
527+ expect ( el . infoState ) . to . equal ( false ) ;
528+ expect ( el . successState ) . to . equal ( false ) ;
529+ expect ( el . error ) . to . eql ( { } ) ;
530+ expect ( el . warning ) . to . eql ( { } ) ;
531+ expect ( el . info ) . to . eql ( { } ) ;
532+ expect ( el . success ) . to . eql ( { } ) ;
533+ } ) ;
504534 } ) ;
505535
506536 describe ( `Accessibility ${ suffixName } ` , ( ) => {
@@ -690,6 +720,9 @@ describe('ValidateMixin', () => {
690720 const errorRenderer = defineCE (
691721 class extends HTMLElement {
692722 renderFeedback ( validationStates , message ) {
723+ if ( ! message . list . length ) {
724+ return ;
725+ }
693726 const validator = message . list [ 0 ] . data . validatorName ;
694727 const showError = validationStates . error ;
695728 this . innerText = showError ? `ERROR on ${ validator } ` : '' ;
@@ -982,6 +1015,9 @@ describe('ValidateMixin', () => {
9821015 const errorRenderer = defineCE (
9831016 class extends HTMLElement {
9841017 renderFeedback ( validationStates , message ) {
1018+ if ( ! message . list . length ) {
1019+ return ;
1020+ }
9851021 const validator = message . list [ 0 ] . data . validatorName ;
9861022 const hide =
9871023 message . list [ 0 ] . data . validatorConfig &&
0 commit comments