Files
threshold-ui/ui/admin/tests/integration/components/info-field-test.js
T
55e1e68f30 [COMPLIANCE] Update Copyright and License Headers (#3099)
Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com>
Co-authored-by: Dharini <dharini@hashicorp.com>
2026-01-20 11:35:10 -05:00

50 lines
1.5 KiB
JavaScript

/**
* Copyright IBM Corp. 2021, 2025
* SPDX-License-Identifier: BUSL-1.1
*/
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';
module('Integration | Component | info-field', function (hooks) {
setupRenderingTest(hooks);
hooks.beforeEach(function () {
this.set('label', 'Type');
this.set('helperText', 'Description');
});
test('it renders without icon', async function (assert) {
await render(
hbs`
<InfoField @value="JSON" as |F|>
<F.Label>{{this.label}}</F.Label>
<F.HelperText>{{this.helperText}}</F.HelperText>
</InfoField>
`,
);
assert.dom('.info-field').isVisible();
assert.dom('.info-field .hds-form-label').hasText('Type');
assert.dom('.info-field .hds-form-helper-text').hasText('Description');
assert.dom('.info-field .hds-form-text-input').isVisible();
});
test('it renders with icon', async function (assert) {
await render(
hbs`
<InfoField @value="JSON" @icon='apple' as |F|>
<F.Label>{{this.label}}</F.Label>
<F.HelperText>{{this.helperText}}</F.HelperText>
</InfoField>
`,
);
assert.dom('.info-field').isVisible();
assert.dom('.info-field .hds-form-label').hasText('Type');
assert.dom('.info-field .hds-form-helper-text').hasText('Description');
assert.dom('[data-test-icon="apple"]').isVisible();
assert.dom('.info-field .hds-form-text-input').isVisible();
});
});