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-textarea/_config.js

38 lines
698 B

export default {
props: {
value: 'some text'
},
html: `
<textarea></textarea>
<p>some text</p>
`,
ssrHtml: `
<textarea>some text</textarea>
<p>some text</p>
`,
async test({ assert, component, target, window }) {
const textarea = target.querySelector('textarea');
assert.equal(textarea.value, 'some text');
const event = new window.Event('input');
textarea.value = 'hello';
await textarea.dispatchEvent(event);
assert.htmlEqual(target.innerHTML, `
<textarea></textarea>
<p>hello</p>
`);
component.value = 'goodbye';
assert.equal(textarea.value, 'goodbye');
assert.htmlEqual(target.innerHTML, `
<textarea></textarea>
<p>goodbye</p>
`);
}
};