Buduję stosunkowo prosty komponent comment-list
. Chcę przekazać w komentarzu modelu (powiedzmy Post
) i mieć komponent dbać o tworzenie, edytowanie, usuwanie komentarzy. Teraz omijam wszystkie różne działania i to jest bardzo kruche.Ember.js: Jak integrować komponenty testowe, które współdziałają z modelami danych ember
Jak utworzyć prawdziwe wystąpienie modelu danych Ember w teście integracji komponentów?
Moja najbliższa myślą było importować model następnie .create({})
go jednak, że błędy z use this.store.createRecord() instead
/* jshint expr:true */
import { assert } from 'chai';
import { describeComponent, it } from 'ember-mocha';
import hbs from 'htmlbars-inline-precompile';
import Post from 'ownersup-client/post/model';
describeComponent('comment-list', 'Integration: CommentListComponent', {
integration: true
},
function() {
it('renders all of the comments', function() {
const model = Post.create({ title: 'title' });
model.get('comments').createRecord({ body: 'One Comment' })
this.render(hbs`{{comment-list model=model}}`);
assert.lengthOf(this.$('.comment-list-item'), 1);
});
}
);
ktoś ma jakieś przemyślenia?
** this.inject.service ('store'); niech model = this.get ('sklep'). CreateRecord ('fo'); ** właśnie zgłasza błąd dla mnie – SuperUberDuper