Sha256: 15d2b8937c3b3a8065daf2474cd08f35ef7c91d0d4a5c753056a3f8e74838fa7
Contents?: true
Size: 1.4 KB
Versions: 3
Compression:
Stored size: 1.4 KB
Contents
import { RenderingTest, moduleFor } from '../../utils/test-case'; moduleFor( 'Helpers test: {{log}}', class extends RenderingTest { constructor() { super(...arguments); /* eslint-disable no-console */ this.originalLog = console.log; this.logCalls = []; console.log = (...args) => { this.logCalls.push(...args); /* eslint-enable no-console */ }; } teardown() { super.teardown(); /* eslint-disable no-console */ console.log = this.originalLog; /* eslint-enable no-console */ } assertLog(values) { this.assertText(''); this.assert.strictEqual(this.logCalls.length, values.length); for (let i = 0, len = values.length; i < len; i++) { this.assert.strictEqual(this.logCalls[i], values[i]); } } ['@test correctly logs primitives']() { this.render(`{{log "one" 1 true}}`); this.assertLog(['one', 1, true]); } ['@test correctly logs a property']() { this.render(`{{log value}}`, { value: 'one', }); this.assertLog(['one']); } ['@test correctly logs multiple arguments']() { this.render(`{{log "my variable:" value}}`, { value: 'one', }); this.assertLog(['my variable:', 'one']); } ['@test correctly logs `this`']() { this.render(`{{log this}}`); this.assertLog([this.context]); } } );
Version data entries
3 entries across 3 versions & 1 rubygems