samedi 7 novembre 2015

How to test an action gets called in a component ember testing

How can I test that an action was called in a component?

There are multiple ways of triggering an action like clicking on a button. Now I want to test that the action that is called when clicking on that button is actually called. Something like expect.functionName.to.be.called or something.

I have the following code

test('it closes the create dialog when close btn is clicked', function(assert) {
  this.render(hbs`{{group-create cancelCreateAction="cancelAction"}}`)

  this.$('button.btn--primary').click()
  expect('myAction').to.be.called?
})

so i'm just wondering what I can do there?




Aucun commentaire:

Enregistrer un commentaire