-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
[CLEANUP beta] Remove Application Controller Router Properties #19707
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@btecu I think in the testing suite in general (both in places I flagged and even in places I didn't flag) the right path here is to refactor the assertions to use the router service public API instead of the application controller API. Removing the assertions (or tests) entirely is too much of a change, and degrades out test coverage of how Ember reflect routing state.
Can you give it another look through that lens?
|
||
expectDeprecation(() => { | ||
let currentRouteName = this.applicationInstance | ||
.lookup('controller:application') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this test was specifically testing deprecated behavior, I think the deprecated API was only used during test of a legitimate behavior we want to retain.
I believe the right approach here is to refactor the test to use the router service instead of currentRouteName
via the application controller, remove the expectDeprecation(
code, and retain the test.
Can you dig into it?
|
||
expectDeprecation(() => { | ||
let currentRouteName = this.applicationInstance | ||
.lookup('controller:application') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, I this test should be retained with the other expectDeprecation
left in place, but the code for the specific deprecated API removed here refactored.
@@ -129,9 +128,6 @@ moduleFor( | |||
let location = initialRouter.get('location'); | |||
|
|||
assert.equal(location.getURL(), '/one'); | |||
expectDeprecation(() => { | |||
assert.equal(get(initialApplicationController, 'currentPath'), 'one'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to above, can this assertion be changed to assert the router service with currentRoutePath
? https://api.emberjs.com/ember/3.27/classes/RouterService/properties/currentRouteName?anchor=currentRouteName
This is an integration test, and I wouldn't want to lose the coverage that Ember's routing system in general is up to date after a visit call.
@@ -160,9 +156,6 @@ moduleFor( | |||
); | |||
|
|||
assert.equal(location.getURL(), '/one'); | |||
expectDeprecation(() => { | |||
assert.equal(get(applicationController, 'currentPath'), 'one'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here as elsewhere in this file.
get currentPath() { | ||
let currentPath; | ||
expectDeprecation(() => { | ||
currentPath = this.applicationInstance.lookup('controller:application').get('currentPath'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...and again here, use the router service.
(I'm surprised these were not all refactored when the deprecation was added.)
4b70848
to
80b9a35
Compare
@mixonic updated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@btecu this is amazing!!
No description provided.