excludeAllQueryParams when adding a query param
Closed this issue · 4 comments
Thanks for the recent addition of the excludeAllQueryParams
parameter! This fits most of our needs, but we're missing a test case.
When loading a page, we start with no query params. When a user start searching in a search input, the search
query param is added and populated. If the user the clears the search, focus is changed from the search input to the nav.
An example test case might look like:
test('excludeAllQueryParams is true, queryParams do not exist but are added, do not manage focus', async function (assert) {
let router = this.owner.lookup('service:router');
await render(hbs`<NavigationNarrator @excludeAllQueryParams={{true}} />`);
router.trigger('routeDidChange', new MockTransition({
from: new MockRouteInfo({
name: 'biscuit',
params: { id: 'hobnob' },
}),
to: new MockRouteInfo({
name: 'biscuit',
params: { id: 'hobnob' },
queryParams: { region: 'apac' },
}),
})
await settled();
assert.dom('#ember-a11y-refocus-nav-message').isNotFocused();
});
It seems that this line is causing the issue - it would be great if a change from no params to params would follow the excludeAllQueryParams
param.
Thank you for reporting this issue, apologies for the inconvenience. Will fix ASAP!
Just to document while I figure it out:
- I can reproduce this with a failing test
- Looking at the code, should catch the scenario 🤔 Or rather, it was intended to catch the scenario
Will need to ask around a little and dig into it some more, but ideas welcome.
I merged the branch to main but I don't want to cut a new release until we're really sure this won't mess up other scenarios.
Resolved in v4.1.3