mirror of https://github.com/sveltejs/svelte
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.
37 lines
736 B
37 lines
736 B
6 years ago
|
export default {
|
||
|
props: {
|
||
|
foo: 'a',
|
||
|
items: ['x'],
|
||
|
},
|
||
|
|
||
|
html: `
|
||
|
<div><input><p>a</p></div>
|
||
|
<div><input><p>x</p></div>
|
||
|
`,
|
||
|
|
||
|
ssrHtml: `
|
||
|
<div><input value=a><p>a</p></div>
|
||
|
<div><input value=x><p>x</p></div>
|
||
|
`,
|
||
|
|
||
|
async test({ assert, component, target, window }) {
|
||
|
const inputs = [...target.querySelectorAll('input')];
|
||
|
const event = new window.Event('input');
|
||
|
|
||
|
assert.equal(inputs[0].value, 'a');
|
||
|
|
||
|
inputs[0].value = 'b';
|
||
|
inputs[1].value = 'y';
|
||
|
await inputs[0].dispatchEvent(event);
|
||
|
await inputs[1].dispatchEvent(event);
|
||
|
|
||
|
assert.equal(component.foo, 'b');
|
||
|
assert.equal(component.items[0], 'y');
|
||
|
|
||
|
assert.htmlEqual(target.innerHTML, `
|
||
|
<div><input><p>b</p></div>
|
||
|
<div><input><p>y</p></div>
|
||
|
`);
|
||
|
},
|
||
|
};
|