Return a htmlSafe string rather than use triple curlies

This commit is contained in:
Conor Mongey
2019-04-27 16:21:26 +01:00
parent d2323e0cb8
commit aa4c1288f3
3 changed files with 6 additions and 4 deletions

View File

@@ -18,5 +18,5 @@
</span>
</div>
<div data-test-log-box class="boxed-section-body is-dark is-full-bleed">
<pre data-test-log-cli class="cli-window"><code>{{{logger.output}}}</code></pre>
<pre data-test-log-cli class="cli-window"><code>{{logger.output}}</code></pre>
</div>

View File

@@ -1,5 +1,6 @@
import { alias } from '@ember/object/computed';
import { assert } from '@ember/debug';
import { htmlSafe } from '@ember/template';
import Evented from '@ember/object/evented';
import EmberObject, { computed } from '@ember/object';
import { assign } from '@ember/polyfills';
@@ -39,7 +40,8 @@ const Log = EmberObject.extend(Evented, {
// the logPointer is pointed at head or tail
output: computed('logPointer', 'head', 'tail', function() {
let logs = this.logPointer === 'head' ? this.head : this.tail;
return Anser.ansiToHtml(logs);
let colouredLogs = Anser.ansiToHtml(logs);
return htmlSafe(colouredLogs);
}),
init() {

View File

@@ -100,9 +100,9 @@ module('Unit | Util | Log', function(hooks) {
});
await settled();
assert.ok(log.get('output').endsWith(truncationMessage), 'Truncation message is shown');
assert.ok(log.get('output').toString().endsWith(truncationMessage), 'Truncation message is shown');
assert.equal(
log.get('output').length,
log.get('output').toString().length,
50000 + truncationMessage.length,
'Output is truncated the appropriate amount'
);