Commit 9523a694 authored by Natalia Tepluhina's avatar Natalia Tepluhina

Merge branch 'vs/change-vue-emit-to-single-arg' into 'master'

Change $emit invoke to single argument

See merge request gitlab-org/gitlab!66997
parents 5c508333 8283e9e6
......@@ -93,7 +93,7 @@ export default {
...mapActions(['fetchDescendantGroups']),
onFormSubmit() {
const groupFullPath = this.selectedGroup?.full_path;
this.$emit('createEpicFormSubmit', this.inputValue.trim(), groupFullPath);
this.$emit('createEpicFormSubmit', { value: this.inputValue.trim(), groupFullPath });
},
onFormCancel() {
this.$emit('createEpicFormCancel');
......
......@@ -135,9 +135,9 @@ export default {
this.addItem();
}
},
handleCreateEpicFormSubmit(newValue, groupFullPath) {
handleCreateEpicFormSubmit({ value, groupFullPath }) {
this.createItem({
itemTitle: newValue,
itemTitle: value,
groupFullPath,
});
},
......
......@@ -112,7 +112,12 @@ describe('RelatedItemsTree', () => {
wrapper.vm.onFormSubmit();
expect(wrapper.emitted().createEpicFormSubmit).toBeTruthy();
expect(wrapper.emitted().createEpicFormSubmit[0]).toEqual([value, undefined]);
expect(wrapper.emitted().createEpicFormSubmit[0]).toEqual([
{
value,
groupFullPath: undefined,
},
]);
});
});
......
......@@ -134,10 +134,11 @@ describe('RelatedItemsTreeApp', () => {
const newValue = 'foo';
jest.spyOn(wrapper.vm, 'createItem').mockImplementation();
wrapper.vm.handleCreateEpicFormSubmit(newValue);
wrapper.vm.handleCreateEpicFormSubmit({ value: newValue });
expect(wrapper.vm.createItem).toHaveBeenCalledWith({
itemTitle: newValue,
groupFullPath: undefined,
});
});
});
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment