HTML and CSS Reference
In this chapter we have built on top of the ajax methods developed in Chapter 12,
Abstracting Browser Differences: Ajax, and implemented polling, the client side of
long polling and finally a simple Comet client that leveraged the observable
object developed in Chapter 11, The Observer Pattern. The main focus has, as
usual, been on the testing and how to properly use the tests to instruct us as we dig
deeper and deeper. Still, we have been able to get a cursory look at technologies
collectively referred to as Comet, Reverse Ajax, and others.
In the previous chapter we introduced and worked closely with stubs. In this
chapter we developed the poller slightly differently by not stubbing its immediate
dependency. The result yields less implementation specific tests at the cost of making
them mini integration tests.
This chapter also gave an example on how to stub and test timers and the
Date constructor. Having used the Clock object to fake time, we have seen how it
would be useful if the Date constructor could somehow be synced with it to more
effectively fake time in tests.
This chapter concludes our client-side library development for now. The next
chapter will use test-driven development to implement the server-side of a long
polling application using the node.js framework.