-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathdirective-with-dummy.js
52 lines (43 loc) · 1.09 KB
/
directive-with-dummy.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
function someDirective() {
var directive = {
restrict: 'E',
replace: true,
template: '<div another-element></div>'
};
return directive;
}
function anotherElement() {
var directive = {
restrict: 'EA',
replace: true,
template: '<div></div>'
};
return directive;
}
angular
.module('AnotherModule', [])
.directive('anotherElement', anotherElement);
angular
.module('directiveWithDummy', ['AnotherModule'])
.directive('someDirective', someDirective);
describe('someDirective', function() {
var
element, $compile, $rootScope, $scope;
beforeEach(module('directiveWithDummy', {
anotherElementDirective: TestDummy.directive
}));
beforeEach(function() {
inject(function(_$compile_, _$rootScope_) {
$compile = _$compile_;
$rootScope = _$rootScope_;
$scope = $rootScope;
element = angular.element('<some-directive></some-directive>');
$compile(element)($scope);
angular.element(document.body).append(element);
$scope.$apply();
});
});
it('should not be null', function() {
expect(element).toBeTruthy();
});
});