Testing Backbone Views

We already have seen some of the advantages of using the View pattern in Chapter 3, Testing Frontend Code, and are already creating our interface components in such a manner. So how can a Backbone View be different from what we have done so far?

It retains a lot of the patterns that we have discussed as best practices for creating maintainable browser code, but with some syntax sugar and automation to make our life easier.

They are the glue code between the HTML and the model, and the Backbone View's main responsibility is to add behavior to the interface, while keeping it in sync with a model or collection.

As we will see, Backbone's biggest triumph is how it makes an easy-to-handle DOM event delegation, a task usually done ...

Get Jasmine JavaScript Testing now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.