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

[Bug] 3.24.2 - up to - 3.25.3: href empty from links in rendering tests #554

Open
esbanarango opened this issue Mar 8, 2021 · 7 comments

Comments

@esbanarango
Copy link

esbanarango commented Mar 8, 2021

🐞 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`);
  });

Screen Shot 2021-03-08 at 9 29 56 AM

😕 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

emberjs/ember.js#19408

@Turbo87
Copy link
Collaborator

Turbo87 commented Mar 8, 2021

@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.

@esbanarango
Copy link
Author

esbanarango commented Mar 8, 2021

@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).
Garaje_Tests_and_tmp-test_js_—_workspace__Workspace_

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

@Turbo87
Copy link
Collaborator

Turbo87 commented Mar 8, 2021

I don't think this is up with how Ember is behaving now.

yes, because Ember changed its behavior multiple times lately 🤷‍♂️

@rwjblue
Copy link

rwjblue commented Mar 8, 2021

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...

@rogeraraujo90
Copy link

I asked if this behavior were a bug in the related issue. Good to know that we will have a fix for it! 👏🏼🧡

@esbanarango
Copy link
Author

esbanarango commented Mar 29, 2021

@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 🙏 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants