We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 9fdce65 + 614b9b7 commit 9bd2f39Copy full SHA for 9bd2f39
src/__tests__/context.test.js
@@ -0,0 +1,14 @@
1
+import { expect, test } from 'vitest'
2
+
3
+import { render } from '..'
4
+import Comp from './fixtures/Context.svelte'
5
6
+test('can set a context', () => {
7
+ const message = 'Got it'
8
9
+ const { getByText } = render(Comp, {
10
+ context: new Map(Object.entries({ foo: { message } })),
11
+ })
12
13
+ expect(getByText(message)).toBeTruthy()
14
+})
src/__tests__/fixtures/Context.svelte
@@ -0,0 +1,7 @@
+<script>
+ import { getContext } from 'svelte';
+ const ctx = getContext('foo');
+</script>
+<div>{ctx.message}</div>
0 commit comments