Skip to content

Instantly share code, notes, and snippets.

@gmoeck
Created January 10, 2011 17:59
Show Gist options
  • Save gmoeck/773146 to your computer and use it in GitHub Desktop.
Save gmoeck/773146 to your computer and use it in GitHub Desktop.
var initialLength;
module("Given I am looking at the main page", {
setup: function() {
var tasks = Todos.store.find(Todos.Task);
initialLength = tasks.length();
SC.RunLoop.begin();
Todos.main();
SC.RunLoop.end();
},
teardown: function() {
SC.RunLoop.begin();
Todos.getPath('mainPage.mainPane').remove();
Todos.store.reset();
SC.RunLoop.end();
}
});
test("When I click the add a task button", function() {
var button = Todos.getPath('mainPage.mainPane.topView.addTaskButton');
SC.RunLoop.begin();
var target = button.$('.sc-button-label');
SC.Event.trigger(target, "mousedown");
SC.Event.trigger(target, 'mouseup');
SC.RunLoop.end();
var todosList = Todos.getPath('mainPage.mainPane.middleView.contentView').get('content');
equals(todosList.length(), initialLength + 1, "it should add a task to the list");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment