mirror of
https://github.com/zadam/trilium.git
synced 2025-12-21 23:04:24 +01:00
This commit is contained in:
parent
444c0c6107
commit
c4f55395a9
@ -95,8 +95,8 @@ describe("JSX building", () => {
|
||||
}
|
||||
`;
|
||||
const expected = trimIndentation`\
|
||||
"use strict";const _jsxFileName = "";function MyComponent() {
|
||||
return api.preact.h('p', {__self: this, __source: {fileName: _jsxFileName, lineNumber: 2}}, "Hello world." );
|
||||
"use strict";function MyComponent() {
|
||||
return api.preact.h('p', null, "Hello world." );
|
||||
}
|
||||
`;
|
||||
expect(buildJsx(script).code).toStrictEqual(expected);
|
||||
@ -112,10 +112,10 @@ describe("JSX building", () => {
|
||||
}
|
||||
`;
|
||||
const expected = trimIndentation`\
|
||||
"use strict";const _jsxFileName = "";function MyComponent() {
|
||||
"use strict";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")
|
||||
, api.preact.h('p', null, "Hi")
|
||||
, api.preact.h('p', null, "there")
|
||||
);
|
||||
}
|
||||
`;
|
||||
@ -156,10 +156,10 @@ describe("JSX building", () => {
|
||||
});
|
||||
`;
|
||||
const expected = trimIndentation`\
|
||||
"use strict";const _jsxFileName = "";const _triliumpreact = api.preact;
|
||||
"use strict";const _triliumpreact = api.preact;
|
||||
_triliumpreact.defineWidget.call(void 0, {
|
||||
render() {
|
||||
return api.preact.h(_triliumpreact.RightPanelWidget, {__self: this, __source: {fileName: _jsxFileName, lineNumber: 4}} );
|
||||
return api.preact.h(_triliumpreact.RightPanelWidget, null );
|
||||
}
|
||||
});
|
||||
`;
|
||||
|
||||
@ -224,6 +224,7 @@ export function buildJsx(contentRaw: string | Buffer) {
|
||||
transforms: ["jsx", "imports"],
|
||||
jsxPragma: "api.preact.h",
|
||||
jsxFragmentPragma: "api.preact.Fragment",
|
||||
production: true
|
||||
});
|
||||
|
||||
let code = output.code;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user