Jasmine tests AngularJS Directives with templateUrl

前端 未结 8 724
执笔经年
执笔经年 2020-12-07 12:54

I\'m writing directive tests for AngularJS with Jasmine, and using templateUrl with them: https://gist.github.com/tanepiper/62bd10125e8408def5cc

However, when I run

8条回答
  •  长情又很酷
    2020-12-07 13:41

    the Karma way is to load the template html dynamically into $templateCache. you could just use html2js karma pre-processor, as explained here

    this boils down to adding templates '.html' to your files in the conf.js file as well preprocessors = { '.html': 'html2js' };

    and use

    beforeEach(module('..'));
    
    beforeEach(module('...html', '...html'));
    

    into your js testing file

提交回复
热议问题