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
| 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')); |
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 controller, stubbedFunction; | |
| module("Todos.tasksController", { | |
| setup: function() { | |
| controller = Todos.tasksController; | |
| }, | |
| teardown: function() { | |
| SC.RunLoop.begin(); | |
| Todos.store.reset(); | |
| SC.RunLoop.end(); |
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
| 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 |
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() { |
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
| Todos.tasksController = SC.ArrayController.create({ | |
| countSummary: function() { | |
| if(this.get('length') == 0) | |
| return 'No Tasks'; | |
| else | |
| return '1 Task'; | |
| }.property('length').cacheable() | |
| }) ; |
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 controller, stubbedFunction; | |
| module("Todos.tasksController", { | |
| setup: function() { | |
| controller = Todos.tasksController; | |
| }, | |
| teardown: function() { | |
| SC.RunLoop.begin(); | |
| Todos.store.reset(); | |
| SC.RunLoop.end(); |
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'); //EXTRACTED THIS TO HERE | |
| }, | |
| teardown: function() { |
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
| Todos.mainPage = SC.Page.design({ | |
| mainPane: SC.MainPane.design({ | |
| childViews: 'middleView bottomView'.w(), | |
| middleView: SC.ScrollView.design({ | |
| hasHorizontalScroller: NO, | |
| layout: { top: 36, bottom: 32, left: 0, right: 0 }, | |
| backgroundColor: 'white', | |
| childViews: 'contentView'.w(), |
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
| Todos.tasksController = SC.ArrayController.create({ | |
| countSummary: function() { | |
| return 'No Tasks'; //ADDED THIS | |
| }.property('length').cacheable() //ADDED PROPERTIES | |
| }) ; |
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
| returns "No Tasks", expected: No Tasks result: undefined |