Solucio framework tests unitaris
De wikiserver
fitxer test unitaris anomenat: asserts.js
function assert(value, desc) { var resultsList = document.getElementById("results"); if (!resultsList) { resultsList = document.createElement('ul'); document.getElementsByTagName('body')[0].appendChild(resultsList); resultsList.setAttribute('id','results'); } var li = document.createElement("li"); li.className = value ? "pass" : "fail"; li.appendChild(document.createTextNode(desc)); resultsList.appendChild(li); }
fitxer css tests unitaris anomenat: asserts.css
ul#results { border: 2px ridge maroon; background-color: #ffffcc; padding: 0.25em 1.5em; margin-left: 0; } li.pass { color: #006400; } li.fail { color: #dc143c; text-decoration: line-through; }