mirror of https://github.com/sveltejs/svelte
Merge pull request #3538 from sveltejs/gh-3537
invalidate store values in <script> blockpull/3540/head
commit
50ae5724d2
@ -0,0 +1,5 @@
|
||||
<script>
|
||||
import { count } from './store.js';
|
||||
</script>
|
||||
|
||||
<p>count: {$count}</p>
|
@ -0,0 +1,13 @@
|
||||
import { count } from './store.js';
|
||||
|
||||
export default {
|
||||
html: `<p>count: 0</p>`,
|
||||
|
||||
async test({ assert, component, target }) {
|
||||
await component.increment();
|
||||
|
||||
assert.htmlEqual(target.innerHTML, `<p>count: 1</p>`);
|
||||
|
||||
count.set(0);
|
||||
}
|
||||
};
|
@ -0,0 +1,10 @@
|
||||
<script>
|
||||
import Nested from './Nested.svelte';
|
||||
import { count } from './store.js';
|
||||
|
||||
export function increment() {
|
||||
$count++;
|
||||
}
|
||||
</script>
|
||||
|
||||
<Nested />
|
@ -0,0 +1,3 @@
|
||||
import { writable } from '../../../../store';
|
||||
|
||||
export const count = writable(0);
|
Loading…
Reference in new issue