-
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
Changes from 11 commits
d11438c
e2c3be3
b6fdd89
c00b314
c9a4d14
cfa936d
4c01f2b
bfb531b
423868a
3cf3ea5
ffd9b69
172782a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -173,5 +173,88 @@ 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 commentThe reason will be displayed to describe this comment to others. Learn more. This test is meant to cover a scenario like this:
|
||||
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(); | ||||
}); | ||||
|
||||
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 commentThe reason will be displayed to describe this comment to others. Learn more. This test is meant to cover a scenario like this:
|
||||
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' }, | ||||
queryParams: { region: 'apac' }, | ||||
}), | ||||
to: new MockRouteInfo({ | ||||
name: 'biscuit', | ||||
params: { id: 'hobnob' }, | ||||
}), | ||||
}) | ||||
); | ||||
|
||||
await settled(); | ||||
|
||||
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 commentThe reason will be displayed to describe this comment to others. Learn more. This test is meant to cover a scenario like this:
|
||||
let router = this.owner.lookup('service:router'); | ||||
|
||||
await render(hbs`<NavigationNarrator @excludeAllQueryParams={{true}} />`); | ||||
router.trigger( | ||||
'routeDidChange', | ||||
new MockTransition({ | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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: new MockRouteInfo({ | ||||
name: 'biscuit', | ||||
params: { id: 'hobnob' }, | ||||
queryParams: { region: 'apac' }, | ||||
parent: new MockRouteInfo({ | ||||
name: 'biscuits', | ||||
parent: new MockRouteInfo({ | ||||
name: 'application', | ||||
}), | ||||
}), | ||||
}), | ||||
to: new MockRouteInfo({ | ||||
name: 'index', | ||||
parent: new MockRouteInfo({ | ||||
name: 'cakes', | ||||
parent: new MockRouteInfo({ | ||||
name: 'application', | ||||
}), | ||||
}), | ||||
}), | ||||
}) | ||||
); | ||||
|
||||
await settled(); | ||||
|
||||
assert.dom('#ember-a11y-refocus-nav-message').isFocused(); | ||||
}); | ||||
}); | ||||
}); |
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 thehasSameRoute
.