mirror of https://github.com/sveltejs/svelte
parent
68263c8615
commit
88a8548aca
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"svelte": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix: ensure UI consistency between deferred events
|
||||||
@ -0,0 +1,12 @@
|
|||||||
|
import { flushSync } from 'svelte';
|
||||||
|
import { test } from '../../test';
|
||||||
|
|
||||||
|
export default test({
|
||||||
|
test({ assert, target, logs }) {
|
||||||
|
const [b1] = target.querySelectorAll('button');
|
||||||
|
b1.click();
|
||||||
|
flushSync();
|
||||||
|
|
||||||
|
assert.deepEqual(logs, ['http://localhost:3000/new%20url']);
|
||||||
|
}
|
||||||
|
});
|
||||||
@ -0,0 +1,12 @@
|
|||||||
|
<script>
|
||||||
|
let action = $state('old url');
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<form action={action} onsubmit={function(event) {
|
||||||
|
console.log(this.action);
|
||||||
|
event.preventDefault();
|
||||||
|
}}>
|
||||||
|
<button type="submit" onclick={() => {
|
||||||
|
action = 'new url';
|
||||||
|
}}>Submit</button>
|
||||||
|
</form>
|
||||||
@ -0,0 +1,13 @@
|
|||||||
|
import { flushSync } from 'svelte';
|
||||||
|
import { test } from '../../test';
|
||||||
|
|
||||||
|
export default test({
|
||||||
|
test({ assert, target, logs }) {
|
||||||
|
const [b1] = target.querySelectorAll('button');
|
||||||
|
b1.dispatchEvent(new MouseEvent('mouseup', { bubbles: true }));
|
||||||
|
b1.click();
|
||||||
|
flushSync();
|
||||||
|
|
||||||
|
assert.deepEqual(logs, []);
|
||||||
|
}
|
||||||
|
});
|
||||||
@ -0,0 +1,9 @@
|
|||||||
|
<script>
|
||||||
|
let disabled = $state(false);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<button disabled={disabled} onmouseup={() => {
|
||||||
|
disabled = true;
|
||||||
|
}} onclick={() => {
|
||||||
|
console.log('I should not be invoked');
|
||||||
|
}}>Click me!</button>
|
||||||
Loading…
Reference in new issue