mirror of https://github.com/sveltejs/svelte
FIX #2446: apply bindings and event handlers in order
parent
ec74b21c37
commit
41724067bf
@ -0,0 +1,37 @@
|
||||
export default {
|
||||
props: {
|
||||
value: ''
|
||||
},
|
||||
|
||||
html: `
|
||||
<input>
|
||||
<p></p>
|
||||
`,
|
||||
|
||||
ssrHtml: `
|
||||
<input>
|
||||
<p></p>
|
||||
`,
|
||||
|
||||
async test({ assert, component, target, window }) {
|
||||
const input = target.querySelector('input');
|
||||
|
||||
const event = new window.Event('input');
|
||||
input.value = 'h';
|
||||
await input.dispatchEvent(event);
|
||||
|
||||
assert.equal(input.value, 'H');
|
||||
assert.htmlEqual(target.innerHTML, `
|
||||
<input>
|
||||
<p>H</p>
|
||||
`);
|
||||
|
||||
input.value = 'he';
|
||||
await input.dispatchEvent(event);
|
||||
assert.equal(input.value, 'HE');
|
||||
assert.htmlEqual(target.innerHTML, `
|
||||
<input>
|
||||
<p>HE</p>
|
||||
`);
|
||||
},
|
||||
};
|
@ -0,0 +1,10 @@
|
||||
<script>
|
||||
export let value;
|
||||
|
||||
function uppercase(event) {
|
||||
event.target.value = event.target.value.toUpperCase()
|
||||
}
|
||||
</script>
|
||||
|
||||
<input on:input={uppercase} bind:value>
|
||||
<p>{value}</p>
|
Loading…
Reference in new issue