File tree 2 files changed +10
-1
lines changed
2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change 62
62
* Implicit module which gets automatically added to each {@link auto.$injector $injector}.
63
63
*/
64
64
65
- var FN_ARGS = / ^ f u n c t i o n \s * [ ^ \( ] * \( \s * ( [ ^ \) ] * ) \) / m;
65
+ var FN_ARGS = / ^ [ ^ \( ] * \( \s * ( [ ^ \) ] * ) \) / m;
66
66
var FN_ARG_SPLIT = / , / ;
67
67
var FN_ARG = / ^ \s * ( _ ? ) ( \S + ?) \1\s * $ / ;
68
68
var STRIP_COMMENTS = / ( ( \/ \/ .* $ ) | ( \/ \* [ \s \S ] * ?\* \/ ) ) / mg;
Original file line number Diff line number Diff line change @@ -243,6 +243,15 @@ describe('injector', function() {
243
243
} ) ;
244
244
245
245
246
+ // Only Chrome and Firefox support this syntax.
247
+ if ( / c h r o m e | f i r e f o x / i. test ( navigator . userAgent ) ) {
248
+ it ( 'should be possible to annotate functions that are declared using ES6 syntax' , function ( ) {
249
+ // The function is generated using `eval` as just having the ES6 syntax can break some browsers.
250
+ expect ( annotate ( eval ( '({ fn(x) { return; } })' ) . fn ) ) . toEqual ( [ 'x' ] ) ;
251
+ } ) ;
252
+ }
253
+
254
+
246
255
it ( 'should publish annotate API' , function ( ) {
247
256
expect ( angular . mock . $$annotate ) . toBe ( annotate ) ;
248
257
spyOn ( angular . mock , '$$annotate' ) . andCallThrough ( ) ;
You can’t perform that action at this time.
0 commit comments