Commit 62f7c18d authored by Vitaly Slobodin's avatar Vitaly Slobodin

Merge branch '347459-align-checkbox-styling-in-integration-forms-with-pajamas' into 'master'

Fix help text for checkboxes on integrations form

See merge request gitlab-org/gitlab!77885
parents dab488f7 dc0edd94
...@@ -153,7 +153,7 @@ export default { ...@@ -153,7 +153,7 @@ export default {
:invalid-feedback="__('This field is required.')" :invalid-feedback="__('This field is required.')"
:state="valid" :state="valid"
> >
<template #description> <template v-if="!isCheckbox" #description>
<span v-safe-html:[$options.helpHtmlConfig]="help"></span> <span v-safe-html:[$options.helpHtmlConfig]="help"></span>
</template> </template>
...@@ -161,6 +161,9 @@ export default { ...@@ -161,6 +161,9 @@ export default {
<input :name="fieldName" type="hidden" :value="model || false" /> <input :name="fieldName" type="hidden" :value="model || false" />
<gl-form-checkbox :id="fieldId" v-model="model" :disabled="isInheriting"> <gl-form-checkbox :id="fieldId" v-model="model" :disabled="isInheriting">
{{ checkboxLabel || humanizedTitle }} {{ checkboxLabel || humanizedTitle }}
<template #help>
<span v-safe-html:[$options.helpHtmlConfig]="help"></span>
</template>
</gl-form-checkbox> </gl-form-checkbox>
</template> </template>
<template v-else-if="isSelect"> <template v-else-if="isSelect">
......
...@@ -61,7 +61,7 @@ describe('DynamicField', () => { ...@@ -61,7 +61,7 @@ describe('DynamicField', () => {
}); });
it(`renders GlFormCheckbox with correct text content when checkboxLabel is ${checkboxLabel}`, () => { 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', () => { it('does not render other types of input', () => {
...@@ -182,6 +182,17 @@ describe('DynamicField', () => { ...@@ -182,6 +182,17 @@ describe('DynamicField', () => {
expect(findGlFormGroup().find('small').text()).toBe(defaultProps.help); 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', () => { it('renders description with help text as HTML', () => {
const helpHTML = 'The <strong>URL</strong> of the project'; const helpHTML = 'The <strong>URL</strong> of the project';
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment