How do you mock directives to enable unit testing of higher level directive?

前端 未结 7 1833
故里飘歌
故里飘歌 2020-12-04 09:05

In our app we have several layers of nested directives. I\'m trying to write some unit tests for the top level directives. I\'ve mocked in stuff that the directive itself ne

7条回答
  •  一生所求
    2020-12-04 09:31

    You can modify your templates inside $templateCache to remove any lower level directives:

    beforeEach(angular.mock.inject(function ($templateCache) {
      $templateCache.put('path/to/template.html', '
    '); }));

提交回复
热议问题