mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-06-10 15:28:51 +08:00
Due to the recent changes ragarding the Docs app "Materialization", some tests where failing for the following reasons: 1. JQuery wasn't being copied to 'build/docs/components/'. 2. E2E examples 89 and 90 were relying on the Bootstrap's glyphicons. Temporarily replaced with FontAwesome icons; to be replaced with Material Design iconfont, when ready. 3. `ngMaterial` (and its various dependencies) weren't loaded by Karma during unit testing (causing modules depending on it to fail). Added a fake `ngMaterial` module (as a temporary solution).
45 lines
1.4 KiB
JavaScript
45 lines
1.4 KiB
JavaScript
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']);
|
|
}
|
|
));
|
|
});
|
|
});
|