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