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

37 lines
606 B

export default {
get props() {
return {
todos: [
{ id: 123, description: 'buy milk' },
{ id: 234, description: 'drink milk' }
]
};
},
html: `
<p>buy milk</p>
<p>drink milk</p>
`,
test({ assert, component, target }) {
const [p1, p2] = target.querySelectorAll('p');
component.todos = [
{ id: 123, description: 'buy beer' },
{ id: 234, description: 'drink beer' }
];
assert.htmlEqual(
target.innerHTML,
`
<p>buy beer</p>
<p>drink beer</p>
`
);
const [p3, p4] = target.querySelectorAll('p');
assert.equal(p1, p3);
assert.equal(p2, p4);
}
};