invalidate store values in <script> block - fixes #3537

pull/3538/head
Richard Harris 5 years ago
parent 3f33d35573
commit c12e7d6389

@ -18,7 +18,8 @@ export function invalidate(component: Component, scope: Scope, code: MagicString
(
variable.referenced ||
variable.is_reactive_dependency ||
variable.export_name
variable.export_name ||
variable.name[0] === '$'
)
);
});

@ -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…
Cancel
Save