HTML and CSS Reference
In-Depth Information
Appendix A. You
We are all set with our website. We have learned how to write its code, build it with
the build scripts and deploy it to the production code, so that it goes live without any
hiccups. You are effectively done learning HTML5 Boilerplate. If you are curious in
becoming a better web developer, you could spend time understanding some other
relevant and useful parts of the Web! Let us explore a few of them.
Writing unit tests for your code
We wrote some JavaScript for our website. While the browsers let us know if the code
is written incorrectly, there is no way to tell if the code works as intended. Perhaps
there are edge cases that we failed to account for. The code should be as robust as
possible and works around all expected use cases and is capable of handling most
error conditions. You can ensure this is possible by writing tests to test every function
your code calls.
A unit can be considered as the smallest testable part of your code. When you write
unit tests, you ensure every section of the code behaves correctly. The easiest way to
get started with unit tests is to use a test suite.
QUnit.js is a popular browser-based test suite that tests your code in the browser.
Let us use this on our code that we wrote for the Sun and Sand Festival website.
Creating a testing environment
Let us create a tests folder within our project.
Then, we download QUnit.js from
qunit-1.9.0.js and the associated CSS file qunit.css from . The latest versions of these files
can be found at .
Search WWH ::

Custom Search