2023-03-01 09:39:41 -06:00
|
|
|
/**
|
|
|
|
|
* Copyright (c) HashiCorp, Inc.
|
|
|
|
|
* SPDX-License-Identifier: MPL-2.0
|
|
|
|
|
*/
|
|
|
|
|
|
2021-06-24 13:40:54 -04:00
|
|
|
import { module, test } from 'qunit';
|
|
|
|
|
import { setupRenderingTest } from 'ember-qunit';
|
|
|
|
|
import { render } from '@ember/test-helpers';
|
|
|
|
|
import { hbs } from 'ember-cli-htmlbars';
|
|
|
|
|
|
|
|
|
|
module('Integration | Helper | raw-json', function (hooks) {
|
|
|
|
|
setupRenderingTest(hooks);
|
|
|
|
|
|
|
|
|
|
test('it renders', async function (assert) {
|
|
|
|
|
this.set('inputValue', {});
|
2023-01-09 08:48:49 -08:00
|
|
|
await render(hbs`{{raw-json this.inputValue}}`);
|
2022-07-07 11:18:51 -07:00
|
|
|
assert.strictEqual(this.element.textContent.trim(), '{}');
|
2021-06-24 13:40:54 -04:00
|
|
|
this.set('inputValue', { key: 'value', nestedKey: { key: 'value' } });
|
2022-07-07 11:18:51 -07:00
|
|
|
assert.strictEqual(
|
2021-06-24 13:40:54 -04:00
|
|
|
this.element.textContent.trim(),
|
|
|
|
|
`{\n "key": "value",\n "nestedKey": {\n "key": "value"\n }\n}`
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
});
|