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.
36 lines
623 B
36 lines
623 B
7 years ago
|
export default {
|
||
|
data: {
|
||
|
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.set({
|
||
|
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 );
|
||
|
|
||
|
component.destroy();
|
||
|
}
|
||
|
};
|