Commit f7fb7865 authored by Dhiraj Bodicherla's avatar Dhiraj Bodicherla

Fix datetimepicker hide button

Ref for the dropdown was removed in a previous
MR. This MR adds the ref back so the hide button
works again
parent 584f531d
...@@ -213,6 +213,7 @@ export default { ...@@ -213,6 +213,7 @@ export default {
class="d-inline-block" class="d-inline-block"
> >
<gl-deprecated-dropdown <gl-deprecated-dropdown
ref="dropdown"
:text="timeWindowText" :text="timeWindowText"
v-bind="$attrs" v-bind="$attrs"
class="date-time-picker w-100" class="date-time-picker w-100"
...@@ -250,7 +251,9 @@ export default { ...@@ -250,7 +251,9 @@ export default {
/> />
</div> </div>
<gl-form-group> <gl-form-group>
<gl-button @click="closeDropdown">{{ __('Cancel') }}</gl-button> <gl-button data-testid="cancelButton" @click="closeDropdown">{{
__('Cancel')
}}</gl-button>
<gl-button <gl-button
variant="success" variant="success"
category="primary" category="primary"
......
---
title: Fix broken date time picker hide button
merge_request: 39755
author:
type: fixed
...@@ -13,9 +13,9 @@ describe('DateTimePicker', () => { ...@@ -13,9 +13,9 @@ describe('DateTimePicker', () => {
const dropdownToggle = () => wrapper.find('.dropdown-toggle'); const dropdownToggle = () => wrapper.find('.dropdown-toggle');
const dropdownMenu = () => wrapper.find('.dropdown-menu'); const dropdownMenu = () => wrapper.find('.dropdown-menu');
const cancelButton = () => wrapper.find('[data-testid="cancelButton"]');
const applyButtonElement = () => wrapper.find('button.btn-success').element; const applyButtonElement = () => wrapper.find('button.btn-success').element;
const findQuickRangeItems = () => wrapper.findAll('.dropdown-item'); const findQuickRangeItems = () => wrapper.findAll('.dropdown-item');
const cancelButtonElement = () => wrapper.find('button.btn-secondary').element;
const createComponent = props => { const createComponent = props => {
wrapper = mount(DateTimePicker, { wrapper = mount(DateTimePicker, {
...@@ -260,7 +260,7 @@ describe('DateTimePicker', () => { ...@@ -260,7 +260,7 @@ describe('DateTimePicker', () => {
dropdownToggle().trigger('click'); dropdownToggle().trigger('click');
return wrapper.vm.$nextTick(() => { return wrapper.vm.$nextTick(() => {
cancelButtonElement().click(); cancelButton().trigger('click');
return wrapper.vm.$nextTick(() => { return wrapper.vm.$nextTick(() => {
expect(dropdownMenu().classes('show')).toBe(false); expect(dropdownMenu().classes('show')).toBe(false);
......
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