Skip to content

Commit

Permalink
Merge pull request #19337 from emberjs/ensure-query-param-only-transi…
Browse files Browse the repository at this point in the history
…tions-work-in-engines
  • Loading branch information
rwjblue authored Jan 14, 2021
2 parents c96143b + a0580d2 commit ea5ef94
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
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

0 comments on commit ea5ef94

Please sign in to comment.