angularjs - Jasmine Testing angular directive with [^form] dependency -


i trying test directive, explained e.g. here http://angular-tips.com/blog/2014/06/introduction-to-unit-test-directives/.

however, in directive use form, have in directive declaration object:

        return {             link: link,             restrict: 'e',             require: ['^form'], // <- have !!             scope: { //...             },             controller: function ($scope) {             //...             }         }; 

as such, when execute usual prerequisite jasmine test

element = '<mydirective/>'; element = $compile(element)(scope); 

i getting following dependency problem when trying run karma / jasmine test:

error: [$compile:ctreq] controller 'form', required directive 'mydirective', can't found! http://errors.angularjs.org/1.4.2/$compile/ctreq?p0=form&p1=mydirective

how can fixed?

use

'<form><mydirective></mydirective></form>' 

, , use element.find('mydirective') find actual directive element.


Comments

Popular posts from this blog

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -

javascript - Restarting Supervisor and effect on FlaskSocketIO -

php - Mongodb connectivity error -