File tree 2 files changed +31
-0
lines changed
test/generator/each-block-keyed 2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change
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
+ } ;
Original file line number Diff line number Diff line change
1
+ {{#each todos as todo @id}}
2
+ < p > {{todo.description}}</ p >
3
+ {{/each}}
You can’t perform that action at this time.
0 commit comments