mirror of https://github.com/sveltejs/svelte
fix(5018): compare wholeText instead of data (#5028)
parent
62345432ac
commit
ce3d0461e9
@ -0,0 +1,15 @@
|
||||
export default {
|
||||
html: `
|
||||
<div contenteditable=""></div>
|
||||
`,
|
||||
|
||||
async test({ assert, component, target, window }) {
|
||||
const div = target.querySelector('div');
|
||||
const text = window.document.createTextNode('a');
|
||||
div.insertBefore(text, null);
|
||||
const event = new window.InputEvent('input');
|
||||
await div.dispatchEvent(event);
|
||||
|
||||
assert.equal(div.textContent, 'a');
|
||||
}
|
||||
};
|
@ -0,0 +1,6 @@
|
||||
<script>
|
||||
let text = '';
|
||||
const updater = (event) => {text = event.target.textContent}
|
||||
</script>
|
||||
|
||||
<div contenteditable on:input={updater}>{text}</div>
|
Loading…
Reference in new issue