Skip to content

Commit

Permalink
fix(quotes): fixes #82 #81 #80
Browse files Browse the repository at this point in the history
  • Loading branch information
vvo committed Jun 7, 2017
1 parent 5c0ae3e commit 3d96ddc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 3 additions & 3 deletions index-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,18 @@ describe('reactElementToJSXString(ReactElement)', () => {
reactElementToJSXString(
React.createElement('div', { title: "<'hello' you & you>" })
)
).toEqual('<div title="&lt;&#39;hello&#39; you &amp; you&gt;" />');
).toEqual('<div title="<\'hello\' you & you>" />');
});

it("reactElementToJSXString(<div obj={{ nested: <div arr={['hello', 'you']} /> }} />)", () => {
expect(
reactElementToJSXString(
<div obj={{ nested: <div arr={['hello', 'you']} /> }} />
<div obj={{ nested: <div arr={['hello', 'you']}>Hello "' you</div> }} />
)
).toEqual(
`<div
obj={{
nested: <div arr={['hello', 'you']} />
nested: <div arr={['hello', 'you']}>Hello "' you</div>
}}
/>`
);
Expand Down
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ import isPlainObject from 'is-plain-object';
import stringify from 'stringify-object';
import sortobject from 'sortobject';
import traverse from 'traverse';
import { fill, escape } from 'lodash';
import { fill } from 'lodash';

const escape = s => s.replace(/"/g, '&quot;');
const defaultFunctionValue = fn => fn;

export default function reactElementToJSXString(
Expand Down

0 comments on commit 3d96ddc

Please sign in to comment.