-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
Backbone.js Testing
By :
Having now created test suites for Backbone.js models and collections, we turn to expanding our test coverage to a Backbone.js view.
The first Backbone.js view we will examine is App.Views.NoteView. This view is responsible for rendering App.Models.Note Markdown data into full HTML as shown in the following screenshot:

View rendered Markdown
The underlying model data for the figure includes the following attributes:
title:
My Title
text:
## My Heading * List item 1 * List item 2
The text attribute data transforms to HTML as:
<h2 id="myheading">My Heading</h2> <ul> <li>List item 1</li> <li>List item 2</li> </ul>
App.Views.NoteView is responsible for performing this conversion. The notes/app/js/app/views/note-view.js file first provides an initialize function, which sets model listeners to re-render or clean up the view and then kicks off render(). The render function...
Change the font size
Change margin width
Change background colour