File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -70,18 +70,18 @@ describe('reactElementToJSXString(ReactElement)', () => {
70
70
reactElementToJSXString (
71
71
React . createElement ( 'div' , { title : "<'hello' you & you>" } )
72
72
)
73
- ) . toEqual ( '<div title="<' hello' you & you> " />' ) ;
73
+ ) . toEqual ( '<div title="<\' hello\' you & you> " />' ) ;
74
74
} ) ;
75
75
76
76
it ( "reactElementToJSXString(<div obj={{ nested: <div arr={['hello', 'you']} /> }} />)" , ( ) => {
77
77
expect (
78
78
reactElementToJSXString (
79
- < div obj = { { nested : < div arr = { [ 'hello' , 'you' ] } / > } } />
79
+ < div obj = { { nested : < div arr = { [ 'hello' , 'you' ] } > Hello "' you </ div > } } />
80
80
)
81
81
) . toEqual (
82
82
`<div
83
83
obj={{
84
- nested: <div arr={['hello', 'you']} / >
84
+ nested: <div arr={['hello', 'you']}>Hello "' you</div >
85
85
}}
86
86
/>`
87
87
) ;
Original file line number Diff line number Diff line change @@ -5,8 +5,9 @@ import isPlainObject from 'is-plain-object';
5
5
import stringify from 'stringify-object' ;
6
6
import sortobject from 'sortobject' ;
7
7
import traverse from 'traverse' ;
8
- import { fill , escape } from 'lodash' ;
8
+ import { fill } from 'lodash' ;
9
9
10
+ const escape = s => s . replace ( / " / g, '"' ) ;
10
11
const defaultFunctionValue = fn => fn ;
11
12
12
13
export default function reactElementToJSXString (
You can’t perform that action at this time.
0 commit comments