@@ -43,7 +43,7 @@ angular.scenario.dsl('browser', function() {
43
43
44
44
chain . navigateTo = function ( url , delegate ) {
45
45
var application = this . application ;
46
- return this . addFuture ( ' browser navigate to ' + url , function ( done ) {
46
+ return this . addFuture ( " browser navigate to '" + url + "'" , function ( done ) {
47
47
if ( delegate ) {
48
48
url = delegate . call ( this , url ) ;
49
49
}
@@ -140,9 +140,9 @@ angular.scenario.dsl('expect', function() {
140
140
*/
141
141
angular . scenario . dsl ( 'using' , function ( ) {
142
142
return function ( selector , label ) {
143
- this . selector = ( this . selector || '' ) + ' ' + selector ;
143
+ this . selector = _jQuery . trim ( ( this . selector || '' ) + ' ' + selector ) ;
144
144
if ( angular . isString ( label ) && label . length ) {
145
- this . label = label + ' (' + this . selector + ' )' ;
145
+ this . label = label + ' ( ' + this . selector + ' )' ;
146
146
} else {
147
147
this . label = this . selector ;
148
148
}
@@ -169,7 +169,7 @@ angular.scenario.dsl('binding', function() {
169
169
return ;
170
170
}
171
171
}
172
- done ( ' Binding selector ' + name + ' did not match.' ) ;
172
+ done ( " Binding selector '" + name + " ' did not match." ) ;
173
173
} ) ;
174
174
} ;
175
175
} ) ;
@@ -225,7 +225,7 @@ angular.scenario.dsl('repeater', function() {
225
225
var chain = { } ;
226
226
227
227
chain . count = function ( ) {
228
- return this . addFutureAction ( ' repeater ' + this . label + ' count' , function ( $window , $document , done ) {
228
+ return this . addFutureAction ( " repeater '" + this . label + " ' count" , function ( $window , $document , done ) {
229
229
try {
230
230
done ( null , $document . elements ( ) . length ) ;
231
231
} catch ( e ) {
@@ -235,7 +235,7 @@ angular.scenario.dsl('repeater', function() {
235
235
} ;
236
236
237
237
chain . column = function ( binding ) {
238
- return this . addFutureAction ( ' repeater ' + this . label + ' column ' + binding , function ( $window , $document , done ) {
238
+ return this . addFutureAction ( " repeater '" + this . label + " ' column '" + binding + "'" , function ( $window , $document , done ) {
239
239
var values = [ ] ;
240
240
$document . elements ( ) . each ( function ( ) {
241
241
_jQuery ( this ) . find ( ':visible' ) . each ( function ( ) {
@@ -250,14 +250,14 @@ angular.scenario.dsl('repeater', function() {
250
250
} ;
251
251
252
252
chain . row = function ( index ) {
253
- return this . addFutureAction ( ' repeater ' + this . label + ' row ' + index , function ( $window , $document , done ) {
253
+ return this . addFutureAction ( " repeater '" + this . label + " ' row '" + index + "'" , function ( $window , $document , done ) {
254
254
var values = [ ] ;
255
255
var matches = $document . elements ( ) . slice ( index , index + 1 ) ;
256
256
if ( ! matches . length )
257
257
return done ( 'row ' + index + ' out of bounds' ) ;
258
258
_jQuery ( matches [ 0 ] ) . find ( ':visible' ) . each ( function ( ) {
259
259
var element = _jQuery ( this ) ;
260
- if ( element . attr ( 'ng:bind' ) ) {
260
+ if ( angular . isDefined ( element . attr ( 'ng:bind' ) ) ) {
261
261
values . push ( element . text ( ) ) ;
262
262
}
263
263
} ) ;
@@ -280,7 +280,7 @@ angular.scenario.dsl('select', function() {
280
280
var chain = { } ;
281
281
282
282
chain . option = function ( value ) {
283
- return this . addFutureAction ( ' select ' + this . name + ' option ' + value , function ( $window , $document , done ) {
283
+ return this . addFutureAction ( " select '" + this . name + " ' option '" + value + "'" , function ( $window , $document , done ) {
284
284
var select = $document . elements ( 'select[name="$1"]' , this . name ) ;
285
285
select . val ( value ) ;
286
286
select . trigger ( 'change' ) ;
@@ -290,7 +290,7 @@ angular.scenario.dsl('select', function() {
290
290
291
291
chain . options = function ( ) {
292
292
var values = arguments ;
293
- return this . addFutureAction ( ' select ' + this . name + ' options ' + values , function ( $window , $document , done ) {
293
+ return this . addFutureAction ( " select '" + this . name + " ' options '" + values + "'" , function ( $window , $document , done ) {
294
294
var select = $document . elements ( 'select[multiple][name="$1"]' , this . name ) ;
295
295
select . val ( values ) ;
296
296
select . trigger ( 'change' ) ;
@@ -322,7 +322,7 @@ angular.scenario.dsl('element', function() {
322
322
var chain = { } ;
323
323
324
324
chain . count = function ( ) {
325
- return this . addFutureAction ( ' element ' + this . label + ' count' , function ( $window , $document , done ) {
325
+ return this . addFutureAction ( " element '" + this . label + " ' count" , function ( $window , $document , done ) {
326
326
try {
327
327
done ( null , $document . elements ( ) . length ) ;
328
328
} catch ( e ) {
@@ -332,7 +332,7 @@ angular.scenario.dsl('element', function() {
332
332
} ;
333
333
334
334
chain . click = function ( ) {
335
- return this . addFutureAction ( ' element ' + this . label + ' click' , function ( $window , $document , done ) {
335
+ return this . addFutureAction ( " element '" + this . label + " ' click" , function ( $window , $document , done ) {
336
336
var elements = $document . elements ( ) ;
337
337
var href = elements . attr ( 'href' ) ;
338
338
elements . trigger ( 'click' ) ;
@@ -347,9 +347,9 @@ angular.scenario.dsl('element', function() {
347
347
} ;
348
348
349
349
chain . attr = function ( name , value ) {
350
- var futureName = ' element ' + this . label + ' get attribute ' + name ;
351
- if ( value ) {
352
- futureName = ' element ' + this . label + ' set attribute ' + name + ' to ' + value ;
350
+ var futureName = " element '" + this . label + " ' get attribute '" + name + "'" ;
351
+ if ( angular . isDefined ( value ) ) {
352
+ futureName = " element '" + this . label + " ' set attribute '" + name + " ' to " + "'" + value + "'" ;
353
353
}
354
354
return this . addFutureAction ( futureName , function ( $window , $document , done ) {
355
355
done ( null , $document . elements ( ) . attr ( name , value ) ) ;
@@ -364,9 +364,9 @@ angular.scenario.dsl('element', function() {
364
364
365
365
angular . foreach ( VALUE_METHODS , function ( methodName ) {
366
366
chain [ methodName ] = function ( value ) {
367
- var futureName = ' element ' + this . label + ' ' + methodName ;
368
- if ( value ) {
369
- futureName = ' element ' + this . label + ' set ' + methodName + ' to ' + value ;
367
+ var futureName = " element '" + this . label + "' " + methodName ;
368
+ if ( angular . isDefined ( value ) ) {
369
+ futureName = " element '" + this . label + " ' set " + methodName + " to '" + value + "'" ;
370
370
}
371
371
return this . addFutureAction ( futureName , function ( $window , $document , done ) {
372
372
var element = $document . elements ( ) ;
0 commit comments