open-vault/ui/tests/integration/components/form-field-label-test.js
Jordan Reimer e811821ac7
Transform Advanced Templating (#13908)
* updates regex-validator component to optionally show pattern input and adds capture groups support

* adds form-field-label component

* adds autocomplete-input component

* updates kv-object-editor component to yield block for value and glimmerizes

* updates transform template model

* adds transform-advanced-templating component

* updates form-field with child component changes

* updates transform template serializer to handle differences in regex named capture groups

* fixes regex-validator test

* adds changelog entry

* updates for pr review feedback

* reverts kv-object-editor guidFor removal
2022-02-07 13:07:53 -07:00

45 lines
1.6 KiB
JavaScript

import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';
import { click } from '@ember/test-helpers';
module('Integration | Component | form-field-label', function (hooks) {
setupRenderingTest(hooks);
test('it renders', async function (assert) {
this.setProperties({
label: 'Test Label',
helpText: null,
subText: null,
docLink: null,
});
await render(hbs`
<FormFieldLabel
@label={{this.label}}
@helpText={{this.helpText}}
@subText={{this.subText}}
@docLink={{this.docLink}}
for="some-input"
/>
`);
assert.dom('label').hasAttribute('for', 'some-input', 'Attributes passed to label element');
assert.dom('label').hasText(this.label, 'Label text renders');
assert.dom('[data-test-help-text]').doesNotExist('Help text hidden when not provided');
assert.dom('.sub-text').doesNotExist('Sub text hidden when not provided');
this.setProperties({
helpText: 'More info',
subText: 'Some description',
});
await click('[data-test-tool-tip-trigger]');
assert.dom('[data-test-help-text]').hasText(this.helpText, 'Help text renders in tooltip');
assert.dom('.sub-text').hasText(this.subText, 'Sub text renders');
assert.dom('a').doesNotExist('docLink hidden when not provided');
this.set('docLink', 'foo.com/bar');
assert.dom('.sub-text').includesText('See our documentation for help', 'Doc link text renders');
assert.dom('a').hasAttribute('href', this.docLink, 'Doc link renders');
});
});