Created
October 6, 2010 20:15
-
-
Save philippeantoine/613991 to your computer and use it in GitHub Desktop.
simple tdd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html><html> | |
<head><meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0;"> | |
<title>Unit</title></head> | |
<body> | |
<h1>Unit</h1> | |
<p>With | |
<ul> | |
<li>Generated Content: .class { content:"my text"; color:"red"; } | |
<li>DOM Elements creation: document.createElement('div') | |
</ul> | |
<h2>demo</h2> | |
<div class="fail">test</div> | |
<div class="pass">test</div> | |
<h2>code</h2> | |
<p><a href="unit.html">unit.html</a></p> | |
<script src="https://gist.github.com/613991.js?file=unit.html"></script> | |
<h2>log</h2> | |
<ul><li>2011-04-25 init</ul> | |
<style> | |
.fail:before{content:"FAIL ";color:red;} | |
.pass:before{content:"PASS ";color:green;} | |
</style> | |
<style> | |
* { font:1em monospace; padding:0; list-style:none; } | |
body { width:80ex; margin:auto; } | |
h1,h2,ul,p,table,pre { margin-top:1em; } | |
h1,h2 { color:blue } | |
h1:before { content: "# "; } | |
h2:before { content: "## "; } | |
li:before { content: "* "; } | |
table,td { border-top:1px solid grey; border-collapse:collapse; } | |
thead { background-color:black; color:white; } | |
td,th { padding:3px } | |
tr:nth-child(even) { background-color:lightgrey; } | |
</style></body></html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html><html> | |
<head><meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0;"> | |
<title>unit</title></head> | |
<body> | |
<h1>unit</h1> | |
<h2>Testsuite</h2> | |
<p id="test"/> | |
<script> | |
window.onload=function tdd(){ | |
ok(true,true, 'test1'); | |
ok(true,false,'test2'); | |
} | |
function ok(a,b,txt){ | |
var tu = document.createElement('div'); | |
tu.textContent=txt; | |
tu.setAttribute('class',(eval(a===b)?'pass':'fail')); | |
$('test').appendChild(tu); | |
} | |
function $(id){return document.getElementById(id)} | |
</script> | |
<style> | |
.fail:before{content:"FAIL ";color:red;} | |
.pass:before{content:"PASS ";color:green;} | |
</style> | |
<h2>log</h2> | |
<ul><li>2011-04-25 init</ul> | |
<style> | |
* { font:1em monospace; padding:0; list-style:none; } | |
body { width:80ex; margin:auto; } | |
h1,h2,ul,p,table,pre { margin-top:1em; } | |
h1,h2 { color:blue } | |
h1:before { content: "# "; } | |
h2:before { content: "## "; } | |
li:before { content: "* "; } | |
table,td { border-top:1px solid grey; border-collapse:collapse; } | |
thead { background-color:black; color:white; } | |
td,th { padding:3px } | |
tr:nth-child(even) { background-color:lightgrey; } | |
</style></body></html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment