btford/ngmin

Detection of chained call fails if one of the chained calls does not need to be annotated

Closed this issue · 4 comments

If I have:

    angular.module('myMod')
    .config(['dep1', function(dep1) {}])
    .run(function(dep2) {});

Then the run() call will not get annotated. This happens because astral-angular-annotate requires the argument of config() to be a function (and not an ArrayExpression) in signatures/simple.js

Here is a failing unit test to demonstrate this:

it('should annotate multiple chained declarations', function() {
   var annotated = annotate(function () {
    angular.module('myMod')
    .config(['dep1', function(dep1) {}])
    .run(function(dep2) {});
  });

annotated.should.equal(stringifyFunctionBody(function () {
    angular.module('myMod')
    .config(['dep1', function(dep1) {}])
    .run(['dep2', function(dep2) {}]);
}));
});

Is this the same as #50?

Yes. Closing this in favor of #50. @thesamet please check for duplicates next time. Thanks!

Oops! I did - and missed it somehow, sorry.

@thesamet no worries, it happens. :)