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

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -