forked from angular/angular.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocsSpec.js
More file actions
44 lines (37 loc) · 1.36 KB
/
Copy pathdocsSpec.js
File metadata and controls
44 lines (37 loc) · 1.36 KB
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
describe("DocsController", function() {
var $scope;
// FIXME: Fake `ngMaterial` module to pass tests (because `ngMaterial` is not loaded by karma).
// PROPER FIX NEEDED !!!
angular.
module('ngMaterial', []).
value('$mdMedia', {}).
value('$mdSidenav', {});
angular.module('fake', [])
.value('openPlunkr', function() {})
.value('NG_PAGES', {})
.value('NG_NAVIGATION', {})
.value('NG_VERSION', {});
beforeEach(module('fake', 'DocsController'));
beforeEach(inject(function($rootScope, $controller) {
$scope = $rootScope;
$controller('DocsController', {$scope: $scope});
}));
describe('afterPartialLoaded', function() {
it('should update the Google Analytics with currentPage path if currentPage exists', inject(
function($window) {
$window._gaq = [];
$scope.currentPage = {path: 'a/b/c'};
$scope.$broadcast('$includeContentLoaded');
expect($window._gaq.pop()).toEqual(['_trackPageview', 'a/b/c']);
}
));
it('should update the Google Analytics with $location.path if currentPage is missing', inject(
function($window, $location) {
$window._gaq = [];
spyOn($location, 'path').andReturn('x/y/z');
$scope.$broadcast('$includeContentLoaded');
expect($window._gaq.pop()).toEqual(['_trackPageview', 'x/y/z']);
}
));
});
});