AngularJS directive testing -


i trying test following directive.

angular.module('mymodule.directives', [])   .directive('test', function() {     return {       restrictions: 'e',       scope: {},       transclude: true,       replace: true,       template: '<div><ui><li>a</li></ul></div>'     } }); 

in test:

describe('directives', function () {     var compile,     scope,     test;      beforeeach(module('mymodule.directives'));     beforeeach(inject(function ($compile, $rootscope) {      compile = $compile;     scope = $rootscope;     test = angular.element('<test></test>');     compile(test)(scope);     scope.$digest();      it('should render test directive', function () {         var lis = test.find('li');         console.log(lis.length); // should output 1     });  }));   

test fails , outputs 0. curious whether compile doing anything. if replace test

  test = angular.element("<test><li></li></test>");.  

then 'find' find li within test element, goes show compile not rendering

  '<div><ui><li>a</li></ul></div>'  

as should. ideas? looked @ following vid guidance (http://www.youtube.com/watch?v=rb5b67cg6bc).

you need change "restrictions" "restrict"


Comments

Popular posts from this blog

node.js - Bad Request - node js ajax post -

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -