mirror of https://github.com/sveltejs/svelte
[fix] store reactivity in reactive declarations (#6559)
parent
d487254beb
commit
365b5e300c
@ -0,0 +1,8 @@
|
||||
<script>
|
||||
export let store_container;
|
||||
|
||||
$: ({ store } = store_container);
|
||||
$: value = $store;
|
||||
</script>
|
||||
<div>{value}</div>
|
||||
<div>{$store}</div>
|
@ -0,0 +1,15 @@
|
||||
export default {
|
||||
html: `
|
||||
<div>Hello World</div>
|
||||
<div>Hello World</div>
|
||||
`,
|
||||
|
||||
async test({ assert, component, target, window }) {
|
||||
await component.update_value('Hi Svelte');
|
||||
|
||||
assert.htmlEqual(target.innerHTML, `
|
||||
<div>Hi Svelte</div>
|
||||
<div>Hi Svelte</div>
|
||||
`);
|
||||
}
|
||||
};
|
@ -0,0 +1,12 @@
|
||||
<script>
|
||||
import { writable } from 'svelte/store';
|
||||
import Child from './App.svelte';
|
||||
|
||||
const store_container = { store: writable('Hello World') };
|
||||
|
||||
export function update_value(value) {
|
||||
store_container.store = writable(value);
|
||||
}
|
||||
</script>
|
||||
|
||||
<Child {store_container} />
|
Loading…
Reference in new issue