Skip to content

Instantly share code, notes, and snippets.

@jsven69gist
Created February 12, 2014 03:52
Show Gist options
  • Save jsven69gist/8949805 to your computer and use it in GitHub Desktop.
Save jsven69gist/8949805 to your computer and use it in GitHub Desktop.
JavaScript: Simple HTML doc with JS assert() test suite
<html>
<head>
<title>Test Suite</title>
<meta charset="utf-8" />
<script>
function assert(value, desc) {
var li = document.createElement('li');
li.className = value ? 'pass' : 'fail';
li.appendChild(document.createTextNode(desc));
document.getElementById('results').appendChild(li);
}
window.onload = function() {
// Assertions below:
}
</script>
<style>
#results li.pass { color: green; }
#results li.fail { color: red; }
</style>
</head>
<body>
<ul id="results"></ul>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment