HTML and CSS Reference
In-Depth Information
/* ... */
"test should publish message from current user":
function () {
this.model.currentUser = "cjno";
assertEquals("cjno", this.model.notify.args[1].user);
Once again, we extracted common setup code to the setUp method while
adding the test. Passing the test is accomplished by Listing 15.76.
Listing 15.76 Including the current user in the published message
function handleSubmit(event) {
this.model.notify("message", {
user: this.model.currentUser
The final piece of the puzzle is including the message. The message should be
grabbed from the message form, which means that the test will need to embed some
markup. Listing 15.77 shows the test.
Listing 15.77 Expecting the published message to originate from the form
TestCase("FormControllerHandleSubmitTest", {
setUp: function () {
/*:DOC element = <form>
<input type="text" name="message" id="message">
<input type="submit" value="Send">
</form> */
/* ... */
/* ... */
"test should publish message from form": function () {
var el = this.element.getElementsByTagName("input")[0];
Search WWH ::

Custom Search