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

click doesn't trigger <a {{action}}> #139

Open
jamesarosen opened this issue Jan 18, 2018 · 6 comments
Open

click doesn't trigger <a {{action}}> #139

jamesarosen opened this issue Jan 18, 2018 · 6 comments

Comments

@jamesarosen
Copy link

I have a template:

<a {{action 'delete'}} data-test={{hook 'delete' id=thing.id}}>

and a test

import { click } from 'ember-native-dom-helpers'
...
await click(hook('delete', { id: thing.id }))

With that, the action never fires. If I change the template to

<a onclick={{action 'delete'}} data-test={{hook 'delete' id=thing.id}}>

everything works as expected.

If this is expected behavior, it would be nice to have it in the README. If it's unexpected, I may be able to create a reproduction to help solve it.

@rwjblue
Copy link
Collaborator

rwjblue commented Jan 18, 2018

What kind of test? Acceptance?

@jamesarosen
Copy link
Author

jamesarosen commented Jan 18, 2018

Acceptance?

Yes. More fully,

moduleForAcceptance('Acceptance | Delete Thing', {
})

test('deleting things', async function (assert) {
  // create a thing
  await visit('/things')
  await click(hook('delete', { id: thing.id }))
  assert.hasNoElement($hook('thing', { name: thing.name }))
})

@rwjblue
Copy link
Collaborator

rwjblue commented Jan 18, 2018

In moduleForAcceptance tests ember-native-dom-helpers defers to window.click which comes from Ember's own ember-testing package (and therefore this addon's code itself isn't actually being used for clicking).

What Ember version?

@cibernox
Copy link
Owner

@rwjblue I don't think that is right. In ember-native-dom-helpers the global window.click is never used, no matter what.

@rwjblue
Copy link
Collaborator

rwjblue commented Jan 18, 2018

😩 thank you for correcting me @cibernox

I was confusing our wait stuff here. 😞

@jamesarosen
Copy link
Author

What Ember version?

2.16.0-beta.2

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

No branches or pull requests

3 participants