refactor tests to show same message when passing and failing

This commit is contained in:
Quincy Larson
2015-09-27 23:22:06 -07:00
parent 96804d37cf
commit 27f231e72f
4 changed files with 64 additions and 66 deletions

View File

@@ -580,28 +580,22 @@ var createTestDisplay = function() {
userTests.pop();
}
for (var i = 0; i < userTests.length; i++) {
var test = userTests[i];
var didTestPass = !userTests[i].err;
var testText = userTests[i].text.split('message: ').pop().replace(/\)|;|'/g, '');
var testDoc = document.createElement('div');
if (test.err) {
console.log('Should be displaying bad tests');
var iconClass = didTestPass ?
'"ion-checkmark-circled big-success-icon"' :
'"ion-close-circled big-error-icon"';
$(testDoc).html(
"<div class='row'><div class='col-xs-2 text-center'><i class='ion-close-circled big-error-icon'></i></div><div class='col-xs-10 test-output wrappable test-vertical-center grayed-out-test-output'>" +
test.text + "</div><div class='col-xs-10 test-output wrappable'>" +
test.err + "</div></div><div class='ten-pixel-break'/>"
)
.appendTo($('#testSuite'));
} else {
$(testDoc).html(
"<div class='row'><div class='col-xs-2 text-center'><i class='ion-checkmark-circled big-success-icon'></i></div><div class='col-xs-10 test-output test-vertical-center wrappable grayed-out-test-output'>" +
test.text +
"</div></div><div class='ten-pixel-break'/>"
)
.appendTo($('#testSuite'));
}
$(testDoc).html(
"<div class='row'><div class='col-xs-2 text-center'><i class=" +
iconClass +
"></i></div><div class='col-xs-10 test-output wrappable'>" +
testText +
"</div><div class='ten-pixel-break'/>"
)
.appendTo($('#testSuite'));
}
};