This commit is contained in:
Olli Pettay 2008-10-31 15:26:17 +02:00
Родитель 4fa9ab24c0
Коммит 27a8a48c5e
3 изменённых файлов: 29 добавлений и 41 удалений

Просмотреть файл

@ -46,8 +46,11 @@
srvScope.makeTags(); srvScope.makeTags();
var url = "chrome://mochikit/content/" + dir + "/"; var url = "chrome://mochikit/content/" + dir + "/";
var [links, count] = srvScope.list(url, chromeDir, true); var [links, count] = srvScope.list(url, chromeDir, true);
var tableContent = srvScope.linksToTableRows(links, 0); var listContent = srvScope.linksToListItems(links);
var tableContent = srvScope.linksToTableRows(links);
function populate() { function populate() {
$("list-holder").setAttribute("rowspan", 1 + count);
$("test-list").innerHTML += listContent;
$("test-table").innerHTML += tableContent; $("test-table").innerHTML += tableContent;
$("wrapper").innerHTML += " "; // redraw the table $("wrapper").innerHTML += " "; // redraw the table
} }
@ -96,7 +99,9 @@
<td>Passed</td> <td>Passed</td>
<td>Failed</td> <td>Failed</td>
<td>Todo</td> <td>Todo</td>
<td>Test Files</td> <td id="list-holder">
<ul class="top" id="test-list"><li><b>Test Files</b></li></ul>
</td>
</tr> </tr>
</table> </table>
</div> </div>

Просмотреть файл

@ -399,45 +399,20 @@ function linksToListItems(links)
/** /**
* Transform nested hashtables of paths to a flat table rows. * Transform nested hashtables of paths to a flat table rows.
*/ */
function linksToTableRows(links, recursionLevel) function linksToTableRows(links)
{ {
var response = ""; var response = "";
for (var [link, value] in links) { for (var [link, value] in links) {
var classVal = (!isTest(link) && !(value instanceof Object)) var classVal = (!isTest(link) && !(value instanceof Object))
? "non-test invisible" ? "non-test invisible"
: ""; : "";
spacer = "padding-left: " + (10 * recursionLevel) + "px";
if (value instanceof Object) { if (value instanceof Object) {
response += TR({class: "dir", id: "tr-" + link }, response += TR({class: "dir", id: "tr-" + link },
TD({colspan: "3"}, "&#160;"), TD({colspan: "3"},"&#160;"));
TD({style: spacer}, response += linksToTableRows(value);
A({href: link}, link)));
response += linksToTableRows(value, recursionLevel + 1);
} else { } else {
var bug_title = link.match(/test_bug\S+/); response += TR({class: classVal, id: "tr-" + link},
var bug_num = null; TD("0"), TD("0"), TD("0"));
if (bug_title != null) {
bug_num = bug_title[0].match(/\d+/);
}
if ((bug_title == null) || (bug_num == null)) {
response += TR({class: classVal, id: "tr-" + link },
TD("0"),
TD("0"),
TD("0"),
TD({style: spacer},
A({href: link}, link)));
} else {
var bug_url = "https://bugzilla.mozilla.org/show_bug.cgi?id=" + bug_num;
response += TR({class: classVal, id: "tr-" + link },
TD("0"),
TD("0"),
TD("0"),
TD({style: spacer},
A({href: link}, link), " - ",
A({href: bug_url}, "Bug " + bug_num)));
}
} }
} }
return response; return response;
@ -549,8 +524,15 @@ function testListing(metadata, response)
), ),
TABLE({cellpadding: 0, cellspacing: 0, id: "test-table"}, TABLE({cellpadding: 0, cellspacing: 0, id: "test-table"},
TR(TD("Passed"), TD("Failed"), TD("Todo"), TD("Test Files")), TR(TD("Passed"), TD("Failed"), TD("Todo"),
linksToTableRows(links, 0) TD({rowspan: count+1},
UL({class: "top"},
LI(B("Test Files")),
linksToListItems(links)
)
)
),
linksToTableRows(links)
), ),
DIV({class: "clear"}) DIV({class: "clear"})
) )

Просмотреть файл

@ -197,11 +197,12 @@ TestRunner.updateUI = function() {
// Set the table values // Set the table values
var trID = "tr-" + $('current-test-path').innerHTML; var trID = "tr-" + $('current-test-path').innerHTML;
var row = $(trID); var row = $(trID);
var tds = row.getElementsByTagName("td"); replaceChildNodes(row,
tds[0].style.backgroundColor = results.notOK > 0 ? "#f00" : "#0d0"; TD({'style':
tds[0].textContent = results.OK; {'backgroundColor': results.notOK > 0 ? "#f00":"#0d0"}}, results.OK),
tds[1].style.backgroundColor = results.notOK > 0 ? "#f00" : "#0d0"; TD({'style':
tds[1].textContent = results.notOK; {'backgroundColor': results.notOK > 0 ? "#f00":"#0d0"}}, results.notOK),
tds[2].style.backgroundColor = results.todo > 0 ? "orange" : "#0d0"; TD({'style': {'backgroundColor':
tds[2].textContent = results.todo; results.todo > 0 ? "orange":"#0d0"}}, results.todo)
);
} }