Skip to content

Commit cb1cb66

Browse files
committed
Tests for HTML entity encoding
1 parent f188259 commit cb1cb66

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

test/index.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,20 @@ describe('render-to-string', () => {
3131

3232
expect(rendered).to.equal(expected);
3333
});
34+
35+
it('should omit functions', () => {
36+
let rendered = render(<div a={()=>{}} b={function(){}} />),
37+
expected = `<div></div>`;
38+
39+
expect(rendered).to.equal(expected);
40+
});
41+
42+
it('should encode entities', () => {
43+
let rendered = render(<div a={'"<>&'}>{'"<>&'}</div>),
44+
expected = `<div a="&quot;&lt;&gt;&amp;">&quot;&lt;&gt;&amp;</div>`;
45+
46+
expect(rendered).to.equal(expected);
47+
});
3448
});
3549

3650
describe('Functional Components', () => {

0 commit comments

Comments
 (0)