모듈 $ document를 포함하는 AngularJS의 지시문이 있습니다. 나는 그것이 카르마를 사용하는 단위 테스트를 작성하려고하고 기능 click()
도 keyup()
같은 $document
의 다른 기능을 시도, $document
에 존재하지 때문에 시험을 중단하고 같은 문제를 가지고있었습니다
$document.click(function (e) {});
:
TypeError: undefined is not a function
이 이 실패하게 테스트 코드입니다 :
describe('Directive: multiSelectMenu', function() {
var element, scope;
beforeEach(module('myApp'));
describe('Test setup', function() {
it ('Injecting required data', inject(function ($compile, $rootScope) {
scope = $rootScope.$new();
element = $compile(angular.element('<div multi-select-menu></div>'))(scope);
$rootScope.$apply();
scope = element.isolateScope();
scope.$apply();
}));
});
});
는 이유는 무엇입니까 그것을 FAI 엘?
하지만 Angular 이전에 jQuery를로드했을 때 카르마에서는 $ document가 아무런 메서드없이 비어있는 것처럼 보입니다. –