Skip to content

Commit

Permalink
Add failing test for unnecessary string escaping
Browse files Browse the repository at this point in the history
Occurs in nested JSX that contains single quotes

Issue #80
  • Loading branch information
beauroberts committed May 26, 2017
1 parent 8ad627e commit 99adc0e
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions index-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,20 @@ describe('reactElementToJSXString(ReactElement)', () => {
).toEqual('<div title="&lt;&#39;hello&#39; you &amp; you&gt;" />');
});

it("reactElementToJSXString(<div obj={{ nested: <div arr={['hello', 'you']} /> }} />)", () => {
expect(
reactElementToJSXString(
<div obj={{ nested: <div arr={['hello', 'you']} /> }} />
)
).toEqual(
`<div
obj={{
nested: <div arr={['hello', 'you']} />
}}
/>`
);
});

it("reactElementToJSXString(React.createElement('div', {title: Symbol('hello \"you\"')})", () => {
expect(
reactElementToJSXString(
Expand Down

0 comments on commit 99adc0e

Please sign in to comment.