0
我有一個單元測試,引發我一個錯誤:角1 /茉莉花 - 未知提供商:translateFilterProvider < - translateFilter
未知提供商:translateFilterProvider < - translateFilter
這個服務$翻譯?如果這就是我可以注入它,或者你有解決方案?
import angular from 'angular'
import 'angular-mocks'
let $scope
let $compile
let htmlElement
describe('ProjectGeneralSituationForm',() => {
beforeEach(angular.mock.module('ProjectGeneralSituationModule'))
beforeEach(() => {
inject((_$rootScope_, _$compile_) => {
$scope = _$rootScope_.$new()
$compile = _$compile_
})
})
beforeEach(() => {
$scope.project = {}
$scope.projectTypes = {}
$scope.projectReferences = {}
htmlElement = $compile(`<project-general-situation-form project="project" project-types="projectTypes" project-references="projectReferences"></project-general-situation-form>`)($scope)
$scope.$digest()
})
it('should be defined',() => {
expect(htmlElement).toBeDefined()
})
})
是一個指令?的測試,所以試試這裏inject((_ _rootScope_,_ $ compile_,_ $ translate_) –