ember-link
ember-link copied to clipboard
[Bug] 3.24.2 - up to - 3.25.3: `href` empty from links in rendering tests
π Describe the Bug
In a rendering test the link
helper always return an emptyhref
.
π¬ Minimal Reproduction
test('href test', async function (assert) {
assert.expect(1);
await render(hbs`
{{#let (link route="login") as |l|}}
<a href={{l.url}}>Login</a>
{{/let}}
`);
assert.dom('a').hasAttribute('href', `/login`);
});

π Actual Behavior
Element a
has an empty attribute "href".
π€ Expected Behavior
Element a
has attribute "href" with value "/login"
π Environment
- Ember: 3.25.3
β Additional Context
https://github.com/emberjs/ember.js/issues/19408
Depending on how this addon does URL generation, I suspect it has to do roughly the same thing as the Ember PR's:
- https://github.com/emberjs/ember.js/pull/19080
- https://github.com/emberjs/ember.js/pull/19326
- https://github.com/emberjs/ember.js/pull/19387
- https://github.com/emberjs/ember.js/pull/19395
@esbanarango that is roughly how Ember up until now also behaved and the addon tries to follow what Ember itself does. we even explicitly test for this behavior in the test suite here.
@Turbo87 mmmm that's weird. Looks like this is actually testing it to be "empty" βΉοΈ.
https://github.com/buschtoens/ember-link/blob/master/tests/integration/components/link-test.ts#L40 or to be an ember selector (?) if you're using the setupLink
hook:
(Using setupLink
hook).
I don't think this is up with how Ember is behaving now.
This same test:
module('Integration | Component | TMP', function (hooks) {
setupRenderingTest(hooks);
test('href test', async function (assert) {
assert.expect(1);
await render(hbs`<LinkTo @route="login">test</LinkTo>`);
assert.dom('a').hasAttribute('href', `/login`);
});
});
works fine with ember-source: 3.25.3
.
But this one breaks with ember-link: 1.3.1
:
module('Integration | Component | TMP', function (hooks) {
setupRenderingTest(hooks);
test('href test', async function (assert) {
assert.expect(1);
await render(hbs`
{{#let (link route="login") as |l|}}
<a href={{l.url}}>Login</a>
{{/let}}
`);
assert.dom('a').hasAttribute('href', `/login`);
});
});
GitHub
Link primitive to pass around self-contained route references. It's {{link-to}}, but better! - buschtoens/ember-link
I don't think this is up with how Ember is behaving now.
yes, because Ember changed its behavior multiple times lately π€·ββοΈ
Yeah :/ sorry about this. We are trying to make the default behavior appropriate out of the box. From my perspective, the current implemetnation (in 3.24.3 and 3.25.3) is much better...
I asked if this behavior were a bug in the related issue. Good to know that we will have a fix for it! ππΌπ§‘
@Turbo87 I tried tackling this issue but I think I'm missing some context on how you guys are matching the way Ember behaves. Is this on your radar π ?