@@ -42,16 +42,41 @@ describe("DSL", function() {
42
42
43
43
var repeater = angular . scenario . dsl . repeater ;
44
44
45
- it ( 'should fetch the count of repeated elements ' , function ( ) {
45
+ it ( 'should count' , function ( ) {
46
46
var future = repeater ( '.repeater-row' ) . count ( ) ;
47
47
expect ( future . name ) . toEqual ( "repeater '.repeater-row' count" ) ;
48
- executeFuture ( future , "<div class='repeater-row'>a</div>" +
49
- "<div class='repeater-row'>b</div>" ,
50
- function ( value ) {
51
- future . fulfill ( value ) ;
48
+ executeFuture ( future ,
49
+ "<div class='repeater-row'>a</div>" +
50
+ "<div class='repeater-row'>b</div>" ,
51
+ function ( value ) {
52
+ future . fulfill ( value ) ;
52
53
} ) ;
53
54
expect ( future . fulfilled ) . toBeTruthy ( ) ;
54
55
expect ( future . value ) . toEqual ( 2 ) ;
55
56
} ) ;
57
+
58
+ it ( 'should collect' , function ( ) {
59
+ var future = repeater ( '.epic' ) . collect ( ) ;
60
+ expect ( future . name ) . toEqual ( "repeater '.epic' collect" ) ;
61
+ executeFuture ( future ,
62
+ "<table>" +
63
+ "<tr class='epic'>" +
64
+ "<td ng:bind='hero'>John Marston</td>" +
65
+ "<td ng:bind='game'>Red Dead Redemption</td>" +
66
+ "</tr>" +
67
+ "<tr class='epic'>" +
68
+ "<td ng:bind='hero'>Nathan Drake</td>" +
69
+ "<td ng:bind='game'>Uncharted 2</td>" +
70
+ "</tr>" +
71
+ "</table>" ,
72
+ function ( value ) {
73
+ future . fulfill ( value ) ;
74
+ } ) ;
75
+ expect ( future . fulfilled ) . toBeTruthy ( ) ;
76
+ expect ( future . value [ 0 ] . boundTo ( 'hero' ) ) . toEqual ( 'John Marston' ) ;
77
+ expect ( future . value [ 0 ] . boundTo ( 'game' ) ) . toEqual ( 'Red Dead Redemption' ) ;
78
+ expect ( future . value [ 1 ] . boundTo ( 'hero' ) ) . toEqual ( 'Nathan Drake' ) ;
79
+ expect ( future . value [ 1 ] . boundTo ( 'game' ) ) . toEqual ( 'Uncharted 2' ) ;
80
+ } ) ;
56
81
} ) ;
57
82
} ) ;
0 commit comments