in Ox.DocPage, display test results
This commit is contained in:
parent
963e594397
commit
359a8984d3
1 changed files with 25 additions and 17 deletions
|
@ -180,24 +180,32 @@ Ox.DocPage = function(options, self) {
|
|||
);
|
||||
if (section == 'tests') {
|
||||
item.tests.forEach(function(test) {
|
||||
$elements.push($('<div>')
|
||||
.addClass(className)
|
||||
.css({marginLeft: (level * 32 + 16) + 'px'})
|
||||
.html(
|
||||
'<code><b>> '
|
||||
+ Ox.encodeHTMLEntities(test.statement)
|
||||
.replace(/ /g, ' ')
|
||||
.replace(/\n/g, '<br>\n ')
|
||||
+ '</b></code>'
|
||||
)
|
||||
$elements.push(
|
||||
$('<div>')
|
||||
.addClass(className)
|
||||
.css({marginLeft: (level * 32 + 16) + 'px'})
|
||||
.html(
|
||||
'<code><b>> '
|
||||
+ Ox.encodeHTMLEntities(test.statement)
|
||||
.replace(/ /g, ' ')
|
||||
.replace(/\n/g, '<br>\n ')
|
||||
+ '</b></code>'
|
||||
)
|
||||
);
|
||||
test.expected && $elements.push(
|
||||
$('<div>')
|
||||
.addClass(className)
|
||||
.css({marginLeft: (level * 32 + 16) + 'px'})
|
||||
.html(
|
||||
'<code>' + Ox.encodeHTMLEntities(test.actual || test.expected) + (
|
||||
test.passed === false
|
||||
? ' <span class="OxFailed"> // expected: '
|
||||
+ Ox.encodeHTMLEntities(test.expected)
|
||||
+ '</span>'
|
||||
: ''
|
||||
) + '</code>'
|
||||
)
|
||||
);
|
||||
test.expected && $elements.push($('<div>')
|
||||
.addClass(className)
|
||||
.css({marginLeft: (level * 32 + 16) + 'px'})
|
||||
.html(
|
||||
'<code>' + Ox.encodeHTMLEntities(test.expected) + '</code>'
|
||||
)
|
||||
)
|
||||
});
|
||||
} else if (section == 'source') {
|
||||
// fixme: not the right place to fix path
|
||||
|
|
Loading…
Reference in a new issue