mirror of
https://github.com/hashicorp/vault.git
synced 2026-05-28 04:10:44 -04:00
* copies v2 form components from POC branch * fixes issue in form-config-generator when path parameters are not defined * adds api code-generator for snippet creation * expands cli and terraform code generators * updates form-config-generator to return api path from spec * fixes issue setting field value in v2-form class * updates form-config types * updates v2 form and renderer components to conditional render fields * adds v2 form apply component * updates v2 form wizard component to support apply step * add support for field types (text input variants, text area, checkbox, radio, masked input) and add test coverage * Dynamic field visibility and Select field support * [POC] Public PKI (mocked) Wizard - revert this before merging * Revert "[POC] Public PKI (mocked) Wizard - revert this before merging" This reverts commit 66646f1d7a71d0e67028ebcabcfe33925197ffc9. * cleanup & address copilot pr comments * address PR comments --------- Co-authored-by: Shannon Roberts (Beagin) <beagins@users.noreply.github.com> Co-authored-by: Jordan Reimer <jordan.reimer@hashicorp.com>
66 lines
2.1 KiB
JavaScript
66 lines
2.1 KiB
JavaScript
/**
|
|
* Copyright IBM Corp. 2016, 2026
|
|
* SPDX-License-Identifier: BUSL-1.1
|
|
*/
|
|
|
|
import { render } from '@ember/test-helpers';
|
|
import { hbs } from 'ember-cli-htmlbars';
|
|
import { module, test } from 'qunit';
|
|
import { setupRenderingTest } from 'vault/tests/helpers';
|
|
|
|
module('Integration | Component | form/v2/section', function (hooks) {
|
|
setupRenderingTest(hooks);
|
|
|
|
test('it renders section title, description, and yielded content', async function (assert) {
|
|
this.section = {
|
|
name: 'test-section',
|
|
title: 'User Settings',
|
|
description: 'Configure your user preferences',
|
|
};
|
|
|
|
await render(hbs`
|
|
<Hds::Form as |Form|>
|
|
<Form::V2::Section @section={{this.section}} @formComponent={{Form}}>
|
|
<div data-test-content>Settings fields</div>
|
|
</Form::V2::Section>
|
|
</Hds::Form>
|
|
`);
|
|
|
|
assert.dom('h2').hasText('User Settings', 'renders section title');
|
|
assert.dom('p').includesText('Configure your user preferences', 'renders section description');
|
|
assert.dom('[data-test-content]').hasText('Settings fields', 'renders yielded content');
|
|
});
|
|
|
|
test('it renders without section header when title is not provided', async function (assert) {
|
|
this.section = {
|
|
name: 'no-title-section',
|
|
};
|
|
|
|
await render(hbs`
|
|
<Hds::Form as |Form|>
|
|
<Form::V2::Section @section={{this.section}} @formComponent={{Form}}>
|
|
<div data-test-content>Content without title</div>
|
|
</Form::V2::Section>
|
|
</Hds::Form>
|
|
`);
|
|
|
|
assert.dom('h2').doesNotExist('does not render title');
|
|
assert.dom('p').doesNotExist('does not render description');
|
|
assert.dom('[data-test-content]').hasText('Content without title', 'renders yielded content');
|
|
});
|
|
|
|
test('it renders an empty section', async function (assert) {
|
|
this.section = {
|
|
name: 'empty-section',
|
|
title: 'Empty Section',
|
|
};
|
|
|
|
await render(hbs`
|
|
<Hds::Form as |Form|>
|
|
<Form::V2::Section @section={{this.section}} @formComponent={{Form}} />
|
|
</Hds::Form>
|
|
`);
|
|
|
|
assert.dom('h2').hasText('Empty Section', 'renders section title');
|
|
});
|
|
});
|