mirror of https://github.com/sveltejs/svelte
fix: improve compiled output of multiple call expression in single text node (#11097)
* fix: improve compiled output of multiple call expression in single text node * fixpull/11093/head
parent
22494be9ec
commit
3462c54fd2
@ -0,0 +1,5 @@
|
||||
---
|
||||
"svelte": patch
|
||||
---
|
||||
|
||||
fix: improve compiled output of multiple call expression in single text node
|
@ -0,0 +1,23 @@
|
||||
import { flushSync } from 'svelte';
|
||||
import { test } from '../../test';
|
||||
import { log } from './log.js';
|
||||
|
||||
export default test({
|
||||
before_test() {
|
||||
log.length = 0;
|
||||
},
|
||||
|
||||
async test({ assert, target }) {
|
||||
const [b1, b2] = target.querySelectorAll('button');
|
||||
|
||||
flushSync(() => {
|
||||
b1.click();
|
||||
});
|
||||
|
||||
flushSync(() => {
|
||||
b2.click();
|
||||
});
|
||||
|
||||
assert.deepEqual(log, ['x', 'y', 'x', 'y']);
|
||||
}
|
||||
});
|
@ -0,0 +1,2 @@
|
||||
/** @type {any[]} */
|
||||
export const log = [];
|
@ -0,0 +1,21 @@
|
||||
<script>
|
||||
import { log } from './log.js';
|
||||
|
||||
let x = $state(0);
|
||||
let y = $state(0);
|
||||
|
||||
function getX() {
|
||||
log.push('x')
|
||||
return x;
|
||||
}
|
||||
|
||||
function getY() {
|
||||
log.push('y')
|
||||
return y;
|
||||
}
|
||||
</script>
|
||||
|
||||
<button on:click={() => x++}>{x}</button>
|
||||
<button on:click={() => y++}>{y}</button>
|
||||
|
||||
{getX()}|{getY()}
|
Loading…
Reference in new issue