Commit 355fcccc authored by Florie Guibert's avatar Florie Guibert

Update widget on click dropdown item when creating epic from epic

parent d1a3567e
......@@ -49,7 +49,8 @@ export default {
triggerEvent() {
this.$emit(this.selectedItem.eventName);
},
change(item) {
changeSelectedItem(item) {
this.selectedItem = item;
this.$emit('change', item);
},
},
......@@ -70,10 +71,7 @@ export default {
:key="item.eventName"
:active="selectedItem === item"
active-class="is-active"
@click="
selectedItem = item;
change(item);
"
@click="changeSelectedItem(item)"
>
<strong>{{ item.title }}</strong>
<div>{{ item.description }}</div>
......
......@@ -74,6 +74,7 @@ describe('SplitButton', () => {
describe('emitted event', () => {
let eventHandler;
let changeEventHandler;
beforeEach(() => {
createComponent({ actionItems: mockActionItems });
......@@ -84,6 +85,11 @@ describe('SplitButton', () => {
wrapper.vm.$once(eventName, () => eventHandler());
};
const addChangeEventHandler = () => {
changeEventHandler = jest.fn();
wrapper.vm.$once('change', () => changeEventHandler());
};
it('defaults to first actionItems event', () => {
addEventHandler(mockActionItems[0]);
......@@ -99,5 +105,13 @@ describe('SplitButton', () => {
.then(() => {
expect(eventHandler).toHaveBeenCalled();
}));
it('change to selected actionItem emits change event', () => {
addChangeEventHandler();
return selectItem(1).then(() => {
expect(changeEventHandler).toHaveBeenCalled();
});
});
});
});
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