Skip to content

Instantly share code, notes, and snippets.

var mockedSetFunction, mockedFindFunction, setMockObject, findMockObject;
module("Todos.main", {
setup: function() {
mockedSetFunction = Todos.tasksController.set; //ADDED THIS
setMockObject = CoreTest.stub('Todos.tasksController.set', function() { return YES; }); //ADDED THIS
Todos.tasksController.set = setMockObject; //ADDED THIS
mockedFindFunction = Todos.store.find;
findMockObject = CoreTest.stub('Todos.store.find', function() { return YES; });
Todos.store.find = findMockObject;
Todos.main = function main() {
Todos.getPath('mainPage.mainPane').append() ;
var tasks = Todos.store.find(Todos.Task); //ADDED THIS
} ;
function main() { Todos.main(); }
var mockedFindFunction, findMockObject;
module("Todos.main", {
setup: function() {
mockedFindFunction = Todos.store.find;
findMockObject = CoreTest.stub('Todos.store.find', function() { return YES; });
Todos.store.find = findMockObject;
},
teardown: function() {
Todos.store.find = mockedFindFunction;
Then I should see the task in the list, expected: true result: false
Todos.tasksController = SC.ArrayController.create({
}) ;
Todos.mainPage = SC.Page.design({
mainPane: SC.MainPane.design({
childViews: 'middleView'.w(),
middleView: SC.ScrollView.design({
childViews: 'contentView'.w(),
contentView: SC.ListView.design({
contentBinding: 'Todos.tasksController.arrangedObjects' //ADDED THIS
})
Died on Test #1: TypeError: Result of expression 'todosList'[null] is not an object
Todos.mainPage = SC.Page.design({
mainPane: SC.MainPane.design({
childViews: 'middleView'.w(),
middleView: SC.ScrollView.design({
childViews: 'contentView'.w(),
contentView: SC.ListView.design({
1. Died on test #2: Result of expression 'Todos.getPath('mainPage.mainPane.middleView.contentView')' [undefined] is not an object
1. Setup exception on viewing_task.js Given an existing task module: When looking at the list of tasks: TypeError: Result of expression 'recordType'[undefined] is not an object
2. Died on test #2: Result of expression 'Todos.getPath('mainPage.mainPane.middleView.contentView')' [undefined] is not an object