Commit c753c7d9 authored by Eulyeon Ko's avatar Eulyeon Ko Committed by Natalia Tepluhina

Resolve "Issue due date changes without user input"

parent 7ab25364
......@@ -284,7 +284,7 @@ export default {
<gl-datepicker
ref="datePicker"
class="gl-relative"
:value="parsedDate"
:default-date="parsedDate"
show-clear-button
@input="setDate"
@clear="setDate(null)"
......
---
title: Fix due date being randomly set in issue page
merge_request: 60917
author:
type: fixed
import { GlDatepicker } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils';
import Vue from 'vue';
import VueApollo from 'vue-apollo';
......@@ -23,6 +24,7 @@ describe('Sidebar date Widget', () => {
const findEditableItem = () => wrapper.findComponent(SidebarEditableItem);
const findPopoverIcon = () => wrapper.find('[data-testid="inherit-date-popover"]');
const findDatePicker = () => wrapper.find(GlDatepicker);
const createComponent = ({
dueDateQueryHandler = jest.fn().mockResolvedValue(issuableDueDateResponse()),
......@@ -50,6 +52,7 @@ describe('Sidebar date Widget', () => {
},
stubs: {
SidebarEditableItem,
GlDatepicker,
},
});
};
......@@ -109,6 +112,11 @@ describe('Sidebar date Widget', () => {
it('emits `dueDateUpdated` event with the date payload', () => {
expect(wrapper.emitted('dueDateUpdated')).toEqual([[date]]);
});
it('uses a correct prop to set the initial date for GlDatePicker', () => {
expect(findDatePicker().props('value')).toBe(null);
expect(findDatePicker().props('defaultDate')).toEqual(wrapper.vm.parsedDate);
});
});
it.each`
......
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