Skip to content
代码片段 群组 项目
提交 dc0edd94 编辑于 作者: Justin Ho's avatar Justin Ho 提交者: Vitaly Slobodin
浏览文件

Fix help text for checkboxes on integrations form

Move the help text from FormGroup to FormCheckbox
to align with Pajamas recommendations.

Changelog: changed
上级 84a0d1e8
No related branches found
No related tags found
无相关合并请求
......@@ -153,7 +153,7 @@ export default {
:invalid-feedback="__('This field is required.')"
:state="valid"
>
<template #description>
<template v-if="!isCheckbox" #description>
<span v-safe-html:[$options.helpHtmlConfig]="help"></span>
</template>
......@@ -161,6 +161,9 @@ export default {
<input :name="fieldName" type="hidden" :value="model || false" />
<gl-form-checkbox :id="fieldId" v-model="model" :disabled="isInheriting">
{{ checkboxLabel || humanizedTitle }}
<template #help>
<span v-safe-html:[$options.helpHtmlConfig]="help"></span>
</template>
</gl-form-checkbox>
</template>
<template v-else-if="isSelect">
......
......@@ -61,7 +61,7 @@ describe('DynamicField', () => {
});
it(`renders GlFormCheckbox with correct text content when checkboxLabel is ${checkboxLabel}`, () => {
expect(findGlFormCheckbox().text()).toBe(checkboxLabel ?? defaultProps.title);
expect(findGlFormCheckbox().text()).toContain(checkboxLabel ?? defaultProps.title);
});
it('does not render other types of input', () => {
......@@ -182,6 +182,17 @@ describe('DynamicField', () => {
expect(findGlFormGroup().find('small').text()).toBe(defaultProps.help);
});
describe('when type is checkbox', () => {
it('renders description with help text', () => {
createComponent({
type: 'checkbox',
});
expect(findGlFormGroup().find('small').exists()).toBe(false);
expect(findGlFormCheckbox().text()).toContain(defaultProps.help);
});
});
it('renders description with help text as HTML', () => {
const helpHTML = 'The <strong>URL</strong> of the project';
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册