Commit bdee86ca authored by Jose Ivan Vargas's avatar Jose Ivan Vargas

Merge branch '332305-reuse-participants-widget-in-epic-sidebar' into 'master'

Migrate epic sidebar participants to widget

See merge request gitlab-org/gitlab!68438
parents 73eb2f38 5d219e52
...@@ -56,6 +56,11 @@ export default { ...@@ -56,6 +56,11 @@ export default {
return this.$apollo.queries.participants.loading; return this.$apollo.queries.participants.loading;
}, },
}, },
methods: {
toggleSidebar() {
this.$emit('toggleSidebar');
},
},
}; };
</script> </script>
...@@ -66,5 +71,6 @@ export default { ...@@ -66,5 +71,6 @@ export default {
:number-of-less-participants="7" :number-of-less-participants="7"
:lazy="false" :lazy="false"
class="block participants" class="block participants"
@toggleSidebar="toggleSidebar"
/> />
</template> </template>
...@@ -8,7 +8,7 @@ import { convertToGraphQLId } from '~/graphql_shared/utils'; ...@@ -8,7 +8,7 @@ import { convertToGraphQLId } from '~/graphql_shared/utils';
import { IssuableType } from '~/issue_show/constants'; import { IssuableType } from '~/issue_show/constants';
import notesEventHub from '~/notes/event_hub'; import notesEventHub from '~/notes/event_hub';
import SidebarConfidentialityWidget from '~/sidebar/components/confidential/sidebar_confidentiality_widget.vue'; import SidebarConfidentialityWidget from '~/sidebar/components/confidential/sidebar_confidentiality_widget.vue';
import SidebarParticipants from '~/sidebar/components/participants/participants.vue'; import SidebarParticipantsWidget from '~/sidebar/components/participants/sidebar_participants_widget.vue';
import SidebarReferenceWidget from '~/sidebar/components/reference/sidebar_reference_widget.vue'; import SidebarReferenceWidget from '~/sidebar/components/reference/sidebar_reference_widget.vue';
import SidebarSubscriptionsWidget from '~/sidebar/components/subscriptions/sidebar_subscriptions_widget.vue'; import SidebarSubscriptionsWidget from '~/sidebar/components/subscriptions/sidebar_subscriptions_widget.vue';
import SidebarTodoWidget from '~/sidebar/components/todo_toggle/sidebar_todo_widget.vue'; import SidebarTodoWidget from '~/sidebar/components/todo_toggle/sidebar_todo_widget.vue';
...@@ -29,7 +29,7 @@ export default { ...@@ -29,7 +29,7 @@ export default {
SidebarDatePickerCollapsed, SidebarDatePickerCollapsed,
SidebarLabels, SidebarLabels,
SidebarAncestorsWidget, SidebarAncestorsWidget,
SidebarParticipants, SidebarParticipantsWidget,
SidebarConfidentialityWidget, SidebarConfidentialityWidget,
SidebarSubscriptionsWidget, SidebarSubscriptionsWidget,
SidebarReferenceWidget, SidebarReferenceWidget,
...@@ -46,7 +46,6 @@ export default { ...@@ -46,7 +46,6 @@ export default {
'canUpdate', 'canUpdate',
'allowSubEpics', 'allowSubEpics',
'sidebarCollapsed', 'sidebarCollapsed',
'participants',
'startDateSourcingMilestoneTitle', 'startDateSourcingMilestoneTitle',
'startDateSourcingMilestoneDates', 'startDateSourcingMilestoneDates',
'startDateIsFixed', 'startDateIsFixed',
...@@ -251,12 +250,12 @@ export default { ...@@ -251,12 +250,12 @@ export default {
:full-path="fullPath" :full-path="fullPath"
:issuable-type="issuableType" :issuable-type="issuableType"
/> />
<div class="block participants"> <sidebar-participants-widget
<sidebar-participants :iid="String(iid)"
:participants="participants" :full-path="fullPath"
@toggleSidebar="toggleSidebar({ sidebarCollapsed })" :issuable-type="issuableType"
/> @toggleSidebar="handleSidebarToggle"
</div> />
<sidebar-subscriptions-widget <sidebar-subscriptions-widget
:iid="String(iid)" :iid="String(iid)"
:full-path="fullPath" :full-path="fullPath"
......
...@@ -12,6 +12,7 @@ import SidebarAncestorsWidget from 'ee_component/sidebar/components/ancestors_tr ...@@ -12,6 +12,7 @@ import SidebarAncestorsWidget from 'ee_component/sidebar/components/ancestors_tr
import { parsePikadayDate } from '~/lib/utils/datetime_utility'; import { parsePikadayDate } from '~/lib/utils/datetime_utility';
import SidebarParticipantsWidget from '~/sidebar/components/participants/sidebar_participants_widget.vue';
import SidebarReferenceWidget from '~/sidebar/components/reference/sidebar_reference_widget.vue'; import SidebarReferenceWidget from '~/sidebar/components/reference/sidebar_reference_widget.vue';
import SidebarSubscriptionsWidget from '~/sidebar/components/subscriptions/sidebar_subscriptions_widget.vue'; import SidebarSubscriptionsWidget from '~/sidebar/components/subscriptions/sidebar_subscriptions_widget.vue';
import SidebarTodoWidget from '~/sidebar/components/todo_toggle/sidebar_todo_widget.vue'; import SidebarTodoWidget from '~/sidebar/components/todo_toggle/sidebar_todo_widget.vue';
...@@ -242,8 +243,8 @@ describe('EpicSidebarComponent', () => { ...@@ -242,8 +243,8 @@ describe('EpicSidebarComponent', () => {
}); });
}); });
it('renders participants list element', () => { it('renders participants widget', () => {
expect(wrapper.find('.block.participants').exists()).toBe(true); expect(wrapper.findComponent(SidebarParticipantsWidget).exists()).toBe(true);
}); });
it('renders subscription toggle element', () => { it('renders subscription toggle element', () => {
......
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import Vue from 'vue'; import Vue, { nextTick } from 'vue';
import VueApollo from 'vue-apollo'; import VueApollo from 'vue-apollo';
import createMockApollo from 'helpers/mock_apollo_helper'; import createMockApollo from 'helpers/mock_apollo_helper';
import waitForPromises from 'helpers/wait_for_promises'; import waitForPromises from 'helpers/wait_for_promises';
...@@ -45,6 +45,14 @@ describe('Sidebar Participants Widget', () => { ...@@ -45,6 +45,14 @@ describe('Sidebar Participants Widget', () => {
expect(findParticipants().props('loading')).toBe(true); expect(findParticipants().props('loading')).toBe(true);
}); });
it('emits toggleSidebar event when participants child component emits toggleSidebar', async () => {
createComponent();
findParticipants().vm.$emit('toggleSidebar');
await nextTick();
expect(wrapper.emitted('toggleSidebar')).toEqual([[]]);
});
describe('when participants are loaded', () => { describe('when participants are loaded', () => {
beforeEach(() => { beforeEach(() => {
createComponent({ createComponent({
......
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