Lesson 2: Writing, testing, and debugging JavaScript CHAPTER 3 99
FIGURE 3-10 he QUnit-Metro summary screen showing the failed testT
The test failed with a message that states that greeting is undefined. Now, you make the
test pass. In the bottom of the default.js file, add the following code that declares a greeting
variable and assigns a value of Hello World:
var greeting = 'Hello World';
Save all files by clicking File and choosing Save All (or pressing Ctrl+Shift+S) and then run
the application again. You should see that the test now passes because greeting is defined
and initialized to Hello World. In the QUnit-Metro summary screen, you should see a message
that states 1 Tests Of 1 Passed, 0 Failed. If you click the test, you should see a green indicator,
as shown in Figure 3-11.