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/hydration/samples/binding-input/_config.js

30 lines
599 B

export default {
props: {
name: 'world'
},
snapshot(target) {
return {
input: target.querySelector('input'),
p: target.querySelector('p')
};
},
async test(assert, target, snapshot, component, window) {
const input = target.querySelector('input');
const p = target.querySelector('p');
assert.equal(input, snapshot.input);
assert.equal(p, snapshot.p);
input.value = 'everybody';
await input.dispatchEvent(new window.Event('input'));
assert.equal(component.name, 'everybody');
assert.htmlEqual(target.innerHTML, `
<input>
<p>Hello everybody!</p>
`);
}
};