Skip to content

Commit

Permalink
Merge pull request angular-ui#2202 from pkt-zer0/master
Browse files Browse the repository at this point in the history
$stateParams reset between tests
  • Loading branch information
nateabele committed Aug 25, 2015
2 parents 9dc31c5 + 2aeb0c4 commit 0e557ca
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/state.js
Original file line number Diff line number Diff line change
Expand Up @@ -1461,5 +1461,5 @@ function $StateProvider( $urlRouterProvider, $urlMatcherFactory) {
}

angular.module('ui.router.state')
.value('$stateParams', {})
.factory('$stateParams', function () { return {}; })
.provider('$state', $StateProvider);
15 changes: 15 additions & 0 deletions test/stateSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1490,3 +1490,18 @@ describe('state queue', function(){
});
});
});

describe('$stateParams', function () {
beforeEach(module('ui.router.state'));

it('should start empty', inject(function ($stateParams) {
expect($stateParams.foo).toBeUndefined();
}));
it('should allow setting values on it', inject(function ($stateParams) {
$stateParams.foo = 'bar';
expect($stateParams.foo).toBeDefined();
}));
it('should be cleared between tests', inject(function ($stateParams) {
expect($stateParams.foo).toBeUndefined();
}));
});

0 comments on commit 0e557ca

Please sign in to comment.