JSFiddle - React, Tailwind, and code Playground

by Brian Dukes

HTML

<link rel="stylesheet" href="http://code.jquery.com/qunit/qunit-git.css">
<h1 id="qunit-header">QUnit Test Suite</h1>
<h2 id="qunit-banner"></h2>
<div id="qunit-testrunner-toolbar"></div>
<h2 id="qunit-userAgent"></h2>
<ol id="qunit-tests"></ol>
<div id="qunit-fixture">test markup</div>

JavaScript

test("a basic test example", function() {
    ok(true, "this test is fine");
    var value = "hello";
    equal("hello", value, "We expect value to be hello");
});
module("Module A");
test("first test within module", function() {
    ok(true, "all pass");
});
test("second test within module", function() {
    ok(true, "all pass");
});
module("Module B");
test("some other test", function() {
    expect(2);
    equal(true, false, "failing test");
    equal(true, true, "passing test");
});
asyncTest('JSON test', 2, function () {
    $.ajax('/echo/json/', {
        type: "POST", 
        data: $.param({json: '{"a":1,"property-with-dash":2}' }), 
        success: function (result) {
            start();
            equal(result.a, 1, 'JSON number');
            equals(result['property-with-dash'], 2, 'JSON property with dash')
        },
        error: function () {
            start();
            ok(false, 'AJAX failed');
        }
    });
});