Created
January 10, 2011 17:59
-
-
Save gmoeck/773146 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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