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-keyed-non-prop/_config.js

30 lines
572 B

export default {
props: {
words: ['foo', 'bar', 'baz']
},
html: `
<p>foo</p>
<p>bar</p>
<p>baz</p>
`,
test({ assert, component, target }) {
const [p1, p2, p3] = target.querySelectorAll('p');
component.words = ['foo', 'baz'];
assert.htmlEqual(target.innerHTML, `
<p>foo</p>
<p>baz</p>
`);
const [p4, p5] = target.querySelectorAll('p');
assert.ok(!target.contains(p2), '<p> element should be removed');
assert.equal(p1, p4, 'first <p> element should be retained');
assert.equal(p3, p5, 'last <p> element should be retained');
}
};