Remove description from profiles selector

Updates the dropdown input to support labels without a description, and
removes the description from the scanner profile selector in the API
Fuzzing configuration form.
parent bd820dc0
...@@ -105,7 +105,6 @@ export default { ...@@ -105,7 +105,6 @@ export default {
scanProfile: { scanProfile: {
field: 'scanProfile', field: 'scanProfile',
label: s__('APIFuzzing|Scan profile'), label: s__('APIFuzzing|Scan profile'),
description: 'Pre-defined profiles by GitLab.',
value: '', value: '',
defaultText: s__('APIFuzzing|Choose a profile'), defaultText: s__('APIFuzzing|Choose a profile'),
sectionHeader: s__('APIFuzzing|Predefined profiles'), sectionHeader: s__('APIFuzzing|Predefined profiles'),
......
...@@ -52,7 +52,8 @@ export default { ...@@ -52,7 +52,8 @@ export default {
}, },
description: { description: {
type: String, type: String,
required: true, required: false,
default: '',
}, },
disabled: { disabled: {
type: Boolean, type: Boolean,
...@@ -97,7 +98,9 @@ export default { ...@@ -97,7 +98,9 @@ export default {
<gl-form-group :label-for="field"> <gl-form-group :label-for="field">
<template #label> <template #label>
{{ label }} {{ label }}
<gl-form-text class="gl-mt-3">{{ description }}</gl-form-text> <gl-form-text v-if="description" class="gl-mt-3" data-testid="dropdown-input-description">{{
description
}}</gl-form-text>
</template> </template>
<gl-dropdown :id="field" :text="text" :disabled="disabled"> <gl-dropdown :id="field" :text="text" :disabled="disabled">
......
...@@ -38,6 +38,8 @@ describe('DropdownInput component', () => { ...@@ -38,6 +38,8 @@ describe('DropdownInput component', () => {
const findToggle = () => wrapper.find('button'); const findToggle = () => wrapper.find('button');
const findLabel = () => wrapper.find('label'); const findLabel = () => wrapper.find('label');
const findDescription = () =>
wrapper.find('label').find('[data-testid="dropdown-input-description"]');
const findInputComponent = () => wrapper.find(GlDropdown); const findInputComponent = () => wrapper.find(GlDropdown);
const findRestoreDefaultLink = () => wrapper.find(GlLink); const findRestoreDefaultLink = () => wrapper.find(GlLink);
const findSectionHeader = () => wrapper.findByTestId('dropdown-input-section-header'); const findSectionHeader = () => wrapper.findByTestId('dropdown-input-section-header');
...@@ -48,18 +50,37 @@ describe('DropdownInput component', () => { ...@@ -48,18 +50,37 @@ describe('DropdownInput component', () => {
}); });
describe('label', () => { describe('label', () => {
beforeEach(() => { describe('with a description', () => {
createComponent({ beforeEach(() => {
props: testProps, createComponent({
props: testProps,
});
});
it('renders the label', () => {
expect(findLabel().text()).toContain(testProps.label);
}); });
});
it('renders the label', () => { it('renders the description', () => {
expect(findLabel().text()).toContain(testProps.label); const description = findDescription();
expect(description.exists()).toBe(true);
expect(description.text()).toBe(testProps.description);
});
}); });
it('renders the description', () => { describe('without a description', () => {
expect(findLabel().text()).toContain(testProps.description); beforeEach(() => {
createComponent({
props: { ...testProps, description: '' },
});
});
it('does not render the description', () => {
const description = findDescription();
expect(description.exists()).toBe(false);
});
}); });
}); });
......
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