1
1
'use strict' ;
2
2
3
+ /* eslint-disable no-invalid-this */
4
+
3
5
/**
4
6
* Shared DSL statements that are useful to all scenarios.
5
7
*/
9
11
* pause() pauses until you call resume() in the console
10
12
*/
11
13
angular . scenario . dsl ( 'pause' , function ( ) {
12
- return /* @this */ function ( ) {
13
- return this . addFuture ( 'pausing for you to resume' , /* @this */ function ( done ) {
14
+ return function ( ) {
15
+ return this . addFuture ( 'pausing for you to resume' , function ( done ) {
14
16
this . emit ( 'InteractivePause' , this . spec , this . step ) ;
15
17
this . $window . resume = function ( ) { done ( ) ; } ;
16
18
} ) ;
@@ -22,8 +24,8 @@ angular.scenario.dsl('pause', function() {
22
24
* sleep(seconds) pauses the test for specified number of seconds
23
25
*/
24
26
angular . scenario . dsl ( 'sleep' , function ( ) {
25
- return /* @this */ function ( time ) {
26
- return this . addFuture ( 'sleep for ' + time + ' seconds' , /* @this */ function ( done ) {
27
+ return function ( time ) {
28
+ return this . addFuture ( 'sleep for ' + time + ' seconds' , function ( done ) {
27
29
this . $window . setTimeout ( function ( ) { done ( null , time * 1000 ) ; } , time * 1000 ) ;
28
30
} ) ;
29
31
} ;
@@ -48,7 +50,7 @@ angular.scenario.dsl('browser', function() {
48
50
49
51
chain . navigateTo = function ( url , delegate ) {
50
52
var application = this . application ;
51
- return this . addFuture ( "browser navigate to '" + url + "'" , /* @this */ function ( done ) {
53
+ return this . addFuture ( "browser navigate to '" + url + "'" , function ( done ) {
52
54
if ( delegate ) {
53
55
url = delegate . call ( this , url ) ;
54
56
}
@@ -148,7 +150,7 @@ angular.scenario.dsl('expect', function() {
148
150
return chain ;
149
151
} ;
150
152
151
- return /* @this */ function ( future ) {
153
+ return function ( future ) {
152
154
this . future = future ;
153
155
return chain ;
154
156
} ;
@@ -162,7 +164,7 @@ angular.scenario.dsl('expect', function() {
162
164
* using('#foo', "'Foo' text field").input('bar')
163
165
*/
164
166
angular . scenario . dsl ( 'using' , function ( ) {
165
- return /* @this */ function ( selector , label ) {
167
+ return function ( selector , label ) {
166
168
this . selector = _jQuery . trim ( ( this . selector || '' ) + ' ' + selector ) ;
167
169
if ( angular . isString ( label ) && label . length ) {
168
170
this . label = label + ' ( ' + this . selector + ' )' ;
@@ -178,7 +180,7 @@ angular.scenario.dsl('using', function() {
178
180
* binding(name) returns the value of the first matching binding
179
181
*/
180
182
angular . scenario . dsl ( 'binding' , function ( ) {
181
- return /* @this */ function ( name ) {
183
+ return function ( name ) {
182
184
return this . addFutureAction ( "select binding '" + name + "'" ,
183
185
function ( $window , $document , done ) {
184
186
var values = $document . elements ( ) . bindings ( $window . angular . element , name ) ;
@@ -203,7 +205,7 @@ angular.scenario.dsl('input', function() {
203
205
204
206
chain . enter = function ( value , event ) {
205
207
return this . addFutureAction ( "input '" + this . name + "' enter '" + value + "'" ,
206
- /* @this */ function ( $window , $document , done ) {
208
+ function ( $window , $document , done ) {
207
209
var input = $document . elements ( '[ng\\:model="$1"]' , this . name ) . filter ( ':input' ) ;
208
210
input . val ( value ) ;
209
211
input . trigger ( event || ( supportInputEvent ? 'input' : 'change' ) ) ;
@@ -213,7 +215,7 @@ angular.scenario.dsl('input', function() {
213
215
214
216
chain . check = function ( ) {
215
217
return this . addFutureAction ( "checkbox '" + this . name + "' toggle" ,
216
- /* @this */ function ( $window , $document , done ) {
218
+ function ( $window , $document , done ) {
217
219
var input = $document . elements ( '[ng\\:model="$1"]' , this . name ) . filter ( ':checkbox' ) ;
218
220
input . trigger ( 'click' ) ;
219
221
done ( ) ;
@@ -222,7 +224,7 @@ angular.scenario.dsl('input', function() {
222
224
223
225
chain . select = function ( value ) {
224
226
return this . addFutureAction ( "radio button '" + this . name + "' toggle '" + value + "'" ,
225
- /* @this */ function ( $window , $document , done ) {
227
+ function ( $window , $document , done ) {
226
228
var input = $document .
227
229
elements ( '[ng\\:model="$1"][value="$2"]' , this . name , value ) . filter ( ':radio' ) ;
228
230
input . trigger ( 'click' ) ;
@@ -231,13 +233,13 @@ angular.scenario.dsl('input', function() {
231
233
} ;
232
234
233
235
chain . val = function ( ) {
234
- return this . addFutureAction ( "return input val" , /* @this */ function ( $window , $document , done ) {
236
+ return this . addFutureAction ( "return input val" , function ( $window , $document , done ) {
235
237
var input = $document . elements ( '[ng\\:model="$1"]' , this . name ) . filter ( ':input' ) ;
236
238
done ( null , input . val ( ) ) ;
237
239
} ) ;
238
240
} ;
239
241
240
- return /* @this */ function ( name ) {
242
+ return function ( name ) {
241
243
this . name = name ;
242
244
return chain ;
243
245
} ;
@@ -283,7 +285,7 @@ angular.scenario.dsl('repeater', function() {
283
285
} ) ;
284
286
} ;
285
287
286
- return /* @this */ function ( selector , label ) {
288
+ return function ( selector , label ) {
287
289
this . dsl . using ( selector , label ) ;
288
290
return chain ;
289
291
} ;
@@ -299,13 +301,13 @@ angular.scenario.dsl('select', function() {
299
301
300
302
chain . option = function ( value ) {
301
303
return this . addFutureAction ( "select '" + this . name + "' option '" + value + "'" ,
302
- /* @this */ function ( $window , $document , done ) {
304
+ function ( $window , $document , done ) {
303
305
var select = $document . elements ( 'select[ng\\:model="$1"]' , this . name ) ;
304
306
var option = select . find ( 'option[value="' + value + '"]' ) ;
305
307
if ( option . length ) {
306
308
select . val ( value ) ;
307
309
} else {
308
- option = select . find ( 'option' ) . filter ( /* @this */ function ( ) {
310
+ option = select . find ( 'option' ) . filter ( function ( ) {
309
311
return _jQuery ( this ) . text ( ) === value ;
310
312
} ) ;
311
313
if ( ! option . length ) {
@@ -325,15 +327,15 @@ angular.scenario.dsl('select', function() {
325
327
chain . options = function ( ) {
326
328
var values = arguments ;
327
329
return this . addFutureAction ( "select '" + this . name + "' options '" + values + "'" ,
328
- /* @this */ function ( $window , $document , done ) {
330
+ function ( $window , $document , done ) {
329
331
var select = $document . elements ( 'select[multiple][ng\\:model="$1"]' , this . name ) ;
330
332
select . val ( values ) ;
331
333
select . trigger ( 'change' ) ;
332
334
done ( ) ;
333
335
} ) ;
334
336
} ;
335
337
336
- return /* @this */ function ( name ) {
338
+ return function ( name ) {
337
339
this . name = name ;
338
340
return chain ;
339
341
} ;
@@ -373,7 +375,7 @@ angular.scenario.dsl('element', function() {
373
375
374
376
chain . click = function ( ) {
375
377
return this . addFutureAction ( "element '" + this . label + "' click" ,
376
- /* @this */ function ( $window , $document , done ) {
378
+ function ( $window , $document , done ) {
377
379
var elements = $document . elements ( ) ;
378
380
var href = elements . attr ( 'href' ) ;
379
381
var eventProcessDefault = elements . trigger ( 'click' ) [ 0 ] ;
@@ -390,7 +392,7 @@ angular.scenario.dsl('element', function() {
390
392
391
393
chain . dblclick = function ( ) {
392
394
return this . addFutureAction ( "element '" + this . label + "' dblclick" ,
393
- /* @this */ function ( $window , $document , done ) {
395
+ function ( $window , $document , done ) {
394
396
var elements = $document . elements ( ) ;
395
397
var href = elements . attr ( 'href' ) ;
396
398
var eventProcessDefault = elements . trigger ( 'dblclick' ) [ 0 ] ;
@@ -434,7 +436,7 @@ angular.scenario.dsl('element', function() {
434
436
435
437
chain . query = function ( fn ) {
436
438
return this . addFutureAction ( 'element ' + this . label + ' custom query' ,
437
- /* @this */ function ( $window , $document , done ) {
439
+ function ( $window , $document , done ) {
438
440
fn . call ( this , $document . elements ( ) , done ) ;
439
441
} ) ;
440
442
} ;
@@ -468,7 +470,7 @@ angular.scenario.dsl('element', function() {
468
470
} ;
469
471
} ) ;
470
472
471
- return /* @this */ function ( selector , label ) {
473
+ return function ( selector , label ) {
472
474
this . dsl . using ( selector , label ) ;
473
475
return chain ;
474
476
} ;
0 commit comments