example qunit tests

already has qunit and its css linked already. sample test provided. useful as a template.

by mgrassotti

HTML

<link rel="stylesheet" href="http://code.jquery.com/qunit/git/qunit.css">
<script src="http://code.jquery.com/qunit/git/qunit.js"></script>
<h1 id="qunit-header">Unit Tests</h1>
<h2 id="qunit-banner"></h2>
<div id="qunit-testrunner-toolbar"></div>
<ol id="qunit-tests"></ol>
<div id="qunit-fixture"></div>

JavaScript

// 2 tests - okay is always true and equals (assert)
test("a basic test example", function() {
  ok( true, "this test is fine" );
  var value = "hello";
  equal( value, "hello", "We expect value to be hello" );
}); 

// 2 tests - equals and one with more debug
test("a test", function() {
  var actual = 1;
  equal(actual, 1);
  equal(actual, 1, "this message is added to the assertion result, useful for debugging");
});