Verified Commit 0f1ef64b authored by Camil Staps's avatar Camil Staps 🙂

Improve HTML test results formatting

parent be73eb2f
......@@ -84,6 +84,9 @@ function runTestCase(testcase) {
case 'Function':
f = highlightFunction;
break;
case 'TypeDef':
f = highlightTypeDef;
break;
default:
process.stderr.write(RED + 'Unknown test type "' + testcase.type + '"' + RESET + '\n');
process.exit(1);
......@@ -96,9 +99,10 @@ function runTestCase(testcase) {
htmlResults += '<tr class="testcase ' + (passed ? 'passed' : 'failed') + '">';
htmlResults += '<td>' + testcase.name + '</td>';
htmlResults += '<td><pre>' + resultToHTML(testcase.result) + '</pre></td>';
htmlResults += '<td><pre>' + resultToHTML(result) + '</pre></td>';
htmlResults += '</tr>';
htmlResults += '<td><pre>' + resultToHTML(testcase.result) + '</pre>';
if (!passed)
htmlResults += '<pre>' + resultToHTML(result) + '</pre>';
htmlResults += '</td></tr>';
if (passed) {
process.stderr.write(GREEN + testcase.name + ' passed.' + RESET + '\n');
......@@ -126,7 +130,7 @@ fs.readdir('tests', function(err, files) {
<h1>clean.js test results</h1>\
<h3 class="{{{RESULTCLASS}}}">{{{RESULTS}}}</h3>\
<table cellspacing="0">\
<tr><th>Test case</th><th>Expected result</th><th>Actual result</th></tr>';
<tr><th>Test case</th><th>Expected and actual result</th></tr>';
var passed = 0;
var failed = 0;
......
......@@ -12,7 +12,7 @@ h3.passed {
table {
border-collapse: separate;
border-spacing: 0 2px;
border-spacing: 0 .8em;
margin: 0 auto;
}
......@@ -35,3 +35,13 @@ tr.failed td:first-child {
tr.passed td:first-child {
background-color: #181;
}
tr.passed pre {
height: 0;
visibility: hidden;
}
tr:hover pre {
height: auto;
visibility: visible;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment