mirror of https://github.com/sveltejs/svelte
prevent writing to reactive values - fixes #1920
parent
5be480d7ac
commit
b8e0cccea8
@ -0,0 +1,21 @@
|
||||
export default {
|
||||
html: `
|
||||
<p>doubled: 2</p>
|
||||
`,
|
||||
|
||||
test({ assert, component, target }) {
|
||||
component.a = 2;
|
||||
|
||||
assert.equal(component.doubled, 4);
|
||||
assert.htmlEqual(target.innerHTML, `
|
||||
<p>doubled: 4</p>
|
||||
`);
|
||||
|
||||
component.doubled = 6;
|
||||
|
||||
assert.equal(component.doubled, 4);
|
||||
assert.htmlEqual(target.innerHTML, `
|
||||
<p>doubled: 4</p>
|
||||
`);
|
||||
}
|
||||
};
|
@ -0,0 +1,8 @@
|
||||
<script>
|
||||
export let a = 1;
|
||||
export let doubled;
|
||||
|
||||
$: doubled = a * 2;
|
||||
</script>
|
||||
|
||||
<p>doubled: {doubled}</p>
|
Loading…
Reference in new issue