in Ox.DocPage, display test results

This commit is contained in:
rolux 2012-06-12 13:16:06 +02:00
parent 963e594397
commit 359a8984d3

View file

@ -180,7 +180,8 @@ Ox.DocPage = function(options, self) {
);
if (section == 'tests') {
item.tests.forEach(function(test) {
$elements.push($('<div>')
$elements.push(
$('<div>')
.addClass(className)
.css({marginLeft: (level * 32 + 16) + 'px'})
.html(
@ -191,13 +192,20 @@ Ox.DocPage = function(options, self) {
+ '</b></code>'
)
);
test.expected && $elements.push($('<div>')
test.expected && $elements.push(
$('<div>')
.addClass(className)
.css({marginLeft: (level * 32 + 16) + 'px'})
.html(
'<code>' + Ox.encodeHTMLEntities(test.expected) + '</code>'
)
'<code>' + Ox.encodeHTMLEntities(test.actual || test.expected) + (
test.passed === false
? ' <span class="OxFailed"> // expected: '
+ Ox.encodeHTMLEntities(test.expected)
+ '</span>'
: ''
) + '</code>'
)
);
});
} else if (section == 'source') {
// fixme: not the right place to fix path