Testing Backbone.js components with spies
With our Sinon.JS spies and other utilities ready, we will begin spying on our Backbone.js application. In this section, we will introduce and test two Notes application views—the menu bar view and the single note view.
Tip
Working through the examples
Reiterating a point from the previous chapter, we will present the menu bar view and single note view implementations with the code first and the tests second, to help maintain a narrative structure that properly introduces the Notes application (and to keep things brief). This is not the preferred order for actual test development.
Accordingly, while working through this chapter, we suggest that you put this book down for a moment after reading the described behavior of each component. See if you can design and implement your own tests for the sample application components. After this exercise, you can continue reading and compare your tests with the component test suites in this chapter.