Commit 57570cb7 authored by Nicolò Maria Mezzopera's avatar Nicolò Maria Mezzopera Committed by Olena Horal-Koretska

Rename expiration textarea to expiration input

- source
- tests
- wiring
parent e43b258a
<script> <script>
import { GlFormGroup, GlFormTextarea, GlSprintf, GlLink } from '@gitlab/ui'; import { GlFormGroup, GlFormInput, GlSprintf, GlLink } from '@gitlab/ui';
import { NAME_REGEX_LENGTH, TEXT_AREA_INVALID_FEEDBACK } from '../constants'; import { NAME_REGEX_LENGTH, TEXT_AREA_INVALID_FEEDBACK } from '../constants';
export default { export default {
components: { components: {
GlFormGroup, GlFormGroup,
GlFormTextarea, GlFormInput,
GlSprintf, GlSprintf,
GlLink, GlLink,
}, },
...@@ -48,7 +48,7 @@ export default { ...@@ -48,7 +48,7 @@ export default {
textAreaLengthErrorMessage() { textAreaLengthErrorMessage() {
return this.isInputValid(this.value) ? '' : TEXT_AREA_INVALID_FEEDBACK; return this.isInputValid(this.value) ? '' : TEXT_AREA_INVALID_FEEDBACK;
}, },
textAreaValidation() { inputValidation() {
const nameRegexErrors = this.error || this.textAreaLengthErrorMessage; const nameRegexErrors = this.error || this.textAreaLengthErrorMessage;
return { return {
state: nameRegexErrors === null ? null : !nameRegexErrors, state: nameRegexErrors === null ? null : !nameRegexErrors,
...@@ -77,8 +77,8 @@ export default { ...@@ -77,8 +77,8 @@ export default {
<gl-form-group <gl-form-group
:id="`${name}-form-group`" :id="`${name}-form-group`"
:label-for="name" :label-for="name"
:state="textAreaValidation.state" :state="inputValidation.state"
:invalid-feedback="textAreaValidation.message" :invalid-feedback="inputValidation.message"
> >
<template #label> <template #label>
<span data-testid="label"> <span data-testid="label">
...@@ -89,11 +89,11 @@ export default { ...@@ -89,11 +89,11 @@ export default {
</gl-sprintf> </gl-sprintf>
</span> </span>
</template> </template>
<gl-form-textarea <gl-form-input
:id="name" :id="name"
v-model="internalValue" v-model="internalValue"
:placeholder="placeholder" :placeholder="placeholder"
:state="textAreaValidation.state" :state="inputValidation.state"
:disabled="disabled" :disabled="disabled"
trim trim
/> />
......
...@@ -13,6 +13,16 @@ export default { ...@@ -13,6 +13,16 @@ export default {
required: false, required: false,
default: NOT_SCHEDULED_POLICY_TEXT, default: NOT_SCHEDULED_POLICY_TEXT,
}, },
enabled: {
type: Boolean,
required: false,
default: false,
},
},
computed: {
parsedValue() {
return this.enabled ? this.value : NOT_SCHEDULED_POLICY_TEXT;
},
}, },
i18n: { i18n: {
NEXT_CLEANUP_LABEL, NEXT_CLEANUP_LABEL,
...@@ -26,6 +36,11 @@ export default { ...@@ -26,6 +36,11 @@ export default {
:label="$options.i18n.NEXT_CLEANUP_LABEL" :label="$options.i18n.NEXT_CLEANUP_LABEL"
label-for="expiration-policy-info-text" label-for="expiration-policy-info-text"
> >
<gl-form-input id="expiration-policy-info-text" class="gl-pl-0!" plaintext :value="value" /> <gl-form-input
id="expiration-policy-info-text"
class="gl-pl-0!"
plaintext
:value="parsedValue"
/>
</gl-form-group> </gl-form-group>
</template> </template>
<script> <script>
import { GlFormGroup, GlToggle, GlSprintf } from '@gitlab/ui'; import { GlFormGroup, GlToggle, GlSprintf } from '@gitlab/ui';
import { ENABLED_TEXT, DISABLED_TEXT, ENABLE_TOGGLE_DESCRIPTION } from '../constants'; import { ENABLED_TOGGLE_DESCRIPTION, DISABLED_TOGGLE_DESCRIPTION } from '../constants';
export default { export default {
components: { components: {
...@@ -20,9 +20,6 @@ export default { ...@@ -20,9 +20,6 @@ export default {
default: false, default: false,
}, },
}, },
i18n: {
ENABLE_TOGGLE_DESCRIPTION,
},
computed: { computed: {
enabled: { enabled: {
get() { get() {
...@@ -32,8 +29,8 @@ export default { ...@@ -32,8 +29,8 @@ export default {
this.$emit('input', value); this.$emit('input', value);
}, },
}, },
toggleStatusText() { toggleText() {
return this.enabled ? ENABLED_TEXT : DISABLED_TEXT; return this.enabled ? ENABLED_TOGGLE_DESCRIPTION : DISABLED_TOGGLE_DESCRIPTION;
}, },
}, },
}; };
...@@ -44,9 +41,9 @@ export default { ...@@ -44,9 +41,9 @@ export default {
<div class="gl-display-flex"> <div class="gl-display-flex">
<gl-toggle id="expiration-policy-toggle" v-model="enabled" :disabled="disabled" /> <gl-toggle id="expiration-policy-toggle" v-model="enabled" :disabled="disabled" />
<span class="gl-ml-5 gl-line-height-24" data-testid="description"> <span class="gl-ml-5 gl-line-height-24" data-testid="description">
<gl-sprintf :message="$options.i18n.ENABLE_TOGGLE_DESCRIPTION"> <gl-sprintf :message="toggleText">
<template #toggleStatus> <template #strong="{content}">
<strong>{{ toggleStatusText }}</strong> <strong>{{ content }}</strong>
</template> </template>
</gl-sprintf> </gl-sprintf>
</span> </span>
......
...@@ -25,7 +25,7 @@ import { formOptionsGenerator } from '~/registry/shared/utils'; ...@@ -25,7 +25,7 @@ import { formOptionsGenerator } from '~/registry/shared/utils';
import updateContainerExpirationPolicyMutation from '~/registry/settings/graphql/mutations/update_container_expiration_policy.graphql'; import updateContainerExpirationPolicyMutation from '~/registry/settings/graphql/mutations/update_container_expiration_policy.graphql';
import { updateContainerExpirationPolicy } from '~/registry/settings/graphql/utils/cache_update'; import { updateContainerExpirationPolicy } from '~/registry/settings/graphql/utils/cache_update';
import ExpirationDropdown from './expiration_dropdown.vue'; import ExpirationDropdown from './expiration_dropdown.vue';
import ExpirationTextarea from './expiration_textarea.vue'; import ExpirationInput from './expiration_input.vue';
import ExpirationToggle from './expiration_toggle.vue'; import ExpirationToggle from './expiration_toggle.vue';
import ExpirationRunText from './expiration_run_text.vue'; import ExpirationRunText from './expiration_run_text.vue';
...@@ -35,7 +35,7 @@ export default { ...@@ -35,7 +35,7 @@ export default {
GlButton, GlButton,
GlSprintf, GlSprintf,
ExpirationDropdown, ExpirationDropdown,
ExpirationTextarea, ExpirationInput,
ExpirationToggle, ExpirationToggle,
ExpirationRunText, ExpirationRunText,
}, },
...@@ -202,7 +202,11 @@ export default { ...@@ -202,7 +202,11 @@ export default {
data-testid="cadence-dropdown" data-testid="cadence-dropdown"
@input="onModelChange($event, 'cadence')" @input="onModelChange($event, 'cadence')"
/> />
<expiration-run-text :value="prefilledForm.nextRunAt" class="gl-mb-0!" /> <expiration-run-text
:value="prefilledForm.nextRunAt"
:enabled="prefilledForm.enabled"
class="gl-mb-0!"
/>
</div> </div>
<gl-card class="gl-mt-7"> <gl-card class="gl-mt-7">
<template #header> <template #header>
...@@ -229,14 +233,14 @@ export default { ...@@ -229,14 +233,14 @@ export default {
data-testid="keep-n-dropdown" data-testid="keep-n-dropdown"
@input="onModelChange($event, 'keepN')" @input="onModelChange($event, 'keepN')"
/> />
<expiration-textarea <expiration-input
v-model="prefilledForm.nameRegexKeep" v-model="prefilledForm.nameRegexKeep"
:error="apiErrors.nameRegexKeep" :error="apiErrors.nameRegexKeep"
:disabled="isFieldDisabled" :disabled="isFieldDisabled"
:label="$options.i18n.NAME_REGEX_KEEP_LABEL" :label="$options.i18n.NAME_REGEX_KEEP_LABEL"
:description="$options.i18n.NAME_REGEX_KEEP_DESCRIPTION" :description="$options.i18n.NAME_REGEX_KEEP_DESCRIPTION"
name="keep-regex" name="keep-regex"
data-testid="keep-regex-textarea" data-testid="keep-regex-input"
@input="onModelChange($event, 'nameRegexKeep')" @input="onModelChange($event, 'nameRegexKeep')"
@validation="setLocalErrors($event, 'nameRegexKeep')" @validation="setLocalErrors($event, 'nameRegexKeep')"
/> />
...@@ -268,7 +272,7 @@ export default { ...@@ -268,7 +272,7 @@ export default {
data-testid="older-than-dropdown" data-testid="older-than-dropdown"
@input="onModelChange($event, 'olderThan')" @input="onModelChange($event, 'olderThan')"
/> />
<expiration-textarea <expiration-input
v-model="prefilledForm.nameRegex" v-model="prefilledForm.nameRegex"
:error="apiErrors.nameRegex" :error="apiErrors.nameRegex"
:disabled="isFieldDisabled" :disabled="isFieldDisabled"
...@@ -276,7 +280,7 @@ export default { ...@@ -276,7 +280,7 @@ export default {
:placeholder="$options.i18n.NAME_REGEX_PLACEHOLDER" :placeholder="$options.i18n.NAME_REGEX_PLACEHOLDER"
:description="$options.i18n.NAME_REGEX_DESCRIPTION" :description="$options.i18n.NAME_REGEX_DESCRIPTION"
name="remove-regex" name="remove-regex"
data-testid="remove-regex-textarea" data-testid="remove-regex-input"
@input="onModelChange($event, 'nameRegex')" @input="onModelChange($event, 'nameRegex')"
@validation="setLocalErrors($event, 'nameRegex')" @validation="setLocalErrors($event, 'nameRegex')"
/> />
......
...@@ -37,11 +37,11 @@ export const NAME_REGEX_DESCRIPTION = s__( ...@@ -37,11 +37,11 @@ export const NAME_REGEX_DESCRIPTION = s__(
'ContainerRegistry|Tags with names that match this regex pattern are removed. %{linkStart}More information%{linkEnd}', 'ContainerRegistry|Tags with names that match this regex pattern are removed. %{linkStart}More information%{linkEnd}',
); );
export const ENABLED_TEXT = __('Enabled'); export const ENABLED_TOGGLE_DESCRIPTION = s__(
export const DISABLED_TEXT = __('Disabled'); 'ContainerRegistry|%{strongStart}Enabled%{strongEnd} - Tags that match the rules on this page are automatically scheduled for deletion.',
);
export const ENABLE_TOGGLE_DESCRIPTION = s__( export const DISABLED_TOGGLE_DESCRIPTION = s__(
'ContainerRegistry|%{toggleStatus} - Tags that match the rules on this page are automatically scheduled for deletion.', 'ContainerRegistry|%{strongStart}Disabled%{strongEnd} - Tags will not be automatically deleted.',
); );
export const CADENCE_LABEL = s__('ContainerRegistry|Run cleanup:'); export const CADENCE_LABEL = s__('ContainerRegistry|Run cleanup:');
......
...@@ -7273,13 +7273,16 @@ msgstr[1] "" ...@@ -7273,13 +7273,16 @@ msgstr[1] ""
msgid "ContainerRegistry|%{imageName} tags" msgid "ContainerRegistry|%{imageName} tags"
msgstr "" msgstr ""
msgid "ContainerRegistry|%{title} was successfully scheduled for deletion" msgid "ContainerRegistry|%{strongStart}Disabled%{strongEnd} - Tags will not be automatically deleted."
msgstr "" msgstr ""
msgid "ContainerRegistry|%{toggleStatus} - Tags matching the patterns defined below will be scheduled for deletion" msgid "ContainerRegistry|%{strongStart}Enabled%{strongEnd} - Tags that match the rules on this page are automatically scheduled for deletion."
msgstr ""
msgid "ContainerRegistry|%{title} was successfully scheduled for deletion"
msgstr "" msgstr ""
msgid "ContainerRegistry|%{toggleStatus} - Tags that match the rules on this page are automatically scheduled for deletion." msgid "ContainerRegistry|%{toggleStatus} - Tags matching the patterns defined below will be scheduled for deletion"
msgstr "" msgstr ""
msgid "ContainerRegistry|Build an image" msgid "ContainerRegistry|Build an image"
......
...@@ -84,7 +84,7 @@ RSpec.describe 'Project > Settings > CI/CD > Container registry tag expiration p ...@@ -84,7 +84,7 @@ RSpec.describe 'Project > Settings > CI/CD > Container registry tag expiration p
within '#js-registry-policies' do within '#js-registry-policies' do
case result case result
when :available_section when :available_section
expect(find('[data-testid="enable-toggle"]')).to have_content('Tags that match the rules on this page are automatically scheduled for deletion.') expect(find('[data-testid="enable-toggle"]')).to have_content('Disabled - Tags will not be automatically deleted.')
when :disabled_message when :disabled_message
expect(find('.gl-alert-title')).to have_content('Cleanup policy for tags is disabled') expect(find('.gl-alert-title')).to have_content('Cleanup policy for tags is disabled')
end end
......
...@@ -30,8 +30,8 @@ exports[`Settings Form Keep N matches snapshot 1`] = ` ...@@ -30,8 +30,8 @@ exports[`Settings Form Keep N matches snapshot 1`] = `
`; `;
exports[`Settings Form Keep Regex matches snapshot 1`] = ` exports[`Settings Form Keep Regex matches snapshot 1`] = `
<expiration-textarea-stub <expiration-input-stub
data-testid="keep-regex-textarea" data-testid="keep-regex-input"
description="Tags with names that match this regex pattern are kept. %{linkStart}More information%{linkEnd}" description="Tags with names that match this regex pattern are kept. %{linkStart}More information%{linkEnd}"
error="" error=""
label="Keep tags matching:" label="Keep tags matching:"
...@@ -52,8 +52,8 @@ exports[`Settings Form OlderThan matches snapshot 1`] = ` ...@@ -52,8 +52,8 @@ exports[`Settings Form OlderThan matches snapshot 1`] = `
`; `;
exports[`Settings Form Remove regex matches snapshot 1`] = ` exports[`Settings Form Remove regex matches snapshot 1`] = `
<expiration-textarea-stub <expiration-input-stub
data-testid="remove-regex-textarea" data-testid="remove-regex-input"
description="Tags with names that match this regex pattern are removed. %{linkStart}More information%{linkEnd}" description="Tags with names that match this regex pattern are removed. %{linkStart}More information%{linkEnd}"
error="" error=""
label="Remove tags matching:" label="Remove tags matching:"
......
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import { GlSprintf, GlFormTextarea, GlLink } from '@gitlab/ui'; import { GlSprintf, GlFormInput, GlLink } from '@gitlab/ui';
import { GlFormGroup } from 'jest/registry/shared/stubs'; import { GlFormGroup } from 'jest/registry/shared/stubs';
import component from '~/registry/settings/components/expiration_textarea.vue'; import component from '~/registry/settings/components/expiration_input.vue';
import { NAME_REGEX_LENGTH } from '~/registry/shared/constants'; import { NAME_REGEX_LENGTH } from '~/registry/shared/constants';
describe('ExpirationTextarea', () => { describe('ExpirationInput', () => {
let wrapper; let wrapper;
const defaultProps = { const defaultProps = {
...@@ -16,7 +16,7 @@ describe('ExpirationTextarea', () => { ...@@ -16,7 +16,7 @@ describe('ExpirationTextarea', () => {
const tagsRegexHelpPagePath = 'fooPath'; const tagsRegexHelpPagePath = 'fooPath';
const findTextArea = () => wrapper.find(GlFormTextarea); const findInput = () => wrapper.find(GlFormInput);
const findFormGroup = () => wrapper.find(GlFormGroup); const findFormGroup = () => wrapper.find(GlFormGroup);
const findLabel = () => wrapper.find('[data-testid="label"]'); const findLabel = () => wrapper.find('[data-testid="label"]');
const findDescription = () => wrapper.find('[data-testid="description"]'); const findDescription = () => wrapper.find('[data-testid="description"]');
...@@ -53,7 +53,7 @@ describe('ExpirationTextarea', () => { ...@@ -53,7 +53,7 @@ describe('ExpirationTextarea', () => {
it('has a textarea component', () => { it('has a textarea component', () => {
mountComponent(); mountComponent();
expect(findTextArea().exists()).toBe(true); expect(findInput().exists()).toBe(true);
}); });
it('has a description', () => { it('has a description', () => {
...@@ -78,7 +78,7 @@ describe('ExpirationTextarea', () => { ...@@ -78,7 +78,7 @@ describe('ExpirationTextarea', () => {
mountComponent({ value, disabled }); mountComponent({ value, disabled });
expect(findTextArea().attributes()).toMatchObject({ expect(findInput().attributes()).toMatchObject({
id: defaultProps.name, id: defaultProps.name,
value, value,
placeholder: defaultProps.placeholder, placeholder: defaultProps.placeholder,
...@@ -92,7 +92,7 @@ describe('ExpirationTextarea', () => { ...@@ -92,7 +92,7 @@ describe('ExpirationTextarea', () => {
mountComponent(); mountComponent();
findTextArea().vm.$emit('input', emittedValue); findInput().vm.$emit('input', emittedValue);
expect(wrapper.emitted('input')).toEqual([[emittedValue]]); expect(wrapper.emitted('input')).toEqual([[emittedValue]]);
}); });
}); });
...@@ -141,12 +141,12 @@ describe('ExpirationTextarea', () => { ...@@ -141,12 +141,12 @@ describe('ExpirationTextarea', () => {
// since the component has no state we both emit the event and set the prop // since the component has no state we both emit the event and set the prop
mountComponent({ value: invalidString }); mountComponent({ value: invalidString });
findTextArea().vm.$emit('input', invalidString); findInput().vm.$emit('input', invalidString);
}); });
it('textAreaValidation state is false', () => { it('textAreaValidation state is false', () => {
expect(findFormGroup().props('state')).toBe(false); expect(findFormGroup().props('state')).toBe(false);
expect(findTextArea().attributes('state')).toBeUndefined(); expect(findInput().attributes('state')).toBeUndefined();
}); });
it('emits the @validation event with false payload', () => { it('emits the @validation event with false payload', () => {
...@@ -157,10 +157,10 @@ describe('ExpirationTextarea', () => { ...@@ -157,10 +157,10 @@ describe('ExpirationTextarea', () => {
it(`when user input is less than ${NAME_REGEX_LENGTH} state is "true"`, () => { it(`when user input is less than ${NAME_REGEX_LENGTH} state is "true"`, () => {
mountComponent(); mountComponent();
findTextArea().vm.$emit('input', 'foo'); findInput().vm.$emit('input', 'foo');
expect(findFormGroup().props('state')).toBe(true); expect(findFormGroup().props('state')).toBe(true);
expect(findTextArea().attributes('state')).toBe('true'); expect(findInput().attributes('state')).toBe('true');
expect(wrapper.emitted('validation')).toEqual([[true]]); expect(wrapper.emitted('validation')).toEqual([[true]]);
}); });
}); });
......
...@@ -28,19 +28,12 @@ describe('ExpirationToggle', () => { ...@@ -28,19 +28,12 @@ describe('ExpirationToggle', () => {
describe('structure', () => { describe('structure', () => {
it('has an input component', () => { it('has an input component', () => {
mountComponent(); mountComponent();
expect(findInput().exists()).toBe(true); expect(findInput().exists()).toBe(true);
}); });
}); });
describe('model', () => { describe('model', () => {
it('assigns the right props to the input component', () => {
mountComponent({ value, disabled: true });
expect(findInput().attributes()).toMatchObject({
value,
});
});
it('assigns the right props to the form-group component', () => { it('assigns the right props to the form-group component', () => {
mountComponent(); mountComponent();
...@@ -51,16 +44,19 @@ describe('ExpirationToggle', () => { ...@@ -51,16 +44,19 @@ describe('ExpirationToggle', () => {
}); });
describe('formattedValue', () => { describe('formattedValue', () => {
it('displays the values when it exists', () => { it.each`
mountComponent({ value }); valueProp | enabled | expected
${value} | ${true} | ${value}
expect(findInput().attributes('value')).toBe(value); ${value} | ${false} | ${NOT_SCHEDULED_POLICY_TEXT}
}); ${undefined} | ${false} | ${NOT_SCHEDULED_POLICY_TEXT}
${undefined} | ${true} | ${NOT_SCHEDULED_POLICY_TEXT}
it('displays a placeholder when no value is present', () => { `(
mountComponent(); 'when value is $valueProp and enabled is $enabled the input value is $expected',
({ valueProp, enabled, expected }) => {
expect(findInput().attributes('value')).toBe(NOT_SCHEDULED_POLICY_TEXT); mountComponent({ value: valueProp, enabled });
});
expect(findInput().attributes('value')).toBe(expected);
},
);
}); });
}); });
...@@ -3,9 +3,8 @@ import { GlToggle, GlSprintf } from '@gitlab/ui'; ...@@ -3,9 +3,8 @@ import { GlToggle, GlSprintf } from '@gitlab/ui';
import { GlFormGroup } from 'jest/registry/shared/stubs'; import { GlFormGroup } from 'jest/registry/shared/stubs';
import component from '~/registry/settings/components/expiration_toggle.vue'; import component from '~/registry/settings/components/expiration_toggle.vue';
import { import {
ENABLE_TOGGLE_DESCRIPTION, ENABLED_TOGGLE_DESCRIPTION,
ENABLED_TEXT, DISABLED_TOGGLE_DESCRIPTION,
DISABLED_TEXT,
} from '~/registry/settings/constants'; } from '~/registry/settings/constants';
describe('ExpirationToggle', () => { describe('ExpirationToggle', () => {
...@@ -39,9 +38,7 @@ describe('ExpirationToggle', () => { ...@@ -39,9 +38,7 @@ describe('ExpirationToggle', () => {
it('has a description', () => { it('has a description', () => {
mountComponent(); mountComponent();
expect(findDescription().text()).toContain( expect(findDescription().exists()).toBe(true);
ENABLE_TOGGLE_DESCRIPTION.replace('%{toggleStatus}', ''),
);
}); });
}); });
...@@ -68,13 +65,13 @@ describe('ExpirationToggle', () => { ...@@ -68,13 +65,13 @@ describe('ExpirationToggle', () => {
it('says enabled when the toggle is on', () => { it('says enabled when the toggle is on', () => {
mountComponent({ value: true }); mountComponent({ value: true });
expect(findDescription().text()).toContain(ENABLED_TEXT); expect(findDescription().text()).toMatchInterpolatedText(ENABLED_TOGGLE_DESCRIPTION);
}); });
it('says disabled when the toggle is off', () => { it('says disabled when the toggle is off', () => {
mountComponent({ value: false }); mountComponent({ value: false });
expect(findDescription().text()).toContain(DISABLED_TEXT); expect(findDescription().text()).toMatchInterpolatedText(DISABLED_TOGGLE_DESCRIPTION);
}); });
}); });
}); });
...@@ -44,9 +44,9 @@ describe('Settings Form', () => { ...@@ -44,9 +44,9 @@ describe('Settings Form', () => {
const findEnableToggle = () => wrapper.find('[data-testid="enable-toggle"]'); const findEnableToggle = () => wrapper.find('[data-testid="enable-toggle"]');
const findCadenceDropdown = () => wrapper.find('[data-testid="cadence-dropdown"]'); const findCadenceDropdown = () => wrapper.find('[data-testid="cadence-dropdown"]');
const findKeepNDropdown = () => wrapper.find('[data-testid="keep-n-dropdown"]'); const findKeepNDropdown = () => wrapper.find('[data-testid="keep-n-dropdown"]');
const findKeepRegexTextarea = () => wrapper.find('[data-testid="keep-regex-textarea"]'); const findKeepRegexInput = () => wrapper.find('[data-testid="keep-regex-input"]');
const findOlderThanDropdown = () => wrapper.find('[data-testid="older-than-dropdown"]'); const findOlderThanDropdown = () => wrapper.find('[data-testid="older-than-dropdown"]');
const findRemoveRegexTextarea = () => wrapper.find('[data-testid="remove-regex-textarea"]'); const findRemoveRegexInput = () => wrapper.find('[data-testid="remove-regex-input"]');
const mountComponent = ({ const mountComponent = ({
props = defaultProps, props = defaultProps,
...@@ -119,9 +119,9 @@ describe('Settings Form', () => { ...@@ -119,9 +119,9 @@ describe('Settings Form', () => {
${'enabled'} | ${findEnableToggle} | ${'Enable'} | ${'toggle'} | ${false} ${'enabled'} | ${findEnableToggle} | ${'Enable'} | ${'toggle'} | ${false}
${'cadence'} | ${findCadenceDropdown} | ${'Cadence'} | ${'dropdown'} | ${'EVERY_DAY'} ${'cadence'} | ${findCadenceDropdown} | ${'Cadence'} | ${'dropdown'} | ${'EVERY_DAY'}
${'keepN'} | ${findKeepNDropdown} | ${'Keep N'} | ${'dropdown'} | ${'TEN_TAGS'} ${'keepN'} | ${findKeepNDropdown} | ${'Keep N'} | ${'dropdown'} | ${'TEN_TAGS'}
${'nameRegexKeep'} | ${findKeepRegexTextarea} | ${'Keep Regex'} | ${'textarea'} | ${''} ${'nameRegexKeep'} | ${findKeepRegexInput} | ${'Keep Regex'} | ${'textarea'} | ${''}
${'olderThan'} | ${findOlderThanDropdown} | ${'OlderThan'} | ${'dropdown'} | ${'NINETY_DAYS'} ${'olderThan'} | ${findOlderThanDropdown} | ${'OlderThan'} | ${'dropdown'} | ${'NINETY_DAYS'}
${'nameRegex'} | ${findRemoveRegexTextarea} | ${'Remove regex'} | ${'textarea'} | ${''} ${'nameRegex'} | ${findRemoveRegexInput} | ${'Remove regex'} | ${'textarea'} | ${''}
`('$fieldName', ({ model, finder, type, defaultValue }) => { `('$fieldName', ({ model, finder, type, defaultValue }) => {
it('matches snapshot', () => { it('matches snapshot', () => {
mountComponent(); mountComponent();
...@@ -240,8 +240,8 @@ describe('Settings Form', () => { ...@@ -240,8 +240,8 @@ describe('Settings Form', () => {
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
expect(findKeepRegexTextarea().props('error')).toBe(''); expect(findKeepRegexInput().props('error')).toBe('');
expect(findRemoveRegexTextarea().props('error')).toBe(''); expect(findRemoveRegexInput().props('error')).toBe('');
expect(findSaveButton().props('disabled')).toBe(false); expect(findSaveButton().props('disabled')).toBe(false);
}); });
}); });
...@@ -338,7 +338,7 @@ describe('Settings Form', () => { ...@@ -338,7 +338,7 @@ describe('Settings Form', () => {
await waitForPromises(); await waitForPromises();
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
expect(findKeepRegexTextarea().props('error')).toEqual('baz'); expect(findKeepRegexInput().props('error')).toEqual('baz');
}); });
}); });
}); });
......
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