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
pull/11112/head
Dominic Gannaway 9 months ago committed by GitHub
parent e8f7437cf6
commit ce348f0d69
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,7 @@
import { test } from '../../test';
export default test({
async test({ assert, target }) {
assert.htmlEqual(target.innerHTML, `hello world`);
}
});

@ -0,0 +1,11 @@
<script>
import { getContext, setContext } from 'svelte';
setContext('val', 'hello world')
const get_val = () => {
return getContext('val');
}
</script>
{get_val()}
Loading…
Cancel
Save