Skip to content

Commit

Permalink
Return a htmlSafe string rather than use triple curlies
Browse files Browse the repository at this point in the history
  • Loading branch information
Mongey committed May 2, 2019
1 parent d2323e0 commit aa4c128
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ui/app/templates/components/task-log.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -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>
4 changes: 3 additions & 1 deletion ui/app/utils/classes/log.js
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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() {
Expand Down
4 changes: 2 additions & 2 deletions ui/tests/unit/utils/log-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
);
Expand Down

0 comments on commit aa4c128

Please sign in to comment.