Skip to content

Commit 0d89f64

Browse files
committed
failing test for #81
1 parent 8340583 commit 0d89f64

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
export default {
2+
data: {
3+
todos: [
4+
{ id: 123, description: 'implement keyed each blocks' },
5+
{ id: 234, description: 'implement client-side hydration' }
6+
]
7+
},
8+
9+
html: '<p>implement keyed each blocks</p><p>implement client-side hydration</p>',
10+
11+
test ( assert, component, target ) {
12+
const [ p1, p2 ] = target.querySelectorAll( 'p' );
13+
14+
component.set({
15+
todos: [
16+
{ id: 234, description: 'implement client-side hydration' }
17+
]
18+
});
19+
assert.htmlEqual( target.innerHTML, '<p>implement client-side hydration</p>' );
20+
21+
const [ p3 ] = target.querySelectorAll( 'p' );
22+
23+
assert.ok( !target.contains( p1 ), 'first <p> element should be removed' );
24+
assert.equal( p2, p3, 'second <p> element should be retained' );
25+
26+
component.teardown();
27+
}
28+
};
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{{#each todos as todo @id}}
2+
<p>{{todo.description}}</p>
3+
{{/each}}

0 commit comments

Comments
 (0)