diff options
Diffstat (limited to 'docs/app/test/docsSpec.js')
| -rw-r--r-- | docs/app/test/docsSpec.js | 33 | 
1 files changed, 33 insertions, 0 deletions
| diff --git a/docs/app/test/docsSpec.js b/docs/app/test/docsSpec.js new file mode 100644 index 00000000..ea6c6ba9 --- /dev/null +++ b/docs/app/test/docsSpec.js @@ -0,0 +1,33 @@ +describe("DocsController", function() { +  var $scope; + +  angular.module('fake', []) +    .value('$cookies', {}) +    .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.afterPartialLoaded(); +      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.afterPartialLoaded(); +      expect($window._gaq.pop()).toEqual(['_trackPageview', 'x/y/z']); +    })); +  }); +});
\ No newline at end of file | 
