You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ant-design-vue/components/date-picker/__tests__/utils.js

36 lines
1017 B

/* eslint-disable import/prefer-default-export */
export function $$(className) {
return document.body.querySelectorAll(className);
}
export function hasSelected(wrapper, date) {
return document.body
.querySelector(`[title="${date.format('LL')}"][role="gridcell"]`)
.getAttribute('class')
.split(' ')
.includes('ant-calendar-selected-day');
}
export function openPanel(wrapper) {
wrapper.find('.ant-calendar-picker-input').trigger('click');
}
export function clearInput(wrapper) {
wrapper.find('.ant-calendar-picker-clear').trigger('click');
}
export function nextYear() {
$$('.ant-calendar-next-year-btn')[0].click();
}
export function nextMonth() {
$$('.ant-calendar-next-month-btn')[0].click();
}
export function selectDateFromBody(date, index) {
let calendar = document.body;
if (index !== undefined) {
calendar = document.body.querySelectorAll('.ant-calendar-range-part')[index];
}
calendar.querySelector(`[title="${date.format('LL')}"][role="gridcell"]`).click();
}