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