2011-08-24 05:30:14 +00:00
|
|
|
'use strict';
|
|
|
|
|
|
2011-10-07 18:27:49 +00:00
|
|
|
describe('$routeParams', function() {
|
2011-10-17 23:56:56 +00:00
|
|
|
it('should publish the params into a service', inject(function($rootScope, $route, $location, $routeParams) {
|
2011-08-24 05:30:14 +00:00
|
|
|
$route.when('/foo');
|
|
|
|
|
$route.when('/bar/:barId');
|
|
|
|
|
|
2011-07-12 00:18:17 +00:00
|
|
|
$location.path('/foo').search('a=b');
|
2011-10-17 23:56:56 +00:00
|
|
|
$rootScope.$digest();
|
2011-08-24 05:30:14 +00:00
|
|
|
expect($routeParams).toEqual({a:'b'});
|
|
|
|
|
|
2011-07-12 00:18:17 +00:00
|
|
|
$location.path('/bar/123').search('x=abc');
|
2011-10-17 23:56:56 +00:00
|
|
|
$rootScope.$digest();
|
2011-08-24 05:30:14 +00:00
|
|
|
expect($routeParams).toEqual({barId:'123', x:'abc'});
|
2011-10-17 23:56:56 +00:00
|
|
|
}));
|
2011-08-24 05:30:14 +00:00
|
|
|
});
|