如何在 Ember 中测试此代码?一般来说,请解释一下这个概念。
// 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.get('controller.model').rollbackAttributes();
}
}
});
我不知道怎么做。可能是路径中的存根模型?我发现商店在路线测试中不可用。
在 Ruby 和 RSpec 之后,所有这些新的 javascript 世界都有些混乱)但我还是想学习它。