@@ -533,29 +533,17 @@ describe('ReactDOMComponent', () => {
533
533
expect ( node . hasAttribute ( 'action' ) ) . toBe ( false ) ;
534
534
} ) ;
535
535
536
- it ( 'should not add an empty formAction attribute ' , ( ) => {
536
+ it ( 'allows empty string of a formAction to override the default of a parent ' , ( ) => {
537
537
const container = document . createElement ( 'div' ) ;
538
- expect ( ( ) =>
539
- ReactDOM . render ( < button formAction = "" /> , container ) ,
540
- ) . toErrorDev (
541
- 'An empty string ("") was passed to the formAction attribute. ' +
542
- 'To fix this, either do not render the element at all ' +
543
- 'or pass null to formAction instead of an empty string.' ,
538
+ ReactDOM . render (
539
+ < form action = "hello" >
540
+ < button formAction = "" /> ,
541
+ </ form > ,
542
+ container ,
544
543
) ;
545
544
const node = container . firstChild ;
546
- expect ( node . hasAttribute ( 'formAction' ) ) . toBe ( false ) ;
547
-
548
- ReactDOM . render ( < button formAction = "abc" /> , container ) ;
549
- expect ( node . hasAttribute ( 'formAction' ) ) . toBe ( true ) ;
550
-
551
- expect ( ( ) =>
552
- ReactDOM . render ( < button formAction = "" /> , container ) ,
553
- ) . toErrorDev (
554
- 'An empty string ("") was passed to the formAction attribute. ' +
555
- 'To fix this, either do not render the element at all ' +
556
- 'or pass null to formAction instead of an empty string.' ,
557
- ) ;
558
- expect ( node . hasAttribute ( 'formAction' ) ) . toBe ( false ) ;
545
+ expect ( node . hasAttribute ( 'formaction' ) ) . toBe ( true ) ;
546
+ expect ( node . getAttribute ( 'formaction' ) ) . toBe ( '' ) ;
559
547
} ) ;
560
548
561
549
it ( 'should not filter attributes for custom elements' , ( ) => {
0 commit comments