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') {
|
if (section == 'tests') {
|
||||||
item.tests.forEach(function(test) {
|
item.tests.forEach(function(test) {
|
||||||
$elements.push($('<div>')
|
$elements.push(
|
||||||
.addClass(className)
|
$('<div>')
|
||||||
.css({marginLeft: (level * 32 + 16) + 'px'})
|
.addClass(className)
|
||||||
.html(
|
.css({marginLeft: (level * 32 + 16) + 'px'})
|
||||||
'<code><b>> '
|
.html(
|
||||||
+ Ox.encodeHTMLEntities(test.statement)
|
'<code><b>> '
|
||||||
.replace(/ /g, ' ')
|
+ Ox.encodeHTMLEntities(test.statement)
|
||||||
.replace(/\n/g, '<br>\n ')
|
.replace(/ /g, ' ')
|
||||||
+ '</b></code>'
|
.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') {
|
} else if (section == 'source') {
|
||||||
// fixme: not the right place to fix path
|
// fixme: not the right place to fix path
|
||||||
|
|
Loading…
Add table
Reference in a new issue