mirror of https://github.com/sveltejs/svelte
allow reactive declarations without dependencies - fixes #2285
parent
ade0bc870a
commit
30c8fe0c6e
@ -0,0 +1,12 @@
|
|||||||
|
export default {
|
||||||
|
html: `
|
||||||
|
<p>10 - 90</p>
|
||||||
|
`,
|
||||||
|
|
||||||
|
test({ assert, component, target }) {
|
||||||
|
component.width = 50;
|
||||||
|
assert.htmlEqual(target.innerHTML, `
|
||||||
|
<p>10 - 40</p>
|
||||||
|
`);
|
||||||
|
}
|
||||||
|
};
|
@ -0,0 +1,10 @@
|
|||||||
|
<script>
|
||||||
|
export let width = 100;
|
||||||
|
|
||||||
|
const padding = 10;
|
||||||
|
|
||||||
|
$: x1 = padding;
|
||||||
|
$: x2 = width - padding;
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<p>{x1} - {x2}</p>
|
@ -1,7 +0,0 @@
|
|||||||
[{
|
|
||||||
"message": "Invalid reactive declaration — must depend on local state",
|
|
||||||
"code": "invalid-reactive-declaration",
|
|
||||||
"start": { "line": 2, "column": 1, "character": 10 },
|
|
||||||
"end": { "line": 2, "column": 23, "character": 32 },
|
|
||||||
"pos": 10
|
|
||||||
}]
|
|
@ -1,3 +0,0 @@
|
|||||||
<script>
|
|
||||||
$: console.log('foo');
|
|
||||||
</script>
|
|
Loading…
Reference in new issue