Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I think this is an bug(with URL), when I change state #2774

Closed
AlexandrAnash opened this issue May 27, 2016 · 3 comments
Closed

I think this is an bug(with URL), when I change state #2774

AlexandrAnash opened this issue May 27, 2016 · 3 comments

Comments

@AlexandrAnash
Copy link

I have code:

$stateProvider.state('myState', {
            url: '/mystate',
            template: '<div>mystate</div>'
        }).state('home1', {
            url: '/home1',
            template: '<div>home1</div>'
        });

$transitions.onBefore({ from: 'myState', to: 'home1' }, function () {
     return false;
});

I also have test:

it('should go over the states and location correctly', function () {
$location.path('/home1');
$rootScope.$digest();

expect($state.current.name).toBe('home1');
expect($state.current.url).toBe('/home1');
expect($location.path()).toBe('/home1');


$location.path('/mystate');
$rootScope.$digest();
expect($state.current.name).toBe('myState');
expect($state.current.url).toBe('/mystate');
expect($location.path()).toBe('/mystate');

$location.path('/home1');
$rootScope.$digest();

expect($state.current.name).toBe('myState');
expect($state.current.url).toBe('/mystate');
**expect($location.path()).toBe('/mystate');** - I think the test should run correctly on this line

but I have an error: Expected '/home1' to be '/mystate'.  :(
});
@christopherthielen
Copy link
Contributor

thanks for the bug report. What version of ui-router are you reporting against? alpha.5 fixed a few url updating issues: #2723 #2730

@christopherthielen
Copy link
Contributor

christopherthielen commented May 27, 2016

http://plnkr.co/edit/McLtIy7oj8hpNtwwXYLd?p=preview
seems to work in alpha.5

@AlexandrAnash
Copy link
Author

Thanks for fast response.
I thought that the installed version 5 :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants