File tree 2 files changed +89
-9
lines changed
2 files changed +89
-9
lines changed Original file line number Diff line number Diff line change @@ -124,15 +124,17 @@ function getAnnotation(node){
124
124
}
125
125
126
126
for ( var i = 0 ; i < node . leadingComments . length ; i ++ ) {
127
- let value = node . leadingComments [ i ] . value
128
- . replace ( / ^ [ \s \* ] * / , '' )
129
- . replace ( / [ \s \* ] * $ / , '' )
130
- . trim ( ) ;
131
-
132
- if ( value === "@ngInject" ) {
133
- return true ;
134
- } else if ( value === "@ngNoInject" ) {
135
- return false ;
127
+ for ( const line of node . leadingComments [ i ] . value . split ( "\n" ) ) {
128
+ let value = line
129
+ . replace ( / ^ [ \s \* ] * / , '' )
130
+ . replace ( / [ \s \* ] * $ / , '' )
131
+ . trim ( ) ;
132
+
133
+ if ( value === "@ngInject" ) {
134
+ return true ;
135
+ } else if ( value === "@ngNoInject" ) {
136
+ return false ;
137
+ }
136
138
}
137
139
}
138
140
Original file line number Diff line number Diff line change @@ -221,6 +221,84 @@ module.exports = {
221
221
controller : [ 'a' , function ( a ) { } ]
222
222
} ) ;
223
223
}
224
+ } , {
225
+ name : "JSDoc/NGDoc format with annotated class" ,
226
+ explicit : true ,
227
+ noES5 : false ,
228
+ input : `
229
+ /**
230
+ * @some
231
+ * @other
232
+ * @annotations
233
+ *
234
+ * @description
235
+ * Example
236
+ *
237
+ * @ngInject
238
+ */
239
+ var Cls = function(dep1) {
240
+ this.dep1 = dep1;
241
+ };
242
+ angular.module('MyMod').service('MySvc', svc);
243
+ ` ,
244
+ expected : `
245
+ /**
246
+ * @some
247
+ * @other
248
+ * @annotations
249
+ *
250
+ * @description
251
+ * Example
252
+ *
253
+ * @ngInject
254
+ */
255
+ var Cls = function(dep1) {
256
+ this.dep1 = dep1;
257
+ };
258
+ Cls.$inject = ['dep1'];
259
+ angular.module('MyMod').service('MySvc', svc);
260
+ ` ,
261
+ } , {
262
+ name : "JSDoc/NGDoc format with annotated class" ,
263
+ explicit : true ,
264
+ noES5 : true ,
265
+ input : `
266
+ /**
267
+ * @some
268
+ * @other
269
+ * @annotations
270
+ *
271
+ * @description
272
+ * Example
273
+ *
274
+ * @ngInject
275
+ */
276
+ class svc {
277
+ constructor (dep1) {
278
+ this.dep1 = dep1;
279
+ }
280
+ }
281
+ angular.module('MyMod').service('MySvc', svc);
282
+ ` ,
283
+ expected : `
284
+ /**
285
+ * @some
286
+ * @other
287
+ * @annotations
288
+ *
289
+ * @description
290
+ * Example
291
+ *
292
+ * @ngInject
293
+ */
294
+ class svc {
295
+ constructor (dep1) {
296
+ this.dep1 = dep1;
297
+ }
298
+ }
299
+ svc.$inject = ['dep1'];
300
+ angular.module('MyMod').service('MySvc', svc);
301
+ ` ,
224
302
}
225
303
]
226
304
} ;
You can’t perform that action at this time.
0 commit comments