mirror of
https://github.com/zadam/trilium.git
synced 2025-12-22 23:34:25 +01:00
test(script/jsx): JSX fragment
This commit is contained in:
parent
645557b505
commit
dcd73ff9f9
@ -101,4 +101,24 @@ describe("JSX building", () => {
|
|||||||
`;
|
`;
|
||||||
expect(buildJsx(script).code).toStrictEqual(expected);
|
expect(buildJsx(script).code).toStrictEqual(expected);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("processes fragments", () => {
|
||||||
|
const script = trimIndentation`\
|
||||||
|
function MyComponent() {
|
||||||
|
return <>
|
||||||
|
<p>Hi</p>
|
||||||
|
<p>there</p>
|
||||||
|
</>;
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
const expected = trimIndentation`\
|
||||||
|
const _jsxFileName = "";function MyComponent() {
|
||||||
|
return api.preact.h(api.preact.Fragment, null
|
||||||
|
, api.preact.h('p', {__self: this, __source: {fileName: _jsxFileName, lineNumber: 3}}, "Hi")
|
||||||
|
, api.preact.h('p', {__self: this, __source: {fileName: _jsxFileName, lineNumber: 4}}, "there")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
expect(buildJsx(script).code).toStrictEqual(expected);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user