diff options
Diffstat (limited to 'spec/javascripts/ci_variable_list/ci_variable_list_spec.js')
-rw-r--r-- | spec/javascripts/ci_variable_list/ci_variable_list_spec.js | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/spec/javascripts/ci_variable_list/ci_variable_list_spec.js b/spec/javascripts/ci_variable_list/ci_variable_list_spec.js index 2fa50975f0f..30b15011def 100644 --- a/spec/javascripts/ci_variable_list/ci_variable_list_spec.js +++ b/spec/javascripts/ci_variable_list/ci_variable_list_spec.js @@ -33,7 +33,8 @@ describe('VariableList', () => { it('should add another row when editing the last rows key input', () => { const $row = $wrapper.find('.js-row'); - $row.find('.js-ci-variable-input-key') + $row + .find('.js-ci-variable-input-key') .val('foo') .trigger('input'); @@ -41,12 +42,14 @@ describe('VariableList', () => { // Check for the correct default in the new row const $keyInput = $wrapper.find('.js-row:last-child').find('.js-ci-variable-input-key'); + expect($keyInput.val()).toBe(''); }); it('should add another row when editing the last rows value textarea', () => { const $row = $wrapper.find('.js-row'); - $row.find('.js-ci-variable-input-value') + $row + .find('.js-ci-variable-input-value') .val('foo') .trigger('input'); @@ -54,18 +57,21 @@ describe('VariableList', () => { // Check for the correct default in the new row const $valueInput = $wrapper.find('.js-row:last-child').find('.js-ci-variable-input-key'); + expect($valueInput.val()).toBe(''); }); it('should remove empty row after blurring', () => { const $row = $wrapper.find('.js-row'); - $row.find('.js-ci-variable-input-key') + $row + .find('.js-ci-variable-input-key') .val('foo') .trigger('input'); expect($wrapper.find('.js-row').length).toBe(2); - $row.find('.js-ci-variable-input-key') + $row + .find('.js-ci-variable-input-key') .val('') .trigger('input') .trigger('blur'); @@ -119,7 +125,7 @@ describe('VariableList', () => { variableList.init(); }); - it('should add another row when editing the last rows protected checkbox', (done) => { + it('should add another row when editing the last rows protected checkbox', done => { const $row = $wrapper.find('.js-row:last-child'); $row.find('.ci-variable-protected-item .js-project-feature-toggle').click(); @@ -128,7 +134,10 @@ describe('VariableList', () => { expect($wrapper.find('.js-row').length).toBe(2); // 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('false'); }) .then(done) @@ -166,6 +175,7 @@ describe('VariableList', () => { it('should enable all remove buttons', () => { variableList.toggleEnableRow(false); + expect($wrapper.find('.js-row-remove-button[disabled]').length).toBe(3); variableList.toggleEnableRow(true); @@ -175,6 +185,7 @@ describe('VariableList', () => { it('should enable all key inputs', () => { variableList.toggleEnableRow(false); + expect($wrapper.find('.js-ci-variable-input-key[disabled]').length).toBe(3); variableList.toggleEnableRow(true); @@ -200,7 +211,8 @@ describe('VariableList', () => { const $inputValue = $row.find('.js-ci-variable-input-value'); const $placeholder = $row.find('.js-secret-value-placeholder'); - $row.find('.js-ci-variable-input-value') + $row + .find('.js-ci-variable-input-value') .val('foo') .trigger('input'); |