Skip to content

Commit

Permalink
fix: issue with reading context when not provided
Browse files Browse the repository at this point in the history
  • Loading branch information
DylanPiercey committed Oct 29, 2021
1 parent fba582b commit 417732a
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<div />
<button>
increment
</button>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<div />
<button>
increment
</button>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Assignment to constant variable.
9 changes: 9 additions & 0 deletions src/__tests__/fixtures/get-and-set/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@ describe(
fixture("./templates/self-reference.marko")
);

describe(
"<get> read & assign to missing context",
fixture("./templates/missing-context.marko", [
async ({ screen, fireEvent }) => {
await fireEvent.click(screen.getByText("increment"));
},
])
);

describe(
"<get> & <set> assign to mutable set",
fixture("./templates/assign-to-mutable-set.marko", [
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<get/val="."/>
<div>${val}</div>
<button onClick=(() => val++)>increment</button>
3 changes: 2 additions & 1 deletion src/components/get/index.marko
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,5 @@ class {
}
}

<${input.renderBody}(component.data.default, component.data.defaultChange)/>
$ var data = component.data || {};
<${input.renderBody}(data.default, data.defaultChange)/>

0 comments on commit 417732a

Please sign in to comment.