aboutsummaryrefslogtreecommitdiffstats
path: root/test/service/routeParamsSpec.js
blob: d4088767ae4b344f4e3d6c88513d17beab61139b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
'use strict';

describe('$routeParams', function() {
  it('should publish the params into a service', inject(function($rootScope, $route, $location, $routeParams) {
    $route.when('/foo');
    $route.when('/bar/:barId');

    $location.path('/foo').search('a=b');
    $rootScope.$digest();
    expect($routeParams).toEqual({a:'b'});

    $location.path('/bar/123').search('x=abc');
    $rootScope.$digest();
    expect($routeParams).toEqual({barId:'123', x:'abc'});
  }));
});