mirror of https://github.com/sveltejs/svelte
fix: handle event hoisting props referencing (#9846)
* fix: handle event hoisting props referencingpull/9848/head
parent
fd78acfec9
commit
4717d2ad23
@ -0,0 +1,5 @@
|
||||
---
|
||||
'svelte': patch
|
||||
---
|
||||
|
||||
fix: handle event hoisting props referencing
|
@ -0,0 +1,21 @@
|
||||
import { test } from '../../test';
|
||||
import { log } from './log.js';
|
||||
|
||||
export default test({
|
||||
before_test() {
|
||||
log.length = 0;
|
||||
},
|
||||
|
||||
get props() {
|
||||
return { item: { name: 'Dominic' } };
|
||||
},
|
||||
|
||||
async test({ assert, target }) {
|
||||
const [b1] = target.querySelectorAll('button');
|
||||
|
||||
b1?.click();
|
||||
await Promise.resolve();
|
||||
|
||||
assert.deepEqual(log, ['Dominic']);
|
||||
}
|
||||
});
|
@ -0,0 +1,2 @@
|
||||
/** @type {any[]} */
|
||||
export const log = [];
|
@ -0,0 +1,13 @@
|
||||
<script>
|
||||
import { log } from './log.js';
|
||||
|
||||
let { item } = $props();
|
||||
|
||||
function onclick() {
|
||||
log.push(item?.name);
|
||||
}
|
||||
</script>
|
||||
|
||||
<button {onclick}>
|
||||
{item?.name}
|
||||
</button>
|
Loading…
Reference in new issue