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.
32 lines
582 B
32 lines
582 B
6 years ago
|
export default {
|
||
|
data: {
|
||
|
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.set({
|
||
|
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');
|
||
|
},
|
||
|
};
|