Skip to content

Commit ce348f0

Browse files
authored
chore: add test to show usage of context in component template (#11061)
* chore: prevent usage of getContext during component template * repurpose test to be just a test to capture context in template
1 parent e8f7437 commit ce348f0

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { test } from '../../test';
2+
3+
export default test({
4+
async test({ assert, target }) {
5+
assert.htmlEqual(target.innerHTML, `hello world`);
6+
}
7+
});
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<script>
2+
import { getContext, setContext } from 'svelte';
3+
4+
setContext('val', 'hello world')
5+
6+
const get_val = () => {
7+
return getContext('val');
8+
}
9+
</script>
10+
11+
{get_val()}

0 commit comments

Comments
 (0)