@@ -449,7 +449,10 @@ describe('ReactDOMComponent', () => {
449449 it ( 'should not add an empty src attribute' , ( ) => {
450450 const container = document . createElement ( 'div' ) ;
451451 expect ( ( ) => ReactDOM . render ( < img src = "" /> , container ) ) . toErrorDev (
452- 'An empty string ("") was passed to the src attribute.' ,
452+ 'An empty string ("") was passed to the src attribute. ' +
453+ 'This may cause the browser to download the whole page again over the network. ' +
454+ 'To fix this, either do not render the element at all ' +
455+ 'or pass null to src instead of an empty string.' ,
453456 ) ;
454457 const node = container . firstChild ;
455458 expect ( node . hasAttribute ( 'src' ) ) . toBe ( false ) ;
@@ -458,15 +461,20 @@ describe('ReactDOMComponent', () => {
458461 expect ( node . hasAttribute ( 'src' ) ) . toBe ( true ) ;
459462
460463 expect ( ( ) => ReactDOM . render ( < img src = "" /> , container ) ) . toErrorDev (
461- 'An empty string ("") was passed to the src attribute.' ,
464+ 'An empty string ("") was passed to the src attribute. ' +
465+ 'This may cause the browser to download the whole page again over the network. ' +
466+ 'To fix this, either do not render the element at all ' +
467+ 'or pass null to src instead of an empty string.' ,
462468 ) ;
463469 expect ( node . hasAttribute ( 'src' ) ) . toBe ( false ) ;
464470 } ) ;
465471
466472 it ( 'should not add an empty href attribute' , ( ) => {
467473 const container = document . createElement ( 'div' ) ;
468474 expect ( ( ) => ReactDOM . render ( < link href = "" /> , container ) ) . toErrorDev (
469- 'An empty string ("") was passed to the href attribute.' ,
475+ 'An empty string ("") was passed to the href attribute. ' +
476+ 'To fix this, either do not render the element at all ' +
477+ 'or pass null to href instead of an empty string.' ,
470478 ) ;
471479 const node = container . firstChild ;
472480 expect ( node . hasAttribute ( 'href' ) ) . toBe ( false ) ;
@@ -475,15 +483,19 @@ describe('ReactDOMComponent', () => {
475483 expect ( node . hasAttribute ( 'href' ) ) . toBe ( true ) ;
476484
477485 expect ( ( ) => ReactDOM . render ( < link href = "" /> , container ) ) . toErrorDev (
478- 'An empty string ("") was passed to the href attribute.' ,
486+ 'An empty string ("") was passed to the href attribute. ' +
487+ 'To fix this, either do not render the element at all ' +
488+ 'or pass null to href instead of an empty string.' ,
479489 ) ;
480490 expect ( node . hasAttribute ( 'href' ) ) . toBe ( false ) ;
481491 } ) ;
482492
483493 it ( 'should not add an empty action attribute' , ( ) => {
484494 const container = document . createElement ( 'div' ) ;
485495 expect ( ( ) => ReactDOM . render ( < form action = "" /> , container ) ) . toErrorDev (
486- 'An empty string ("") was passed to the action attribute.' ,
496+ 'An empty string ("") was passed to the action attribute. ' +
497+ 'To fix this, either do not render the element at all ' +
498+ 'or pass null to action instead of an empty string.' ,
487499 ) ;
488500 const node = container . firstChild ;
489501 expect ( node . hasAttribute ( 'action' ) ) . toBe ( false ) ;
@@ -492,7 +504,9 @@ describe('ReactDOMComponent', () => {
492504 expect ( node . hasAttribute ( 'action' ) ) . toBe ( true ) ;
493505
494506 expect ( ( ) => ReactDOM . render ( < form action = "" /> , container ) ) . toErrorDev (
495- 'An empty string ("") was passed to the action attribute.' ,
507+ 'An empty string ("") was passed to the action attribute. ' +
508+ 'To fix this, either do not render the element at all ' +
509+ 'or pass null to action instead of an empty string.' ,
496510 ) ;
497511 expect ( node . hasAttribute ( 'action' ) ) . toBe ( false ) ;
498512 } ) ;
@@ -502,7 +516,9 @@ describe('ReactDOMComponent', () => {
502516 expect ( ( ) =>
503517 ReactDOM . render ( < button formAction = "" /> , container ) ,
504518 ) . toErrorDev (
505- 'An empty string ("") was passed to the formAction attribute.' ,
519+ 'An empty string ("") was passed to the formAction attribute. ' +
520+ 'To fix this, either do not render the element at all ' +
521+ 'or pass null to formAction instead of an empty string.' ,
506522 ) ;
507523 const node = container . firstChild ;
508524 expect ( node . hasAttribute ( 'formAction' ) ) . toBe ( false ) ;
@@ -513,7 +529,9 @@ describe('ReactDOMComponent', () => {
513529 expect ( ( ) =>
514530 ReactDOM . render ( < button formAction = "" /> , container ) ,
515531 ) . toErrorDev (
516- 'An empty string ("") was passed to the formAction attribute.' ,
532+ 'An empty string ("") was passed to the formAction attribute. ' +
533+ 'To fix this, either do not render the element at all ' +
534+ 'or pass null to formAction instead of an empty string.' ,
517535 ) ;
518536 expect ( node . hasAttribute ( 'formAction' ) ) . toBe ( false ) ;
519537 } ) ;
0 commit comments