@@ -97,63 +97,108 @@ describe('finding elements', function() {
97
97
} ) ;
98
98
} ) ;
99
99
100
- it ( 'should find a repeater by partial match' , function ( ) {
101
- var fullMatch = ptor . findElement (
102
- protractor . By . repeater ( 'baz in days | filter:\'T\'' ) .
103
- row ( 1 ) . column ( '{{baz}}' ) ) ;
104
- expect ( fullMatch . getText ( ) ) . toEqual ( 'Tue' ) ;
105
-
106
- var partialMatch = ptor . findElement (
107
- protractor . By . repeater ( 'baz in days' ) . row ( 1 ) . column ( 'b' ) ) ;
108
- expect ( partialMatch . getText ( ) ) . toEqual ( 'Tue' ) ;
109
-
110
- var partialRowMatch = ptor . findElement (
111
- protractor . By . repeater ( 'baz in days' ) . row ( 1 ) ) ;
112
- expect ( partialRowMatch . getText ( ) ) . toEqual ( 'Tue' ) ;
113
- } ) ;
100
+ describe ( 'by repeater' , function ( ) {
101
+ it ( 'should find by partial match' , function ( ) {
102
+ var fullMatch = ptor . findElement (
103
+ protractor . By . repeater ( 'baz in days | filter:\'T\'' ) .
104
+ row ( 1 ) . column ( '{{baz}}' ) ) ;
105
+ expect ( fullMatch . getText ( ) ) . toEqual ( 'Tue' ) ;
106
+
107
+ var partialMatch = ptor . findElement (
108
+ protractor . By . repeater ( 'baz in days' ) . row ( 1 ) . column ( 'b' ) ) ;
109
+ expect ( partialMatch . getText ( ) ) . toEqual ( 'Tue' ) ;
110
+
111
+ var partialRowMatch = ptor . findElement (
112
+ protractor . By . repeater ( 'baz in days' ) . row ( 1 ) ) ;
113
+ expect ( partialRowMatch . getText ( ) ) . toEqual ( 'Tue' ) ;
114
+ } ) ;
114
115
115
- it ( 'should find a repeater using data-ng-repeat' , function ( ) {
116
- var byRow =
117
- ptor . findElement ( protractor . By . repeater ( 'day in days' ) . row ( 3 ) ) ;
118
- expect ( byRow . getText ( ) ) . toEqual ( 'Wed' ) ;
116
+ it ( 'should return all rows when unmodified' , function ( ) {
117
+ var all =
118
+ ptor . findElements ( protractor . By . repeater ( 'dayColor in dayColors' ) ) ;
119
+ all . then ( function ( arr ) {
120
+ expect ( arr . length ) . toEqual ( 3 ) ;
121
+ expect ( arr [ 0 ] . getText ( ) ) . toEqual ( 'Mon red' ) ;
122
+ expect ( arr [ 1 ] . getText ( ) ) . toEqual ( 'Tue green' ) ;
123
+ expect ( arr [ 2 ] . getText ( ) ) . toEqual ( 'Wed blue' ) ;
124
+ } ) ;
125
+ } ) ;
119
126
120
- var byCol =
121
- ptor . findElement ( protractor . By . repeater ( 'day in days' ) . row ( 3 ) .
122
- column ( 'day' ) ) ;
123
- expect ( byCol . getText ( ) ) . toEqual ( 'Wed' ) ;
124
- } ) ;
127
+ it ( 'should return a single column' , function ( ) {
128
+ var colors = ptor . findElements (
129
+ protractor . By . repeater ( 'dayColor in dayColors' ) . column ( 'color' ) ) ;
130
+ colors . then ( function ( arr ) {
131
+ expect ( arr . length ) . toEqual ( 3 ) ;
132
+ expect ( arr [ 0 ] . getText ( ) ) . toEqual ( 'red' ) ;
133
+ expect ( arr [ 1 ] . getText ( ) ) . toEqual ( 'green' ) ;
134
+ expect ( arr [ 2 ] . getText ( ) ) . toEqual ( 'blue' ) ;
135
+ } ) ;
136
+ } ) ;
125
137
126
- it ( 'should find a repeater using ng:repeat' , function ( ) {
127
- var byRow =
128
- ptor . findElement ( protractor . By . repeater ( 'bar in days' ) . row ( 3 ) ) ;
129
- expect ( byRow . getText ( ) ) . toEqual ( 'Wed' ) ;
138
+ it ( 'should return a single row' , function ( ) {
139
+ var secondRow = ptor . findElement (
140
+ protractor . By . repeater ( 'dayColor in dayColors' ) . row ( 2 ) ) ;
141
+ expect ( secondRow . getText ( ) ) . toEqual ( 'Tue green' ) ;
142
+ } ) ;
130
143
131
- var byCol =
132
- ptor . findElement ( protractor . By . repeater ( 'bar in days' ) . row ( 3 ) .
133
- column ( 'bar' ) ) ;
134
- expect ( byCol . getText ( ) ) . toEqual ( 'Wed' ) ;
135
- } ) ;
144
+ it ( 'should return an individual cell' , function ( ) {
145
+ var secondColor = ptor . findElement (
146
+ protractor . By . repeater ( 'dayColor in dayColors' ) .
147
+ row ( 2 ) .
148
+ column ( 'color' ) ) ;
136
149
137
- it ( 'should find a repeater using ng_repeat' , function ( ) {
138
- var byRow =
139
- ptor . findElement ( protractor . By . repeater ( 'foo in days' ) . row ( 3 ) ) ;
140
- expect ( byRow . getText ( ) ) . toEqual ( 'Wed' ) ;
150
+ var secondColorByColumnFirst = ptor . findElement (
151
+ protractor . By . repeater ( 'dayColor in dayColors' ) .
152
+ column ( 'color' ) .
153
+ row ( 2 ) ) ;
141
154
142
- var byCol =
143
- ptor . findElement ( protractor . By . repeater ( 'foo in days' ) . row ( 3 ) .
144
- column ( 'foo' ) ) ;
145
- expect ( byCol . getText ( ) ) . toEqual ( 'Wed' ) ;
146
- } ) ;
155
+ expect ( secondColor . getText ( ) ) . toEqual ( 'green' ) ;
156
+ expect ( secondColorByColumnFirst . getText ( ) ) . toEqual ( 'green' ) ;
157
+ } ) ;
147
158
148
- it ( 'should find a repeater using x -ng-repeat' , function ( ) {
149
- var byRow =
150
- ptor . findElement ( protractor . By . repeater ( 'qux in days' ) . row ( 3 ) ) ;
151
- expect ( byRow . getText ( ) ) . toEqual ( 'Wed' ) ;
159
+ it ( 'should find a using data -ng-repeat' , function ( ) {
160
+ var byRow =
161
+ ptor . findElement ( protractor . By . repeater ( 'day in days' ) . row ( 3 ) ) ;
162
+ expect ( byRow . getText ( ) ) . toEqual ( 'Wed' ) ;
152
163
153
- var byCol =
154
- ptor . findElement ( protractor . By . repeater ( 'qux in days' ) . row ( 3 ) .
155
- column ( 'qux' ) ) ;
156
- expect ( byCol . getText ( ) ) . toEqual ( 'Wed' ) ;
164
+ var byCol =
165
+ ptor . findElement ( protractor . By . repeater ( 'day in days' ) . row ( 3 ) .
166
+ column ( 'day' ) ) ;
167
+ expect ( byCol . getText ( ) ) . toEqual ( 'Wed' ) ;
168
+ } ) ;
169
+
170
+ it ( 'should find using ng:repeat' , function ( ) {
171
+ var byRow =
172
+ ptor . findElement ( protractor . By . repeater ( 'bar in days' ) . row ( 3 ) ) ;
173
+ expect ( byRow . getText ( ) ) . toEqual ( 'Wed' ) ;
174
+
175
+ var byCol =
176
+ ptor . findElement ( protractor . By . repeater ( 'bar in days' ) . row ( 3 ) .
177
+ column ( 'bar' ) ) ;
178
+ expect ( byCol . getText ( ) ) . toEqual ( 'Wed' ) ;
179
+ } ) ;
180
+
181
+ it ( 'should find using ng_repeat' , function ( ) {
182
+ var byRow =
183
+ ptor . findElement ( protractor . By . repeater ( 'foo in days' ) . row ( 3 ) ) ;
184
+ expect ( byRow . getText ( ) ) . toEqual ( 'Wed' ) ;
185
+
186
+ var byCol =
187
+ ptor . findElement ( protractor . By . repeater ( 'foo in days' ) . row ( 3 ) .
188
+ column ( 'foo' ) ) ;
189
+ expect ( byCol . getText ( ) ) . toEqual ( 'Wed' ) ;
190
+ } ) ;
191
+
192
+ it ( 'should find using x-ng-repeat' , function ( ) {
193
+ var byRow =
194
+ ptor . findElement ( protractor . By . repeater ( 'qux in days' ) . row ( 3 ) ) ;
195
+ expect ( byRow . getText ( ) ) . toEqual ( 'Wed' ) ;
196
+
197
+ var byCol =
198
+ ptor . findElement ( protractor . By . repeater ( 'qux in days' ) . row ( 3 ) .
199
+ column ( 'qux' ) ) ;
200
+ expect ( byCol . getText ( ) ) . toEqual ( 'Wed' ) ;
201
+ } ) ;
157
202
} ) ;
158
203
159
204
it ( 'should determine if an element is present' , function ( ) {
0 commit comments