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();
var url = "chrome://mochikit/content/" + dir + "/";
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() {
$("list-holder").setAttribute("rowspan", 1 + count);
$("test-list").innerHTML += listContent;
$("test-table").innerHTML += tableContent;
$("wrapper").innerHTML += " "; // redraw the table
}
@ -96,7 +99,9 @@
<td>Passed</td>
<td>Failed</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>
</table>
</div>

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

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

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

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