2018-09-25 16:28:26 +00:00
|
|
|
import { module, test } from 'qunit';
|
|
|
|
import { setupRenderingTest } from 'ember-qunit';
|
|
|
|
import { render, find } from '@ember/test-helpers';
|
2018-05-25 20:33:22 +00:00
|
|
|
import hbs from 'htmlbars-inline-precompile';
|
|
|
|
|
2021-12-17 03:44:29 +00:00
|
|
|
module('Integration | Component | console/log json', function (hooks) {
|
2018-09-25 16:28:26 +00:00
|
|
|
setupRenderingTest(hooks);
|
2018-05-25 20:33:22 +00:00
|
|
|
|
2021-12-17 03:44:29 +00:00
|
|
|
hooks.beforeEach(function () {
|
2018-09-25 16:28:26 +00:00
|
|
|
this.codeMirror = this.owner.lookup('service:code-mirror');
|
|
|
|
});
|
2018-05-25 20:33:22 +00:00
|
|
|
|
2021-12-17 03:44:29 +00:00
|
|
|
test('it renders', async function (assert) {
|
2018-09-25 16:28:26 +00:00
|
|
|
// Set any properties with this.set('myProperty', 'value');
|
|
|
|
// Handle any actions with this.on('myAction', function(val) { ... });
|
|
|
|
const objectContent = { one: 'two', three: 'four', seven: { five: 'six' }, eight: [5, 6] };
|
|
|
|
const expectedText = JSON.stringify(objectContent, null, 2);
|
2018-05-25 20:33:22 +00:00
|
|
|
|
2018-09-25 16:28:26 +00:00
|
|
|
this.set('content', objectContent);
|
2018-05-25 20:33:22 +00:00
|
|
|
|
2018-09-25 16:28:26 +00:00
|
|
|
await render(hbs`{{console/log-json content=content}}`);
|
2022-03-29 16:25:16 +00:00
|
|
|
const instance = find('[data-test-component=code-mirror-modifier]').innerText;
|
|
|
|
assert.equal(instance, expectedText);
|
2018-09-25 16:28:26 +00:00
|
|
|
});
|
2018-05-25 20:33:22 +00:00
|
|
|
});
|