mirror of https://github.com/sveltejs/svelte
fix: improve handling of object property deletions (#10456)
* fix: improve handling of object property deletions * revert * revert * revertpull/10458/head
parent
1366932dc0
commit
9161448ee5
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"svelte": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix: improve handling of object property deletions
|
@ -0,0 +1,20 @@
|
|||||||
|
import { test } from '../../test';
|
||||||
|
|
||||||
|
export default test({
|
||||||
|
html: '<button>set</button><button>delete</button><p>a,b,c</p><p>{"a":1,"b":2,"c":3}</p>',
|
||||||
|
async test({ assert, target }) {
|
||||||
|
const [btn, bt2] = target.querySelectorAll('button');
|
||||||
|
|
||||||
|
await btn?.click();
|
||||||
|
assert.htmlEqual(
|
||||||
|
target.innerHTML,
|
||||||
|
`<button>set</button><button>delete</button><p>a,b,c</p><p>{"a":1,"b":2,"c":3}</p>`
|
||||||
|
);
|
||||||
|
|
||||||
|
await bt2?.click();
|
||||||
|
assert.htmlEqual(
|
||||||
|
target.innerHTML,
|
||||||
|
`<button>set</button><button>delete</button><p>a,c</p><p>{"a":1,"c":3}</p>`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
@ -0,0 +1,8 @@
|
|||||||
|
<script>
|
||||||
|
let numbers = $state({ a: 1, b: 2, c: 3 });
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<button onclick={() => { numbers.b = 2; }}>set</button>
|
||||||
|
<button onclick={() => { delete numbers.b; }}>delete</button>
|
||||||
|
<p>{Object.keys(numbers)}</p>
|
||||||
|
<p>{JSON.stringify(numbers)}</p>
|
Loading…
Reference in new issue