Commit 646e50c4 authored by Florie Guibert's avatar Florie Guibert

Migrate epic sidebar todo button to widget

Review feedback
parent 455b0ca1
......@@ -174,7 +174,7 @@ export default {
<div class="issuable-sidebar js-issuable-update">
<sidebar-header :sidebar-collapsed="sidebarCollapsed">
<sidebar-todo-widget
v-show="isUserSignedIn"
v-if="isUserSignedIn"
:issuable-id="fullEpicId"
:issuable-iid="String(iid)"
:full-path="fullPath"
......
......@@ -178,14 +178,6 @@ describe('EpicSidebarComponent', () => {
expect(wrapper.find('.issuable-sidebar.js-issuable-update').exists()).toBe(true);
});
it('renders Todo toggle button element when sidebar is collapsed and user is signed in', async () => {
store.dispatch('toggleSidebarFlag', true);
await nextTick();
expect(wrapper.find('[data-testid="todo"]').exists()).toBe(true);
});
it('renders Start date & Due date elements when sidebar is expanded', async () => {
wrapper.vm.$store.dispatch('toggleSidebarFlag', false);
......@@ -215,8 +207,15 @@ describe('EpicSidebarComponent', () => {
expect(wrapper.find(SidebarSubscriptionsWidget).exists()).toBe(true);
});
it('renders SidebarTodoWidget', () => {
expect(wrapper.find(SidebarTodoWidget).exists()).toBe(true);
it('renders SidebarTodoWidget when user is signed in', () => {
const todoWidget = wrapper.find(SidebarTodoWidget);
expect(todoWidget.exists()).toBe(true);
expect(todoWidget.props()).toMatchObject({
issuableId: 'gid://gitlab/Epic/1',
issuableIid: '1',
fullPath: 'frontend-fixtures-group',
issuableType: 'epic',
});
});
it('renders SidebarReferenceWidget', () => {
......@@ -259,6 +258,16 @@ describe('EpicSidebarComponent', () => {
});
});
describe('when user is not signed in', () => {
beforeEach(() => {
gon.current_user_id = null;
});
it('does not render SidebarTodoWidget', () => {
expect(wrapper.find(SidebarTodoWidget).exists()).toBe(false);
});
});
describe('mounted', () => {
it('makes request to get epic details', () => {
const actionSpies = {
......
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