mirror of https://github.com/sveltejs/svelte
chore: add test for binding event reactive context (#14522)
* chore: add test for binding event reactive context * revisedpull/14528/head
parent
3d36e15ddd
commit
94694a5e63
@ -0,0 +1,7 @@
|
||||
import { test } from '../../test';
|
||||
|
||||
export default test({
|
||||
test({ assert, logs }) {
|
||||
assert.deepEqual(logs, [false]);
|
||||
}
|
||||
});
|
@ -0,0 +1,24 @@
|
||||
<script>
|
||||
let bar = $state('');
|
||||
|
||||
const foo = {
|
||||
set bar(v) {
|
||||
|
||||
console.log($effect.tracking());
|
||||
|
||||
bar = v;
|
||||
},
|
||||
get bar() {
|
||||
return bar;
|
||||
}
|
||||
}
|
||||
|
||||
let input;
|
||||
|
||||
$effect(() => {
|
||||
input.value = 'everybody';
|
||||
input.dispatchEvent(new window.Event('input'));
|
||||
})
|
||||
</script>
|
||||
|
||||
<input type="text" bind:value={foo.bar} bind:this={input}>
|
Loading…
Reference in new issue