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-input-text-deep/_config.js

44 lines
694 B

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