Created
January 10, 2011 17:40
-
-
Save gmoeck/773116 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 task, summaryView; | |
module("Given I am viewing the tasks page", { | |
setup: function() { | |
SC.RunLoop.begin(); | |
Todos.main(); | |
SC.RunLoop.end(); | |
summaryView = Todos.getPath('mainPage.mainPane.bottomView.summaryView'); | |
}, | |
teardown: function() { | |
SC.RunLoop.begin(); | |
Todos.getPath('mainPage.mainPane').remove(); | |
Todos.store.reset(); | |
SC.RunLoop.end(); | |
} | |
}); | |
test("When there are no tasks inputted", function() { | |
equals(summaryView.get('value'), 'No Tasks', 'Then I should see "No Tasks" within the tasks count section of the page'); | |
}); | |
test("When there is one task already inputted", function() { | |
SC.RunLoop.begin(); | |
Todos.store.createRecord(Todos.Task, {'description': 'Some Task', 'isDone': false }); | |
SC.RunLoop.end(); | |
equals(summaryView.get('value'), '1 Task', 'Then I should see "1 Task" within the tasks count section of the page'); | |
}); | |
//ADDED THIS TEST | |
test("When there is more than one task already inputted", function() { | |
SC.RunLoop.begin(); | |
Todos.store.createRecord(Todos.Task, {'description': 'Some Task', 'isDone': false }); | |
Todos.store.createRecord(Todos.Task, {'description': 'Another Task', 'isDone': false }); | |
SC.RunLoop.end(); | |
equals(summaryView.get('value'), '2 Tasks', 'Then I should see "n Tasks" within the tasks count section of the page, where n is the number of tasks'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment