summaryrefslogtreecommitdiff
path: root/spec/frontend/pipeline_wizard/components/widgets/list_spec.js
diff options
context:
space:
mode:
Diffstat (limited to 'spec/frontend/pipeline_wizard/components/widgets/list_spec.js')
-rw-r--r--spec/frontend/pipeline_wizard/components/widgets/list_spec.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/frontend/pipeline_wizard/components/widgets/list_spec.js b/spec/frontend/pipeline_wizard/components/widgets/list_spec.js
index 796356634bc..c9e9f5caebe 100644
--- a/spec/frontend/pipeline_wizard/components/widgets/list_spec.js
+++ b/spec/frontend/pipeline_wizard/components/widgets/list_spec.js
@@ -22,6 +22,9 @@ describe('Pipeline Wizard - List Widget', () => {
const setValueOnInputField = (value, atIndex = 0) => {
return findGlFormInputGroupByIndex(atIndex).vm.$emit('input', value);
};
+ const getValueOfInputField = (atIndex = 0) => {
+ return findGlFormInputGroupByIndex(atIndex).get('input').element.value;
+ };
const findAddStepButton = () => wrapper.findByTestId('add-step-button');
const addStep = () => findAddStepButton().vm.$emit('click');
@@ -103,6 +106,24 @@ describe('Pipeline Wizard - List Widget', () => {
expect(addStepBtn.text()).toBe('add another step');
});
+ it('deletes the correct input item', async () => {
+ createComponent({}, mountExtended);
+
+ await addStep();
+ await addStep();
+ setValueOnInputField('foo', 0);
+ setValueOnInputField('bar', 1);
+ setValueOnInputField('baz', 2);
+
+ const button = findAllGlFormInputGroups().at(1).find('[data-testid="remove-step-button"]');
+
+ button.vm.$emit('click');
+ await nextTick();
+
+ expect(getValueOfInputField(0)).toBe('foo');
+ expect(getValueOfInputField(1)).toBe('baz');
+ });
+
it('the "add step" button increases the number of input fields', async () => {
createComponent();