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

WIP: Failing test for #17963 #18061

Closed
wants to merge 1 commit into from
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,77 @@ if (EMBER_GLIMMER_ANGLE_BRACKET_BUILT_INS) {
});
}

['@test generates proper href for `LinkTo` with no @route after transitioning to an error route GH#17963'](
assert
) {
this.router.map(function() {
this.route('bad');
});

this.add(
'controller:application',
Controller.extend({
queryParams: ['baz'],
})
);

this.add(
'route:bad',
Route.extend({
model() {
throw new Error('bad!');
},
})
);

this.addTemplate('error', `Error: {{model.message}}`);

this.addTemplate(
'application',
`
<LinkTo id="bad-link" @route="bad">
Bad
</LinkTo>

<LinkTo id="good-link" @query={{hash baz='lol'}}>
Good
</LinkTo>

{{outlet}}
`
);

return this.visit('/')
.then(async () => {
assert.equal(this.$('#good-link').length, 1, 'good-link should be in the DOM');
assert.equal(this.$('#bad-link').length, 1, 'bad-link should be in the DOM');

let goodLink = this.$('#good-link');
assert.equal(goodLink.attr('href'), '/?baz=lol');

return this.visit('/bad');
})
.then(() => {
assert.equal(this.$('#good-link').length, 1, 'good-link should be in the DOM');
assert.equal(this.$('#bad-link').length, 1, 'bad-link should be in the DOM');

let goodLink = this.$('#good-link');
// should still be / because we never entered /bad (it errored before being fully entered)
// and error states do not get represented in the URL, so we are _effectively_ still
// on /
assert.equal(goodLink.attr('href'), '/?baz=lol');

runTask(() => this.click('#good-link'));

let applicationController = this.getController('application');
assert.deepEqual(
applicationController.getProperties('baz'),
{ baz: 'lol' },
'index controller QP properties updated'
);
});
}

['@test supplied QP properties can be bound'](assert) {
this.addTemplate(
'index',
Expand Down