Are you wondering about the
/*global
comment? I’m using a tool
called
jslint
, which is a syntax-checker for Javascript that’s integra‐
ted into my editor. The comment tells it what global variables are
expected—it’s not important to the code, so don’t worry about it, but
I would recommend taking a look at Javascript linters like
jslint
or
jshint
when you get a moment. They can be very useful for avoid‐
ing JavaScript “gotchas”.
If you open up the file using your web browser (no need to run the dev server, just find
the file on disk) you should see something like
Figure 13-1.
Figure 13-1. Basic QUnit screen
Looking at the test itself, we’ll find many similarities with the Python tests we’ve been
writing so far:
test
(
"smoke test"
,
function
() {
//
equal
(
1
,
1
,
"Maths works!"
);
//
});
228
|
Chapter 13: Dipping Our Toes, Very Tentatively, into JavaScript