1
내 백본 클래스에서 내 방법을 확인하려고합니다. 보기 방법 addNewFoodtypeBackboneJs Sinon 테스트
addNewFoodtype: function() {
var newFoodtype = $('#newFoodtype').val();
if (newFoodtype == "") {
console.log("Wpisz nazwę Typu jedzenia !!");
} else {
var newFoodtypeModel = new app.Foodtype({"name": _.escape(newFoodtype)});
this.collection.add(newFoodtypeModel);
// this.render();
}
},
1.How에하지만 난 mochaJS와 쓰기 단위 테스트에 필요한이 방법은 작업, SinonJS
describe("Foodtype View", function() {
before(function() {
this.$fixture = $("<div id='note-view-fixture'></div>");
});
beforeEach(function() {
// Empty out and rebind the fixture for each run.
this.$fixture.empty().appendTo($("#fixtures"));
this.spy = sinon.spy();
var a=[{"id":1,"name":"Pizza","lastModificationDate":"2017-02-03T09:01:58.754Z"}];
this.view = new app.FoodtypeView({
el: this.$fixture,
collection: new app.FoodtypeCollection(a)
});
});
after(function() {
// Remove all subfixtures after test suite finishes.
$("#fixtures").empty();
});
it("Adding models", function() {
this.view.addNewFoodtype(this.spy);
});
는 컬렉션의 모델을 추가 내 방법을 확인 ?? 2. 매개 변수 전달 방법에 대해 알려주십시오. "var newFoodtype = $ ('# newFoodtype') .val();" 내보기에서