diff --git a/src/lexers/jsx-lexer.js b/src/lexers/jsx-lexer.js index eba68964..147a8bbe 100644 --- a/src/lexers/jsx-lexer.js +++ b/src/lexers/jsx-lexer.js @@ -170,7 +170,7 @@ export default class JsxLexer extends JavascriptLexer { const childrenString = elemsToString(child.children) return childrenString || !(useTagName && child.selfClosing) ? `<${elementName}>${childrenString}` - : `<${elementName} />` + : `<${elementName}/>` default: throw new Error('Unknown parsed content: ' + child.type) } diff --git a/test/lexers/jsx-lexer.test.js b/test/lexers/jsx-lexer.test.js index 41cf7744..8519684f 100644 --- a/test/lexers/jsx-lexer.test.js +++ b/test/lexers/jsx-lexer.test.js @@ -366,7 +366,7 @@ describe('JsxLexer', () => { it('keeps self-closing tags untouched when transSupportBasicHtmlNodes is true', (done) => { const Lexer = new JsxLexer({ transSupportBasicHtmlNodes: true }) const content = 'a
b
' - assert.equal(Lexer.extract(content)[0].defaultValue, 'a
b') + assert.equal(Lexer.extract(content)[0].defaultValue, 'a
b') done() })