Commit 0cc572cb authored by Tim Zallmann's avatar Tim Zallmann

Merge branch...

Merge branch '119341-automatically-update-widget-when-creating-a-new-epic-or-issue-from-an-epic' into 'master'

Update widget on click dropdown item when creating epic from epic

See merge request gitlab-org/gitlab!22511
parents 52f0557e 61e4c229
...@@ -49,6 +49,10 @@ export default { ...@@ -49,6 +49,10 @@ export default {
triggerEvent() { triggerEvent() {
this.$emit(this.selectedItem.eventName); this.$emit(this.selectedItem.eventName);
}, },
changeSelectedItem(item) {
this.selectedItem = item;
this.$emit('change', item);
},
}, },
}; };
</script> </script>
...@@ -67,7 +71,7 @@ export default { ...@@ -67,7 +71,7 @@ export default {
:key="item.eventName" :key="item.eventName"
:active="selectedItem === item" :active="selectedItem === item"
active-class="is-active" active-class="is-active"
@click="selectedItem = item" @click="changeSelectedItem(item)"
> >
<strong>{{ item.title }}</strong> <strong>{{ item.title }}</strong>
<div>{{ item.description }}</div> <div>{{ item.description }}</div>
......
...@@ -22,6 +22,11 @@ export default { ...@@ -22,6 +22,11 @@ export default {
components: { components: {
SplitButton, SplitButton,
}, },
methods: {
change(item) {
this.$emit(item.eventName);
},
},
}; };
</script> </script>
...@@ -33,5 +38,6 @@ export default { ...@@ -33,5 +38,6 @@ export default {
right right
size="sm" size="sm"
v-on="$listeners" v-on="$listeners"
@change="change"
/> />
</template> </template>
...@@ -22,6 +22,11 @@ export default { ...@@ -22,6 +22,11 @@ export default {
components: { components: {
SplitButton, SplitButton,
}, },
methods: {
change(item) {
this.$emit(item.eventName);
},
},
}; };
</script> </script>
...@@ -33,5 +38,6 @@ export default { ...@@ -33,5 +38,6 @@ export default {
right right
size="sm" size="sm"
v-on="$listeners" v-on="$listeners"
@change="change"
/> />
</template> </template>
---
title: Update widget on click dropdown item when creating epic from epic
merge_request: 22511
author:
type: fixed
...@@ -98,6 +98,15 @@ describe 'Epic Issues', :js do ...@@ -98,6 +98,15 @@ describe 'Epic Issues', :js do
visit_epic visit_epic
end end
it 'user can display create new epic form by clicking the dropdown item' do
expect(page).not_to have_selector('input[placeholder="New epic title"]')
find('.related-items-tree-container .js-add-epics-button .dropdown-toggle').click
find('.related-items-tree-container .js-add-epics-button .dropdown-item', text: 'Create new epic').click
expect(page).to have_selector('input[placeholder="New epic title"]')
end
it 'user can see all issues of the group and delete the associations' do it 'user can see all issues of the group and delete the associations' do
within('.related-items-tree-container ul.related-items-list') do within('.related-items-tree-container ul.related-items-list') do
expect(page).to have_selector('li.js-item-type-issue', count: 2) expect(page).to have_selector('li.js-item-type-issue', count: 2)
......
...@@ -74,6 +74,7 @@ describe('SplitButton', () => { ...@@ -74,6 +74,7 @@ describe('SplitButton', () => {
describe('emitted event', () => { describe('emitted event', () => {
let eventHandler; let eventHandler;
let changeEventHandler;
beforeEach(() => { beforeEach(() => {
createComponent({ actionItems: mockActionItems }); createComponent({ actionItems: mockActionItems });
...@@ -84,6 +85,11 @@ describe('SplitButton', () => { ...@@ -84,6 +85,11 @@ describe('SplitButton', () => {
wrapper.vm.$once(eventName, () => eventHandler()); wrapper.vm.$once(eventName, () => eventHandler());
}; };
const addChangeEventHandler = () => {
changeEventHandler = jest.fn();
wrapper.vm.$once('change', item => changeEventHandler(item));
};
it('defaults to first actionItems event', () => { it('defaults to first actionItems event', () => {
addEventHandler(mockActionItems[0]); addEventHandler(mockActionItems[0]);
...@@ -99,5 +105,13 @@ describe('SplitButton', () => { ...@@ -99,5 +105,13 @@ describe('SplitButton', () => {
.then(() => { .then(() => {
expect(eventHandler).toHaveBeenCalled(); expect(eventHandler).toHaveBeenCalled();
})); }));
it('change to selected actionItem emits change event', () => {
addChangeEventHandler();
return selectItem(1).then(() => {
expect(changeEventHandler).toHaveBeenCalledWith(mockActionItems[1]);
});
});
}); });
}); });
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