Commit 4375f39c authored by Natalia Tepluhina's avatar Natalia Tepluhina

Merge branch '329614-issue-due-date-changes-without-user-input' into 'master'

Resolve "Issue due date changes without user input"

See merge request gitlab-org/gitlab!60917
parents d2949e54 c753c7d9
......@@ -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