Skip to content

Commit 27f10ac

Browse files
committed
Add a test for a babel-transform-jsx-to-htm problem
JSX expressions such as <><Foo />{Bar}</> get parsed into unbalanced TemplateLiteral expressions where there are less quasis than there should be when compared to the number of expressions.
1 parent 864036b commit 27f10ac

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

test/babel-transform-jsx.test.mjs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,12 @@ describe('babel-plugin-transform-jsx-to-htm', () => {
177177
compile(`<React.Fragment>{Foo}{Bar}</React.Fragment>`)
178178
).toBe('html`${Foo}${Bar}`;');
179179
});
180+
181+
test('short syntax fragments should not crash due to TemplateLiteral quasi/expression unbalance', () => {
182+
expect(
183+
compile(`<><Foo />{Bar}</>`)
184+
).toBe('html`<${Foo}/>${Bar}`;');
185+
});
180186
});
181187

182188
describe('props', () => {

0 commit comments

Comments
 (0)