Skip to content

Commit

Permalink
[enzyme] [fix] render: latest cheerio can serialize innerHTML pro…
Browse files Browse the repository at this point in the history
…perly

Fixes #1297
  • Loading branch information
ljharb committed Dec 22, 2020
1 parent 0d5ead7 commit 95f8c40
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions packages/enzyme-test-suite/test/staticRender-spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,4 +142,10 @@ describeWithDOM('render', () => {
expect(() => render(<LazyComponent />, { suspenseFallback: false })).to.throw();
});
});

describe('can properly serialize innerHTML', () => {
const wrapper = render(<span><svg dangerouslySetInnerHTML={{ __html: '<use xlink:href="#1" />' }} /></span>);

expect(wrapper.find('svg').html()).to.equal('<use xlink:href="#1"></use>');
});
});
2 changes: 1 addition & 1 deletion packages/enzyme/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"license": "MIT",
"dependencies": {
"array.prototype.flat": "^1.2.3",
"cheerio": "^1.0.0-rc.3",
"cheerio": "^1.0.0-rc.5",
"enzyme-shallow-equal": "^1.0.4",
"function.prototype.name": "^1.1.2",
"has": "^1.0.3",
Expand Down

0 comments on commit 95f8c40

Please sign in to comment.