Skip to content

Commit 49d46dd

Browse files
committed
Add tests for element name protection
1 parent 5964a5c commit 49d46dd

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

test/render.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,16 @@ describe('render', () => {
8585
});
8686
});
8787

88+
it('should throw for invalid nodeName values', () => {
89+
expect(() => render(h('div'))).not.to.throw();
90+
expect(() => render(h('x-💩'))).not.to.throw();
91+
expect(() => render(h('a b'))).to.throw(/<a b>/);
92+
expect(() => render(h('a\0b'))).to.throw(/<a\0b>/);
93+
expect(() => render(h('a>'))).to.throw(/<a>>/);
94+
expect(() => render(h('<'))).to.throw(/<<>/);
95+
expect(() => render(h('"'))).to.throw(/<">/);
96+
});
97+
8898
it('should collapse collapsible attributes', () => {
8999
let rendered = render(<div class="" style="" foo={true} bar />),
90100
expected = `<div class style foo bar></div>`;

0 commit comments

Comments
 (0)