|
@@ -152,7 +152,7 @@ export class OutputAssessmentResult {
|
|
|
}
|
|
|
|
|
|
formatNumber (result) {
|
|
|
- const result_class = result.grade == 1 ? 'assessment-number-result' : 'assessment-number-result-failed';
|
|
|
+ const result_class = result.grade == 1 ? 'assessment-number-result' : 'assessment-number-result-failed';
|
|
|
let template = this.formatOutput('assessment-number-expected',
|
|
|
'assessment-number-generated', result_class, result);
|
|
|
return template
|
|
@@ -198,8 +198,18 @@ export class OutputAssessmentResult {
|
|
|
|
|
|
const g_string = result.generated || "";
|
|
|
const e_string = result.expected || "";
|
|
|
- template = template.replace("$0", result.expected);
|
|
|
- template = template.replace("$1", result.generated);
|
|
|
+ console.log("generated: ", g_string,"expected: ", e_string);
|
|
|
+ let g_string_tmpl = g_string;
|
|
|
+ let e_string_tmpl = e_string;
|
|
|
+ if(result.generated == null) {
|
|
|
+ g_string_tmpl = OutputAssessmentResult.EMPTY_OUTPUT_TEMPLATE.replace('$0',
|
|
|
+ LocalizedStrings.getMessage('assessment-empty-generated-tooltip'));
|
|
|
+ } else if (result.expected == null) {
|
|
|
+ e_string_tmpl = OutputAssessmentResult.EMPTY_OUTPUT_TEMPLATE.replace('$0',
|
|
|
+ LocalizedStrings.getMessage('assessment-empty-expected-tooltip'));
|
|
|
+ }
|
|
|
+ template = template.replace("$0", e_string_tmpl);
|
|
|
+ template = template.replace("$1", g_string_tmpl);
|
|
|
if(result.grade == 1) {
|
|
|
template = template.replace("$2", "✓");
|
|
|
template = template.replace(":class-result:", 'assessment-string-result');
|
|
@@ -215,6 +225,8 @@ export class OutputAssessmentResult {
|
|
|
|
|
|
getDiffStringStyle (text, action) {
|
|
|
const template = "<span class='$0'>$1</span>"
|
|
|
+ // Fix missing whitespace when its a single element
|
|
|
+ text = text.replace(/\s/g," ");
|
|
|
switch(action) {
|
|
|
case StringDiff.INSERT:
|
|
|
return template.replace("$0", "stringdiff-insert").replace("$1", text);
|