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

33 lines
637 B

export default {
data: {
value: 'some text'
},
html: `
<textarea></textarea>
<p>some text</p>
`,
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';
textarea.dispatchEvent( event );
assert.htmlEqual( target.innerHTML, `
<textarea></textarea>
<p>hello</p>
` );
component.set({ value: 'goodbye' });
assert.equal( textarea.value, 'goodbye' );
assert.htmlEqual( target.innerHTML, `
<textarea></textarea>
<p>goodbye</p>
` );
}
};