Skip to content

Instantly share code, notes, and snippets.

var controller, stubbedFunction;
module("Todos.tasksController", {
setup: function() {
controller = Todos.tasksController;
},
teardown: function() {
SC.RunLoop.begin();
Todos.store.reset();
SC.RunLoop.end();
Todos.tasksController = SC.ArrayController.create({
countSummary: function() {
if(this.get('length') == 0)
return 'No Tasks';
else
return '1 Task';
}.property('length').cacheable()
}) ;
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() {
I should see "n Tasks" within the task count section of the page, where n is the number of tasks, expected: 2 Tasks result: 1 Task
var controller, stubbedFunction;
module("Todos.tasksController", {
setup: function() {
controller = Todos.tasksController;
},
teardown: function() {
SC.RunLoop.begin();
Todos.store.reset();
SC.RunLoop.end();
Todos.tasksController = SC.ArrayController.create({
countSummary: function() {
if(this.get('length') == 0){
return 'No Tasks';
}else{
if(this.get('length') == 1)
return '1 Task';
else
return "%@ Tasks".fmt(this.get('length'));
countSummary: function() {
var length = this.get('length');
if(length == 0) return 'No Tasks';
return length == 1 ? '1 Task' : "%@ Tasks".fmt(length);
}.property('length').cacheable(),
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();
},
Died on test #1: TypeError: Result of expresssion 'button' [undefined] is not an object.
Todos.mainPage = SC.Page.design({
mainPane: SC.MainPane.design({
childViews: 'topView middleView bottomView'.w(), //ADDED topView
//ADDED THIS VIEW
topView: SC.ToolbarView.design({
childViews: 'addTaskButton'.w(),
addTaskButton: SC.ButtonView.design({
})