Skip to content

Commit e29bcbb

Browse files
committed
Work around JSX parsing quirk triggered by bootstrap-tests's output
1 parent 1b9c149 commit e29bcbb

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

bootstrap-tests.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ function writeFixtures() {
1818
for (let key of Object.keys(fixtures)) {
1919
const jsx = fixtures[key].jsx;
2020
const wrapper = render(jsx);
21-
const jsxCode = `(${toOneLine(reactElementToJsx(jsx))})`;
21+
const jsxCode = `(${markupToOneLine(reactElementToJsx(jsx))})`;
2222
const htmlCode = JSON.stringify(wrapper.html());
2323

24-
write(`\t${JSON.stringify(key)}: {jsx: ${jsxCode}, html: ${htmlCode}},`);
24+
write(`\t${JSON.stringify(key)}: {jsx: ${jsxCode}, svg: ${htmlCode}},`);
2525
}
2626
}
27-
function toOneLine(code) {
28-
return code.replace(/\s*[\r\n]\s*/g, ' ').replace(/\s+/g, ' ');
27+
function markupToOneLine(code) {
28+
return code.replace(/\s*[\r\n]\s*/g, ' ').replace(/\s+/g, ' ').replace(/\s*([<>])\s*/g, '$1');
2929
}
3030

3131
// Input control

0 commit comments

Comments
 (0)