You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
svelte/test/runtime/samples/binding-contenteditable-inn.../_config.js

26 lines
616 B

export default {
props: {
name: 'world'
},
ssrHtml: `
<editor contenteditable="true">world</editor>
<p>hello world</p>
`,
async test({ assert, component, target, window }) {
// JSDom doesn't support innerText yet, so the test is not ideal
// https://github.com/jsdom/jsdom/issues/1245
const el = target.querySelector('editor');
assert.equal(el.innerText, 'world');
const event = new window.Event('input');
el.innerText = 'everybody';
await el.dispatchEvent(event);
assert.equal(component.name, 'everybody');
component.name = 'goodbye';
assert.equal(el.innerText, 'goodbye');
}
};