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

Fix redirect injection #361

Conversation

joeljeske
Copy link

@joeljeske joeljeske commented Dec 10, 2016

Currently after v5.x, redirectTo custom injection is broken. It was due to overridden $inject property.

Also, I removed the extraneous $inject properties used on the wrapped functions as I saw them as unneeded. I don't have a huge preference though if you really want them

@@ -127,7 +127,7 @@ describe('permission', function () {
// THEN
expect(redirectStateName).toBePromise();
expect(redirectStateName).toBeResolvedWith({state: 'adminRedirect'});
expect(adminRedirectTo).toHaveBeenCalledWith('ADMIN', jasmine.any(Object));
expect(adminRedirectTo).toHaveBeenCalledWith(PermRoleStore, 'ADMIN');
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are used to assert the passed in, arbitrary injection values declared on the above $inject = [] assignment

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.004%) to 99.367% when pulling 8a06bf0 on joeljeske:feature/fix-inject-type-checks into 300f710 on Narzerus:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.004%) to 99.367% when pulling a6d2cf5 on joeljeske:feature/fix-inject-type-checks into 300f710 on Narzerus:master.

}

if (angular.isObject(redirection)) {
} else if (angular.isObject(redirection)) {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to do this here since isObject([]) === true. It was re-defining the property as this function instead of the array-syntax injected function.

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

Successfully merging this pull request may close these issues.

2 participants