@@ -423,10 +423,16 @@ function classHasMismatch(
423423 const actualClassSet = toClassSet ( actual || '' )
424424 const expectedClassSet = toClassSet ( expected )
425425
426- const hasMismatch = isIncremental
427- ? // check if the expected classes are present in the actual classes
428- Array . from ( expectedClassSet ) . some ( cls => ! actualClassSet . has ( cls ) )
429- : ! isSetEqual ( actualClassSet , expectedClassSet )
426+ let hasMismatch : boolean = false
427+ if ( isIncremental ) {
428+ if ( expected ) {
429+ hasMismatch = Array . from ( expectedClassSet ) . some (
430+ cls => ! actualClassSet . has ( cls ) ,
431+ )
432+ }
433+ } else {
434+ hasMismatch = ! isSetEqual ( actualClassSet , expectedClassSet )
435+ }
430436
431437 if ( hasMismatch ) {
432438 warnPropMismatch ( el , 'class' , MismatchTypes . CLASS , actual , expected )
@@ -455,12 +461,17 @@ function styleHasMismatch(
455461
456462 // TODO: handle css vars
457463
458- const hasMismatch = isIncremental
459- ? // check if the expected styles are present in the actual styles
460- Array . from ( expectedStyleMap . entries ( ) ) . some (
464+ let hasMismatch : boolean = false
465+ if ( isIncremental ) {
466+ if ( expected ) {
467+ // check if the expected styles are present in the actual styles
468+ hasMismatch = Array . from ( expectedStyleMap . entries ( ) ) . some (
461469 ( [ key , val ] ) => actualStyleMap . get ( key ) !== val ,
462470 )
463- : ! isMapEqual ( actualStyleMap , expectedStyleMap )
471+ }
472+ } else {
473+ hasMismatch = ! isMapEqual ( actualStyleMap , expectedStyleMap )
474+ }
464475
465476 if ( hasMismatch ) {
466477 warnPropMismatch ( el , 'style' , MismatchTypes . STYLE , actual , expected )
0 commit comments