angular.js/test/service/routeParamsSpec.js

17 lines
478 B
JavaScript
Raw Normal View History

'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'});
}));
});