$location = {
hash: '/not-changed',
updateHash: function(hash) {
this.hash = hash;
}
};
scope = angular.scope(null, null, {$location: $location});
BTW: $location.hash does not include the '#' sign.
Best regards,
Adam Pohorecki
> --
> You received this message because you are subscribed to the Google Groups "angular" group.
> To post to this group, send email to ang...@googlegroups.com.
> To unsubscribe from this group, send email to angular+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/angular?hl=en.
>
>
my test looks something like
describe('TopCategoriesCtrl', function() {
var scope, $browser, $location, ctrl;
beforeEach(function() {
scope = angular.scope();
$location = scope.$service('$location');
$browser = scope.$service('$browser');
ctrl = scope.$new(TopCategoriesCtrl);
});
it('should set the default category to match the category_id
found in location.hash', function() {
$location.updateHash('#/categories/2');
expect(ctrl.selectedCategory).toEqual('2');
});
When I inspect the $location object it looks like I would expect. But
the controller doesn't seem to get a value for $location.hash and
therefore fails.
Either solution should work.
--
You received this message because you are subscribed to the Google Groups "angular" group.
To view this discussion on the web visit https://groups.google.com/d/msg/angular/-/MkQ3dO-sDd4J.