lundi 17 octobre 2016

How to stub component's action in ember?

I created a component, whose action uses store service. How can I stub this action from integration test?

// app/components/invoice-form.js
export default Ember.Component.extend({
  actions: {
    loadPartners() {
      let self = this;
      this.get('store').findAll('partner').then(function(partners) {
        self.set('partners', partners);
      });
    }
  }
});

In this component's template I pass this action as closure to child component:



In my integration test, I render the component as usual

this.render(hbs``);

Action loadPartners is not passed as argument to component helper. Its just static component's action.

So the question is how to stub action loadPartners from integration test?




Aucun commentaire:

Enregistrer un commentaire