Chapter 15. TDD and DOM Manipulation: The Chat Client
Developing client-side JavaScript includes a fair amount of DOM manipulation. In this chapter we will use test-driven development to implement a client for the chat backend we developed in Chapter 14, Server-Side JavaScript with Node.js. By doing so we will see how to apply the techniques we have learned so far to test DOM manipulation and event handling.
The DOM is an API just like any other, which means that testing it should be fairly straightforward so long as we adhere to the single responsibility principle and keep components loosely coupled. The DOM does potentially present a challenge in that it consists entirely of host objects, but as we will see, we can work around the potential ...
Get Test-Driven JavaScript Development now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.