i keep getting error when trying run unit-tests on directives:
error: unexpected request: /assets/partials/project-brand.html no more request expected i'm stumped on may causing issue.
here karma.conf.js:
files: [ 'js/*.js', 'partials/*.html', '../tests/client/unit/*.js' ] preprocessors: { 'partials/*.html': ['ng-html2js'] }, nghtml2jspreprocessor: { stripprefix: 'public/' } my file organization:
-public --js ---directives.js --partials ---project-brand.html -tests --client ---unit ----directives.js my directive:
.directive('projectbrand', [function() { return { restrict: 'e', scope: { brand: '=', projectid: '=', index: '=' }, templateurl: '/assets/partials/project-brand.html', controller: ['$scope', function($scope){ $scope.isworking = false; }]}}]) lastly, directives test file:
beforeeach(module('app')); beforeeach(module('partials/project-brand.html')); beforeeach(inject(function(_$compile_, _$rootscope_){ $compile = _$compile_; $rootscope = _$rootscope_; $scope = $rootscope.$new(); $scope.brand = {id: 1}; $scope.project.id = 1; $scope.index = 0; element = angular.element('<project-brand brand="brand" project-id="project.id" index="$index"></project-brand>'); directive = $compile(element)($scope); $scope.$apply(); })); if has suggestions appreciate it!
this 1 of issues how angular treats templateurl. faced same issue , fixed looking @ file structure can please try 'partials/project-brand.html'. please let me know if fixed it.
Comments
Post a Comment