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-details-open/_config.js

26 lines
650 B

export default {
html: `
<details><summary>toggle</summary></details>
`,
async test({ assert, component, target, window }) {
const details = target.querySelector('details');
const event = new window.Event('toggle');
details.open = true;
await details.dispatchEvent(event);
assert.equal(component.open, true);
assert.htmlEqual(target.innerHTML, `
<details open><summary>toggle</summary></details>
<p>hello!</p>
`);
details.open = false;
await details.dispatchEvent(event);
assert.equal(component.open, false);
assert.htmlEqual(target.innerHTML, `
<details open=""><summary>toggle</summary></details>
`);
}
};