Skip to content

Instantly share code, notes, and snippets.

@suissa
Created December 28, 2011 19:18
Show Gist options
  • Save suissa/1529251 to your computer and use it in GitHub Desktop.
Save suissa/1529251 to your computer and use it in GitHub Desktop.
assert js
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>Easy JavaScript Testing </title>
<style>
.pass:before {
content: 'PASS: ';
color: blue;
font-weight: bold;
}
.fail:before {
content: 'FAIL: ';
color: red;
font-weight: bold;
}
</style>
</head>
<body>
<ul id="output"></ul>
<script>
var output = document.getElementById('output');
function assert( outcome, description ) {
var li = document.createElement('li');
li.className = outcome ? 'pass' : 'fail';
li.appendChild( document.createTextNode( description ) );
output.appendChild(li);
};
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment