Default CI variables to unprotected
See https://gitlab.com/gitlab-org/gitlab-ce/issues/42928
This commit is contained in:
parent
dbb934c8e2
commit
b60a39f260
4 changed files with 7 additions and 7 deletions
|
@ -39,7 +39,7 @@ export default class VariableList {
|
||||||
},
|
},
|
||||||
protected: {
|
protected: {
|
||||||
selector: '.js-ci-variable-input-protected',
|
selector: '.js-ci-variable-input-protected',
|
||||||
default: 'true',
|
default: 'false',
|
||||||
},
|
},
|
||||||
environment_scope: {
|
environment_scope: {
|
||||||
// We can't use a `.js-` class here because
|
// We can't use a `.js-` class here because
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
- id = variable&.id
|
- id = variable&.id
|
||||||
- key = variable&.key
|
- key = variable&.key
|
||||||
- value = variable&.value
|
- value = variable&.value
|
||||||
- is_protected = variable && !only_key_value ? variable.protected : true
|
- is_protected = variable && !only_key_value ? variable.protected : false
|
||||||
|
|
||||||
- id_input_name = "#{form_field}[variables_attributes][][id]"
|
- id_input_name = "#{form_field}[variables_attributes][][id]"
|
||||||
- destroy_input_name = "#{form_field}[variables_attributes][][_destroy]"
|
- destroy_input_name = "#{form_field}[variables_attributes][][_destroy]"
|
||||||
|
|
|
@ -126,7 +126,7 @@ describe('VariableList', () => {
|
||||||
|
|
||||||
// Check for the correct default in the new row
|
// Check for the correct default in the new row
|
||||||
const $protectedInput = $wrapper.find('.js-row:last-child').find('.js-ci-variable-input-protected');
|
const $protectedInput = $wrapper.find('.js-row:last-child').find('.js-ci-variable-input-protected');
|
||||||
expect($protectedInput.val()).toBe('true');
|
expect($protectedInput.val()).toBe('false');
|
||||||
})
|
})
|
||||||
.then(done)
|
.then(done)
|
||||||
.catch(done.fail);
|
.catch(done.fail);
|
||||||
|
|
|
@ -41,13 +41,13 @@ shared_examples 'variable list' do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'adds new unprotected variable' do
|
it 'adds new protected variable' do
|
||||||
page.within('.js-ci-variable-list-section .js-row:last-child') do
|
page.within('.js-ci-variable-list-section .js-row:last-child') do
|
||||||
find('.js-ci-variable-input-key').set('key')
|
find('.js-ci-variable-input-key').set('key')
|
||||||
find('.js-ci-variable-input-value').set('key value')
|
find('.js-ci-variable-input-value').set('key value')
|
||||||
find('.ci-variable-protected-item .js-project-feature-toggle').click
|
find('.ci-variable-protected-item .js-project-feature-toggle').click
|
||||||
|
|
||||||
expect(find('.js-ci-variable-input-protected', visible: false).value).to eq('false')
|
expect(find('.js-ci-variable-input-protected', visible: false).value).to eq('true')
|
||||||
end
|
end
|
||||||
|
|
||||||
click_button('Save variables')
|
click_button('Save variables')
|
||||||
|
@ -59,7 +59,7 @@ shared_examples 'variable list' do
|
||||||
page.within('.js-ci-variable-list-section .js-row:nth-child(1)') do
|
page.within('.js-ci-variable-list-section .js-row:nth-child(1)') do
|
||||||
expect(find('.js-ci-variable-input-key').value).to eq('key')
|
expect(find('.js-ci-variable-input-key').value).to eq('key')
|
||||||
expect(find('.js-ci-variable-input-value', visible: false).value).to eq('key value')
|
expect(find('.js-ci-variable-input-value', visible: false).value).to eq('key value')
|
||||||
expect(find('.js-ci-variable-input-protected', visible: false).value).to eq('false')
|
expect(find('.js-ci-variable-input-protected', visible: false).value).to eq('true')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -143,7 +143,6 @@ shared_examples 'variable list' do
|
||||||
page.within('.js-ci-variable-list-section .js-row:last-child') do
|
page.within('.js-ci-variable-list-section .js-row:last-child') do
|
||||||
find('.js-ci-variable-input-key').set('unprotected_key')
|
find('.js-ci-variable-input-key').set('unprotected_key')
|
||||||
find('.js-ci-variable-input-value').set('unprotected_value')
|
find('.js-ci-variable-input-value').set('unprotected_value')
|
||||||
find('.ci-variable-protected-item .js-project-feature-toggle').click
|
|
||||||
|
|
||||||
expect(find('.js-ci-variable-input-protected', visible: false).value).to eq('false')
|
expect(find('.js-ci-variable-input-protected', visible: false).value).to eq('false')
|
||||||
end
|
end
|
||||||
|
@ -178,6 +177,7 @@ shared_examples 'variable list' do
|
||||||
page.within('.js-ci-variable-list-section .js-row:last-child') do
|
page.within('.js-ci-variable-list-section .js-row:last-child') do
|
||||||
find('.js-ci-variable-input-key').set('protected_key')
|
find('.js-ci-variable-input-key').set('protected_key')
|
||||||
find('.js-ci-variable-input-value').set('protected_value')
|
find('.js-ci-variable-input-value').set('protected_value')
|
||||||
|
find('.ci-variable-protected-item .js-project-feature-toggle').click
|
||||||
|
|
||||||
expect(find('.js-ci-variable-input-protected', visible: false).value).to eq('true')
|
expect(find('.js-ci-variable-input-protected', visible: false).value).to eq('true')
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue