Wednesday, 15 June 2011

javascript - How do I test an Angular directive that requires another controller in Angular 1.3.14? -


I am trying to write a Jasmine test for an instruction that requires parental instructions to be present . I got this question: However, it's a bit late (Carl 1.1.5 I believe), and Plunker does not work with new versions of Jasmine (2.2.1) and Connor (1.3.14). I get:

  Type error: There is no function on undefined object. & Lt; Anonymous & gt; (Http://run.plnkr.co/AHQtPtvSezB4DsnJ/appSpec.js:18:33)  

Here is the code: var app = angular. Module ('plunker', []); {F}, app directive ('foo', function () {returns} {restriction: 'e', ​​controller: function ($ scope) {this.add = function (x, y) {return x + y;}} };}); (Scope.callFoo = function (x, y)) (scope.callFoo = function (), (), {Scope.sum = foo.add (x, y);}}};});

and test:

  Description ('test instructions', work () {var $ scope, $ compilation, element; {Module ('plunker'); injection (function ($ rootscope, _ $ compile_) {$ scope = $ rootScope. $ New (); $ compile = _ $ compile_;});}); ('Callfoo Var $ fooController = Whatever is considered for the element, this function () [// Set  

Thank you with this time!

In answer to this question mentioned above, method # 3 did great work, I apparently did not have much Read


No comments:

Post a Comment