Skip to content

Commit 4ebb707

Browse files
committed
chore: release v2.0.0-beta.49
1 parent 960815b commit 4ebb707

File tree

6 files changed

+39
-5
lines changed

6 files changed

+39
-5
lines changed

packages/compiler/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@canvasengine/compiler",
3-
"version": "2.0.0-beta.48",
3+
"version": "2.0.0-beta.49",
44
"description": "",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",

packages/compiler/tests/compiler2.spec.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,12 @@ describe("Compiler", () => {
562562
expect(output).toBe(`h(Container, { obj: computed(() => ({ foo: bar(), nested: baz })) })`);
563563
});
564564

565+
test('should compile object attribute with spread and function', () => {
566+
const input = `<Container obj={{ ...base, count: total() }} />`;
567+
const output = parser.parse(input);
568+
expect(output).toBe(`h(Container, { obj: computed(() => ({ ...base, count: total() })) })`);
569+
});
570+
565571
test("should compile component with complex object attribute", () => {
566572
const input = `<Sprite
567573
sheet={{
@@ -655,6 +661,12 @@ describe("Compiler", () => {
655661
expect(output).toBe(`h(Canvas, { width: computed(() => [x(), 20]) })`);
656662
});
657663

664+
test("should compile component with array attribute containing expression without computed", () => {
665+
const input = `<Canvas width={ [x + 1, y] } />`;
666+
const output = parser.parse(input);
667+
expect(output).toBe(`h(Canvas, { width: [x + 1, y] })`);
668+
});
669+
658670
test("should compile component with standalone dynamic attribute", () => {
659671
const input = `<Canvas width />`;
660672
const output = parser.parse(input);
@@ -751,6 +763,12 @@ describe("Compiler", () => {
751763
expect(output).toBe(`h(Sprite, { click: selected() })`);
752764
});
753765

766+
test('should compile component with complex event handler expression without computed', () => {
767+
const input = `<Sprite click={selected() ? onA : onB} />`;
768+
const output = parser.parse(input);
769+
expect(output).toBe(`h(Sprite, { click: selected() ? onA : onB })`);
770+
});
771+
754772
test("should compile component with component attribute", () => {
755773
const input = `<Canvas child={<Sprite />} />`;
756774
const output = parser.parse(input);
@@ -816,6 +834,12 @@ describe("Compiler", () => {
816834
expect(output).toBe(`h(DOMElement, { element: "p", textContent: computed(() => a + b()) })`);
817835
});
818836

837+
test("should compile text content with multiple function calls", () => {
838+
const input = `<p>{a() + b()}</p>`;
839+
const output = parser.parse(input);
840+
expect(output).toBe(`h(DOMElement, { element: "p", textContent: computed(() => a() + b()) })`);
841+
});
842+
819843
test("should compile text content with dot notation without computed", () => {
820844
const input = `<p>{user.name}</p>`;
821845
const output = parser.parse(input);
@@ -1025,6 +1049,16 @@ describe("Condition", () => {
10251049
expect(output).toBe(`cond(val(), () => h(Sprite))`);
10261050
});
10271051

1052+
test("should compile condition with function call without computed", () => {
1053+
const input = `
1054+
@if (isVisible()) {
1055+
<Sprite />
1056+
}
1057+
`;
1058+
const output = parser.parse(input);
1059+
expect(output).toBe(`cond(isVisible(), () => h(Sprite))`);
1060+
});
1061+
10281062
test("should compile condition for multiple sprites", () => {
10291063
const input = `
10301064
@if (sprite) {

packages/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "canvasengine",
3-
"version": "2.0.0-beta.48",
3+
"version": "2.0.0-beta.49",
44
"type": "module",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",

packages/presets/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@canvasengine/presets",
3-
"version": "2.0.0-beta.48",
3+
"version": "2.0.0-beta.49",
44
"type": "module",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",

packages/testing/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@canvasengine/testing",
3-
"version": "2.0.0-beta.48",
3+
"version": "2.0.0-beta.49",
44
"description": "Testing utilities and mocks for CanvasEngine",
55
"type": "module",
66
"main": "dist/index.js",

packages/tiled/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@canvasengine/tiled",
3-
"version": "2.0.0-beta.48",
3+
"version": "2.0.0-beta.49",
44
"description": "",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",

0 commit comments

Comments
 (0)