@@ -449,7 +449,10 @@ describe('ReactDOMComponent', () => {
449
449
it ( 'should not add an empty src attribute' , ( ) => {
450
450
const container = document . createElement ( 'div' ) ;
451
451
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.' ,
453
456
) ;
454
457
const node = container . firstChild ;
455
458
expect ( node . hasAttribute ( 'src' ) ) . toBe ( false ) ;
@@ -458,15 +461,20 @@ describe('ReactDOMComponent', () => {
458
461
expect ( node . hasAttribute ( 'src' ) ) . toBe ( true ) ;
459
462
460
463
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.' ,
462
468
) ;
463
469
expect ( node . hasAttribute ( 'src' ) ) . toBe ( false ) ;
464
470
} ) ;
465
471
466
472
it ( 'should not add an empty href attribute' , ( ) => {
467
473
const container = document . createElement ( 'div' ) ;
468
474
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.' ,
470
478
) ;
471
479
const node = container . firstChild ;
472
480
expect ( node . hasAttribute ( 'href' ) ) . toBe ( false ) ;
@@ -475,15 +483,19 @@ describe('ReactDOMComponent', () => {
475
483
expect ( node . hasAttribute ( 'href' ) ) . toBe ( true ) ;
476
484
477
485
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.' ,
479
489
) ;
480
490
expect ( node . hasAttribute ( 'href' ) ) . toBe ( false ) ;
481
491
} ) ;
482
492
483
493
it ( 'should not add an empty action attribute' , ( ) => {
484
494
const container = document . createElement ( 'div' ) ;
485
495
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.' ,
487
499
) ;
488
500
const node = container . firstChild ;
489
501
expect ( node . hasAttribute ( 'action' ) ) . toBe ( false ) ;
@@ -492,7 +504,9 @@ describe('ReactDOMComponent', () => {
492
504
expect ( node . hasAttribute ( 'action' ) ) . toBe ( true ) ;
493
505
494
506
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.' ,
496
510
) ;
497
511
expect ( node . hasAttribute ( 'action' ) ) . toBe ( false ) ;
498
512
} ) ;
@@ -502,7 +516,9 @@ describe('ReactDOMComponent', () => {
502
516
expect ( ( ) =>
503
517
ReactDOM . render ( < button formAction = "" /> , container ) ,
504
518
) . 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.' ,
506
522
) ;
507
523
const node = container . firstChild ;
508
524
expect ( node . hasAttribute ( 'formAction' ) ) . toBe ( false ) ;
@@ -513,7 +529,9 @@ describe('ReactDOMComponent', () => {
513
529
expect ( ( ) =>
514
530
ReactDOM . render ( < button formAction = "" /> , container ) ,
515
531
) . 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.' ,
517
535
) ;
518
536
expect ( node . hasAttribute ( 'formAction' ) ) . toBe ( false ) ;
519
537
} ) ;
0 commit comments