diff options
Diffstat (limited to 'spec/frontend/ci/ci_variable_list/components/ci_variable_modal_spec.js')
-rw-r--r-- | spec/frontend/ci/ci_variable_list/components/ci_variable_modal_spec.js | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/spec/frontend/ci/ci_variable_list/components/ci_variable_modal_spec.js b/spec/frontend/ci/ci_variable_list/components/ci_variable_modal_spec.js index b6ffde9b33f..e9484cfce57 100644 --- a/spec/frontend/ci/ci_variable_list/components/ci_variable_modal_spec.js +++ b/spec/frontend/ci/ci_variable_list/components/ci_variable_modal_spec.js @@ -458,7 +458,8 @@ describe('Ci variable modal', () => { }); describe('Validations', () => { - const maskError = 'This variable can not be masked.'; + const maskError = 'This variable value does not meet the masking requirements.'; + const helpText = 'Value must meet regular expression requirements to be masked.'; describe('when the variable is raw', () => { const [variable] = mockVariables; @@ -488,6 +489,25 @@ describe('Ci variable modal', () => { expect(findModal().text()).toContain(maskError); }); + + it('does not show the masked variable help text', () => { + expect(findModal().text()).not.toContain(helpText); + }); + }); + + describe('when the value is empty', () => { + beforeEach(() => { + const [variable] = mockVariables; + const emptyValueVariable = { ...variable, value: '' }; + createComponent({ + mountFn: mountExtended, + props: { selectedVariable: emptyValueVariable }, + }); + }); + + it('allows user to submit', () => { + expect(findAddorUpdateButton().attributes('disabled')).toBeUndefined(); + }); }); describe('when the mask state is invalid', () => { @@ -510,8 +530,9 @@ describe('Ci variable modal', () => { expect(findAddorUpdateButton().attributes('disabled')).toBeDefined(); }); - it('shows the correct error text', () => { + it('shows the correct error text and help text', () => { expect(findModal().text()).toContain(maskError); + expect(findModal().text()).toContain(helpText); }); it('sends the correct tracking event', () => { @@ -578,6 +599,10 @@ describe('Ci variable modal', () => { }); }); + it('shows the help text', () => { + expect(findModal().text()).toContain(helpText); + }); + it('does not disable the submit button', () => { expect(findAddorUpdateButton().attributes('disabled')).toBeUndefined(); }); |