lundi 10 octobre 2016

How to test route's willTransition action in Ember?

How can I test this code in Ember? Explain me please the concept, in general.

// app/routes/products/new.js
import Ember from 'ember';

export default Ember.Route.extend({
  model() {
    return this.store.createRecord('product');
  },
  actions: {
    willTransition() {
      this._super(...arguments);
      this.currentModel.rollbackAttributes();
    }
  }
});

I have no idea how to make this. May be stub model in route? I found that store is not available in route test.

After Ruby and RSpec, all these new javascript world is confusing a little bit) But I'd like to learn it anyway.




Aucun commentaire:

Enregistrer un commentaire