Guest User

Untitled

a guest
Dec 15th, 2013
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. describe('The navigation controller', function() {
  2.     var $scope, $location;
  3.  
  4.     // I'm not fond of this bit myself tbh (pulling an injected service upwards)
  5.     beforeEach(inject(function($rootScope, $controller) {
  6.         $location = jasmine.createSpyObj('$location', ['path']);
  7.         $scope = $rootScope.$new();
  8.  
  9.         $controller('NavCtrl', {
  10.             $scope: $scope,
  11.             $location: $location
  12.         });
  13.     }));
  14.  
  15.     it('should have a method to check if the path is active', function() {
  16.         $location.path.andReturn('/about');
  17.         expect($scope.isActive('/about')).toBe(true);
  18.         expect($scope.isActive('/contact')).toBe(false);
  19.     });
  20. });
Advertisement
Add Comment
Please, Sign In to add comment