Skip to content

Instantly share code, notes, and snippets.

@charleshan
Created April 10, 2015 20:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save charleshan/fadcebebd3eac9c139a7 to your computer and use it in GitHub Desktop.
Save charleshan/fadcebebd3eac9c139a7 to your computer and use it in GitHub Desktop.
Meteor Velocity Mocha testing: todo sample application create a new task
if (!(typeof MochaWeb === 'undefined')){
MochaWeb.testOnly(function(){
describe("lists-show", function(){
it("creates a new task", function(){
Template.appBody.fireEvent('click .js-new-list');
var form = $("<form></form>");
var obj = $('<input/>').attr('type', 'text').val('item 1');
form.append(obj);
Template.listsShow.fireEvent('submit .js-todo-new', {
event: {
target: form,
preventDefault: function () {}
}
});
chai.assert.equal(Todos.find().count(), 1);
});
afterEach(function() {
var list = Lists.findOne();
Lists.remove(list._id);
var todos = Todos.findOne();
Todos.remove(todos._id);
});
});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment