handle failed async tests
This commit is contained in:
parent
8e144aed87
commit
b9c74fe895
1 changed files with 27 additions and 13 deletions
|
@ -184,6 +184,7 @@ Ox.DocPage = function(options, self) {
|
|||
);
|
||||
if (section == 'tests') {
|
||||
item.tests.forEach(function(test) {
|
||||
var isAsync = test.expected && /(.+Ox\.test\()/.test(test.statement);
|
||||
$elements.push(
|
||||
$('<div>')
|
||||
.addClass(className)
|
||||
|
@ -193,23 +194,36 @@ Ox.DocPage = function(options, self) {
|
|||
+ 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)
|
||||
+ '</b>'
|
||||
+ (
|
||||
test.passed === false && isAsync
|
||||
? ' <span class="OxFailed"> // actual: '
|
||||
+ Ox.encodeHTMLEntities(test.actual)
|
||||
+ '</span>'
|
||||
: ''
|
||||
) + '</code>'
|
||||
)
|
||||
+ '</code>'
|
||||
)
|
||||
);
|
||||
if (test.expected) {
|
||||
$elements.push(
|
||||
$('<div>')
|
||||
.addClass(className)
|
||||
.css({marginLeft: (level * 32 + 16) + 'px'})
|
||||
.html(
|
||||
'<code>'
|
||||
+ Ox.encodeHTMLEntities(test.actual || test.expected)
|
||||
+ (
|
||||
test.passed === false && !isAsync
|
||||
? ' <span class="OxFailed"> // expected: '
|
||||
+ Ox.encodeHTMLEntities(test.expected)
|
||||
+ '</span>'
|
||||
: ''
|
||||
)
|
||||
+ '</code>'
|
||||
)
|
||||
);
|
||||
}
|
||||
});
|
||||
} else if (section == 'source') {
|
||||
// fixme: not the right place to fix path
|
||||
|
|
Loading…
Reference in a new issue