-
Notifications
You must be signed in to change notification settings - Fork 11
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
Melsumner/issue 378 #379
Melsumner/issue 378 #379
Conversation
@deanmarano can you check this and see if this is what you would expect? TYSM! |
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.
This change makes sense to me.
@@ -173,5 +173,77 @@ module('Integration | Component | navigation-narrator', function (hooks) { | |||
|
|||
assert.dom('#ember-a11y-refocus-nav-message').isFocused(); | |||
}); | |||
|
|||
test('excludeAllQueryParams is true, queryParams do not exist but are added, do not manage focus', async function (assert) { |
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.
This test is meant to cover a scenario like this:
myurl.com/someRoute
--> myurl.com/someRoute?someQueryParam=foo
assert.dom('#ember-a11y-refocus-nav-message').isNotFocused(); | ||
}); | ||
|
||
test('excludeAllQueryParams is true, queryParams exist on the route but then are emptied, still do not manage focus', async function (assert) { |
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.
This test is meant to cover a scenario like this:
myurl.com/someRoute?someQueryParam=foo
--> myurl.com/someRoute
assert.dom('#ember-a11y-refocus-nav-message').isNotFocused(); | ||
}); | ||
|
||
test('excludeAllQueryParams is true, queryParams exist on the route, user navigates to new route without any query params, manage focus', async function (assert) { |
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.
This test is meant to cover a scenario like this:
myurl.com/someRoute?someQueryParam=foo
--> myurl.com/someOtherRoute
let hasSameRoute = this.transition.from.name === this.transition.to.name; | ||
|
||
if (this.excludeAllQueryParams && this.hasQueryParams && hasSameRoute) { |
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.
This makes the failing test pass, but I also wonder if there's a more elegant way to do this. Suggestions welcome.
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.
The this.hasQueryParams
might not be needed with the hasSameRoute
.
await render(hbs`<NavigationNarrator @excludeAllQueryParams={{true}} />`); | ||
router.trigger( | ||
'routeDidChange', | ||
new MockTransition({ |
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 used the same format found here, with a query param added to the from
:
test('when routes differ', function (assert) { |
If merged, this PR resolves the issue described in #378
Details
hasQueryParams
check so that it checks for more combinationshasQueryParams
check to be more terseonRouteChange
action to compare routesAfter review/any changes/approval, I'll squash/merge and do a patch release.