Ng-mock: $compileProvider doesn't have method

2019-07-06 13:56发布

问题:

I've been rewriting directives in Angular 1.5.8 to components. I want to write unit tests with '$componentController` just like described here: https://docs.angularjs.org/guide/component.

The problem is that I'm getting error at this line:

var ctrl = $componentController('componentName', null, bindings);

saying: undefined is not a constructor (evaluating 'compileProvider.preAssignBindingsEnabled()') app/lib/angular-mocks/angular-mocks.js:2235:80

So it looks like $compileProvider doesn't have preAssignBindingsEnabled method at all. If anyone has an idea of what possibly I'm doing wrong I'd appreciate a little help.

Thanks!

UPDATE: jsFiddle of unit test: https://jsfiddle.net/kveb1ovo/2/