diff --git a/app/assets/javascripts/ci/ci_variable_list/components/ci_variable_drawer.vue b/app/assets/javascripts/ci/ci_variable_list/components/ci_variable_drawer.vue index 55f1bac06d9da5bd8a9f92a2d96f633bcd641a4d..30bbee76de73f1bd1c2156dda656e96b6eddfb54 100644 --- a/app/assets/javascripts/ci/ci_variable_list/components/ci_variable_drawer.vue +++ b/app/assets/javascripts/ci/ci_variable_list/components/ci_variable_drawer.vue @@ -188,7 +188,7 @@ export default { return { isMutationAlertVisible: false, variable: { ...defaultVariableState, ...this.selectedVariable }, - visibility: VISIBILITY_VISIBLE, + visibility: VISIBILITY_MASKED, trackedValidationErrorProperty: undefined, }; }, @@ -403,7 +403,7 @@ export default { resetForm() { this.variable = { ...this.defaultVariableState }; - this.visibility = VISIBILITY_VISIBLE; + this.visibility = VISIBILITY_MASKED; }, setEnvironmentScope(scope) { this.variable = { ...this.variable, environmentScope: scope }; diff --git a/app/assets/javascripts/ci/ci_variable_list/constants.js b/app/assets/javascripts/ci/ci_variable_list/constants.js index 21faa7e6115788f739c265107db9dad8fbf72760..3966489e3c166c25d7ef5311e654338802f12fd5 100644 --- a/app/assets/javascripts/ci/ci_variable_list/constants.js +++ b/app/assets/javascripts/ci/ci_variable_list/constants.js @@ -32,7 +32,7 @@ export const defaultVariableState = { description: null, environmentScope: '*', key: '', - masked: false, + masked: true, hidden: false, protected: false, raw: false, diff --git a/spec/frontend/ci/ci_variable_list/components/ci_variable_drawer_spec.js b/spec/frontend/ci/ci_variable_list/components/ci_variable_drawer_spec.js index f4798affa717e90bf72252a3a4ba66574a02b393..93cbd2d2b2310add37e7c137d6bf4508ca1ea3a5 100644 --- a/spec/frontend/ci/ci_variable_list/components/ci_variable_drawer_spec.js +++ b/spec/frontend/ci/ci_variable_list/components/ci_variable_drawer_spec.js @@ -392,8 +392,8 @@ describe('CI Variable Drawer', () => { createComponent({ props: { areHiddenVariablesAvailable: true } }); }); - it('is set to visible by default', () => { - expect(findVisibilityRadioGroup().attributes('checked')).toBe(VISIBILITY_VISIBLE); + it('is set to masked by default', () => { + expect(findVisibilityRadioGroup().attributes('checked')).toBe(VISIBILITY_MASKED); }); it.each` @@ -423,16 +423,15 @@ describe('CI Variable Drawer', () => { props: { selectedVariable: { ...mockProjectVariableFileType, - masked: true, - hidden: true, + masked: false, }, }, }); - expect(findVisibilityRadioGroup().attributes('checked')).toBe(VISIBILITY_HIDDEN); + expect(findVisibilityRadioGroup().attributes('checked')).toBe(VISIBILITY_VISIBLE); await wrapper.setProps({ mutationResponse: { message: 'Success', hasError: false } }); - expect(findVisibilityRadioGroup().attributes('checked')).toBe(VISIBILITY_VISIBLE); + expect(findVisibilityRadioGroup().attributes('checked')).toBe(VISIBILITY_MASKED); }); }); diff --git a/spec/support/shared_examples/features/variable_list_drawer_shared_examples.rb b/spec/support/shared_examples/features/variable_list_drawer_shared_examples.rb index 19751bdf27d17a42a81f935eb067ea6643810b40..e07d4d8d487c7cc5ee3d992b554b9a1ae32a2e78 100644 --- a/spec/support/shared_examples/features/variable_list_drawer_shared_examples.rb +++ b/spec/support/shared_examples/features/variable_list_drawer_shared_examples.rb @@ -50,7 +50,7 @@ end end - it 'defaults to unmasked, expanded' do + it 'defaults to masked, expanded' do open_drawer fill_variable('NEW_KEY') @@ -61,7 +61,7 @@ page.within('[data-testid="ci-variable-table"]') do key_column = first(".js-ci-variable-row:nth-child(1) td[data-label='#{s_('CiVariables|Key')}']") - expect(key_column).not_to have_content(s_('CiVariables|Masked')) + expect(key_column).to have_content(s_('CiVariables|Masked')) expect(key_column).to have_content(s_('CiVariables|Expanded')) end end