Skip to content

Commit

Permalink
test: spread children
Browse files Browse the repository at this point in the history
  • Loading branch information
rhyzx committed Nov 27, 2023
1 parent c342774 commit 4799a1b
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions test/transpiler/transpiler.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1454,6 +1454,31 @@ export var ComponentThatHasSpreadCausesDeopt = <Hello {...spread} />
});
});

it("JSX spread children", () => {
var bun = new Bun.Transpiler({
loader: "jsx",
define: {
"process.env.NODE_ENV": JSON.stringify("development"),
},
});
expect(bun.transformSync("export var foo = <div>{...a}b</div>")).toBe(
`export var foo = jsxDEV("div", {
children: [
...a,
"b"
]
}, undefined, true, undefined, this);
`,
);

expect(bun.transformSync("export var foo = <div>{...a}</div>")).toBe(
`export var foo = jsxDEV("div", {
children: [...a]
}, undefined, true, undefined, this);
`,
);
});

it("require with a dynamic non-string expression", () => {
var nodeTranspiler = new Bun.Transpiler({ platform: "node" });
expect(nodeTranspiler.transformSync("require('hi' + bar)")).toBe('require("hi" + bar);\n');
Expand Down

0 comments on commit 4799a1b

Please sign in to comment.