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

[BUGFIX release] Ensure query param only <LinkTo /> are properly scoped in engines. #19337

Merged
merged 1 commit into from
Jan 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/@ember/-internals/glimmer/lib/components/link-to.ts
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,8 @@ const LinkComponent = EmberComponent.extend({

_route: computed('route', '_currentRouterState', function computeLinkToComponentRoute(this: any) {
let { route } = this;
return this._namespaceRoute(route === UNDEFINED ? this._currentRoute : route);

return route === UNDEFINED ? this._currentRoute : this._namespaceRoute(route);
}),

_models: computed('model', 'models', function computeLinkToComponentModels(this: any) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -890,6 +890,25 @@ moduleFor(
});
}

'@test query params only transitions work properly'(assert) {
assert.expect(1);

let tmpl = '<LinkTo @query={{hash type="news"}}>News</LinkTo>';

this.setupAppAndRoutableEngine();
this.additionalEngineRegistrations(function () {
this.register('template:category', compile(tmpl));
});

return this.visit('/blog/category/1').then(() => {
let suffix = '/blog/category/1?type=news';
let href = this.element.querySelector('a').href;

// check if link ends with the suffix
assert.ok(this.stringsEndWith(href, suffix));
});
}

async ['@test query params in customized controllerName have stickiness by default between model'](
assert
) {
Expand Down