fix(5018): add tests to check if text is updated once

pull/5028/head
Bassam Ismail 5 years ago
parent f50e7cf2e5
commit 06b3ba65cb

@ -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…
Cancel
Save