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/each-block-scope-shadow-bind-4/_config.js

65 lines
1.0 KiB

export default {
html: `
<div>
b: Hello
<input />
</div>
<button>Button</button>
`,
ssrHtml: `
<div>
b: Hello
<input value="Hello" />
</div>
<button>Button</button>
`,
async test({ assert, target, window }) {
const input = target.querySelector('input');
const button = target.querySelector('button');
input.value = 'Awesome';
await input.dispatchEvent(new window.Event('input'));
assert.htmlEqual(
target.innerHTML,
`
<div>
b: Awesome
<input />
</div>
<button>Button</button>
`
);
await button.dispatchEvent(new window.MouseEvent('click'));
assert.htmlEqual(
target.innerHTML,
`
<div>
c: World
<input />
</div>
<button>Button</button>
`
);
assert.equal(input.value, 'World');
input.value = 'Svelte';
await input.dispatchEvent(new window.Event('input'));
assert.htmlEqual(
target.innerHTML,
`
<div>
c: Svelte
<input />
</div>
<button>Button</button>
`
);
}
};