HTML and CSS Reference
In-Depth Information
el.value = "What are you doing?";
var actual = this.model.notify.args[1].message;
assertEquals("What are you doing?", actual);
To pass this test we need to grab the first input element and pass its current
value as the message. Listing 15.78 shows the required update to handleSubmit .
Listing 15.78 Grabbing the message
function handleSubmit(event) {
var input = this.view.getElementsByTagName("input")[0];
this.model.notify("message", {
user: this.model.currentUser,
message: input.value
The tests now pass, which means that the chat client should be operable in a
real setting. As before, we haven't implemented much error handling for the form,
and I will leave doing so as an exercise. In fact, there are several tasks for you to
practice TDD building on this exercise:
Form should prevent the default action of submitting it to the server
Form should not send empty messages
Add missing error handling to all the methods
Emit an event (e.g. using observable ) from the message once a form is
posted. Observe it to display a loader gif, and emit a corresponding event
from the message list controller when the same message is displayed to
remove the loading indicator.
I'm sure you can think of even more.
15.5.4 Feature Tests
Because most of the functionality is taken care of by the generic form controller,
there isn't much to feature test. The only direct dependencies are tddjs ,
Search WWH ::

Custom Search