mirror of https://github.com/sveltejs/svelte
fix: allow $store to be used with changing values including nullish values (#7947)
fixes #7555 breaking change: derived now throws an error if you pass falsy values --------- Co-authored-by: Simon Holthausen <simon.holthausen@vercel.com>pull/8566/head
parent
d083f8a3f2
commit
ea73930132
@ -0,0 +1,21 @@
|
|||||||
|
import { writable } from '../../../../store';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
html: `
|
||||||
|
<p>undefined</p>
|
||||||
|
`,
|
||||||
|
async test({ assert, component, target }) {
|
||||||
|
component.store = writable('foo');
|
||||||
|
assert.htmlEqual(target.innerHTML, `
|
||||||
|
<p>foo</p>
|
||||||
|
`);
|
||||||
|
component.store = undefined;
|
||||||
|
assert.htmlEqual(target.innerHTML, `
|
||||||
|
<p>undefined</p>
|
||||||
|
`);
|
||||||
|
component.store = writable('bar');
|
||||||
|
assert.htmlEqual(target.innerHTML, `
|
||||||
|
<p>bar</p>
|
||||||
|
`);
|
||||||
|
}
|
||||||
|
};
|
@ -0,0 +1,5 @@
|
|||||||
|
<script>
|
||||||
|
export let store;
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<p>{$store}</p>
|
Loading…
Reference in new issue