vendredi 19 juillet 2019

component templateUrl not working with spec

I'm running tests for an AngularJS component. I think by using templateUrl in my component, my spec/test file fails.

In my spec I have in the beforeAll function

element = angular.element('<horizontal-list></horizontal-list>');
element = $compile(element)(scope);

I get this error in Jest

 [$sce:insecurl] Blocked loading resource from url not allowed by $sceDelegate policy.  URL: app/global/components/horizontal-list/horizontal-list.tpl.html

How do I get the test to allow $sce to use the resource templateUrl in my component?

I know in the module app config I can change the config but I am using angular-mocks

Aucun commentaire:

Enregistrer un commentaire