Commit 8283e9e6 authored by Vitaly Slobodin's avatar Vitaly Slobodin

Change $emit invoke to single argument

parent d0c3ad98
......@@ -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