Skip to content

Commit f16e445

Browse files
committed
chore: push failing test for extrapolated reference
1 parent e237132 commit f16e445

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { flushSync } from 'svelte';
2+
import { test } from '../../test';
3+
4+
export default test({
5+
async test({ assert, target, logs }) {
6+
const [btn, btn2, btn3, btn4] = target.querySelectorAll('button');
7+
logs.length = 0;
8+
9+
flushSync(() => {
10+
btn.click();
11+
});
12+
flushSync(() => {
13+
btn2.click();
14+
});
15+
flushSync(() => {
16+
btn3.click();
17+
});
18+
flushSync(() => {
19+
btn4.click();
20+
});
21+
assert.deepEqual(logs, []);
22+
}
23+
});
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<script>
2+
let arr = $state([{ count: 1 }, { count: 1 }], {
3+
onchange(){
4+
console.log("arr");
5+
}
6+
});
7+
8+
const item = arr.pop();
9+
10+
const item_2 = arr[0];
11+
12+
arr[0] = { count: 1 };
13+
14+
let obj = $state({ value: { count: 0 }, key: { count: 0 } }, {
15+
onchange(){
16+
console.log("obj");
17+
}
18+
});
19+
20+
const item_3 = obj.value;
21+
delete obj.value;
22+
23+
const values = [...Object.values(obj)];
24+
25+
delete obj.key;
26+
</script>
27+
28+
<button onclick={()=> item.count++}>{item.count}</button>
29+
<button onclick={()=> item_2.count++}>{item_2.count}</button>
30+
<button onclick={()=> item_3.count++}>{item_3.count}</button>
31+
<button onclick={()=> values[0].count++}>{values[0].count}</button>

0 commit comments

Comments
 (0)