File tree Expand file tree Collapse file tree 2 files changed +83
-0
lines changed Expand file tree Collapse file tree 2 files changed +83
-0
lines changed Original file line number Diff line number Diff line change
1
+ <!DOCTYPE html>
2
+ < html lang ="en ">
3
+ < head >
4
+ < title > Nested repeat</ title >
5
+ < meta charset ="utf-8 ">
6
+ < script src ="../../../dist/seed.js "> </ script >
7
+ </ head >
8
+ < body >
9
+ < div id ="test ">
10
+ < ul >
11
+ < li sd-repeat ="item : items " sd-class ="'list-' + $index ">
12
+ < ul >
13
+ < li sd-repeat ="subitem : item.items " sd-class ="'list-' + $index ">
14
+ {{$parent.$index + '.' + $index + ' : ' + item.title + '< - ' + subitem.title}}
15
+ </ li >
16
+ </ ul >
17
+ </ li >
18
+ </ ul >
19
+ < button id ="b0 " sd-on ="click: items[0].title = 'hi' "> 1</ button >
20
+ < button id ="b1 " sd-on ="click: items[1].title = 'hi' "> 2</ button >
21
+ < button id ="b0-0 " sd-on ="click: items[0].items[0].title = 'hi' "> 1.1</ button >
22
+ < button id ="b0-1 " sd-on ="click: items[0].items[1].title = 'hi' "> 1.2</ button >
23
+ < button id ="b1-0 " sd-on ="click: items[1].items[0].title = 'hi' "> 2.1</ button >
24
+ < button id ="b1-1 " sd-on ="click: items[1].items[1].title = 'hi' "> 2.2</ button >
25
+ </ div >
26
+ < script >
27
+ var items = [
28
+ { title : 0 , items : [ { title :0 } , { title :1 } ] } ,
29
+ { title : 1 , items : [ { title :0 } , { title :1 } ] }
30
+ ]
31
+ new Seed ( {
32
+ el : '#test' ,
33
+ scope : {
34
+ items : items
35
+ }
36
+ } )
37
+ </ script >
38
+ </ body >
39
+ </ html>
Original file line number Diff line number Diff line change
1
+ casper . test . begin ( 'Nested Repeat' , 12 , function ( test ) {
2
+
3
+ casper
4
+ . start ( './fixtures/nested-repeat.html' , function ( ) {
5
+
6
+ var i , j
7
+
8
+ for ( i = 0 ; i < 2 ; i ++ ) {
9
+ for ( j = 0 ; j < 2 ; j ++ ) {
10
+ test . assertSelectorHasText (
11
+ '.list-' + i + ' .list-' + j ,
12
+ i + '.' + j + ' : ' + i + '<-' + j
13
+ )
14
+ }
15
+ }
16
+
17
+ this . click ( '#b0' )
18
+ this . click ( '#b1' )
19
+
20
+ for ( i = 0 ; i < 2 ; i ++ ) {
21
+ for ( j = 0 ; j < 2 ; j ++ ) {
22
+ test . assertSelectorHasText (
23
+ '.list-' + i + ' .list-' + j ,
24
+ i + '.' + j + ' : hi<-' + j
25
+ )
26
+ }
27
+ }
28
+
29
+ for ( i = 0 ; i < 2 ; i ++ ) {
30
+ for ( j = 0 ; j < 2 ; j ++ ) {
31
+ this . click ( '#b' + i + '-' + j )
32
+ test . assertSelectorHasText (
33
+ '.list-' + i + ' .list-' + j ,
34
+ i + '.' + j + ' : hi<-hi'
35
+ )
36
+ }
37
+ }
38
+
39
+ } )
40
+ . run ( function ( ) {
41
+ test . done ( )
42
+ } )
43
+
44
+ } )
You can’t perform that action at this time.
0 commit comments