function getTestList(uri) { var xmlhttp = new XMLHttpRequest(); // xmlhttp.open("GET", "/css-validator/autotest/testsuite/xml/"+ // "bugs.xml",false); xmlhttp.open("GET", uri, false); xmlhttp.setRequestHeader('Cache-Control','no-cache') // xmlhttp.setRequestHeader('Accept','application/json') // xmlhttp.onreadystatechange=function() { // if (xmlhttp.readyState==4) { // checkResults(testrow, resultrow, xmlhttp); // } // } xmlhttp.send(null); generateTestTable(xmlhttp); } // generate the table with the first row // parameter the id of the table created // the table is as follow: //
| Test Case | // [1]Profile | // [2]Validity | (expected) // [3]Errors | (int) (FIXME or "-" ? ) (expected) // [4]Warnings | (int, expected). //
// [Testcase]
// [Results]
// description // |
// [1]profile | // [2]validity | // [3]errors | // [4]warnings | // var tr = document.createElement("tr"); tr.setAttribute("class", "expected"); var cell = document.createElement("td"); cell.setAttribute("rowspan","2"); var anc = document.createElement("a"); anc.setAttribute("href",testfile); anc.setAttribute("medium", medium); anc.setAttribute("warning", warningLevel); var text = document.createTextNode("[Testcase]"); anc.appendChild(text); cell.appendChild(anc); text = document.createTextNode(" - "); cell.appendChild(text); anc = document.createElement("a"); var checkuri = validator_uri+"validator?uri="+ urlencode(testfile)+"&profile="+ cssprofile+"&usermedium="+medium+"&warning="+warningLevel; // FIXME medium, warning level anc.setAttribute("href",checkuri); text = document.createTextNode("[Result]"); anc.appendChild(text); cell.appendChild(anc); anc = document.createElement("p"); anc.innerHTML = testdesc; cell.appendChild(anc); tr.appendChild(cell); cell = document.createElement("td"); cell.setAttribute("rowspan","2"); text = document.createTextNode(cssprofile); cell.appendChild(text); tr.appendChild(cell); cell = document.createElement("td"); text = document.createTextNode(validity); cell.appendChild(text); tr.appendChild(cell); cell = document.createElement("td"); text = document.createTextNode(nberrors); cell.appendChild(text); tr.appendChild(cell); cell = document.createElement("td"); text = document.createTextNode(nbwarnings); cell.appendChild(text); tr.appendChild(cell); var result_row = getResultRow(); table.appendChild(result_row); table.insertBefore(tr,result_row); } } function getResultRow() { var tr = document.createElement("tr"); tr.setAttribute("class", "result"); var cell = document.createElement("td"); var text = document.createTextNode("-"); cell.appendChild(text); tr.appendChild(cell); cell = document.createElement("td"); text = document.createTextNode("-"); cell.appendChild(text); tr.appendChild(cell); cell = document.createElement("td"); text = document.createTextNode("-"); cell.appendChild(text); tr.appendChild(cell); return tr; }
|---|