Skip to content

Commit

Permalink
fix(5018): add tests to check if text is updated once
Browse files Browse the repository at this point in the history
  • Loading branch information
skippednote committed Jun 26, 2020
1 parent f50e7cf commit 06b3ba6
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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');
}
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<script>
let text = '';
const updater = (event) => {text = event.target.textContent}
</script>

<div contenteditable on:input={updater}>{text}</div>

0 comments on commit 06b3ba6

Please sign in to comment.