Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
registerAsyncHelper('calendarSelect', async function(app, selector, selected) {
return calendarSelect(selector, selected);
});
}
async value(dateOrMoments) {
assert(
'selectDates expects an array of date or moment objects as frist argument',
isArray(dateOrMoments) && dateOrMoments.every((dateOrMoment) => dateOrMoment instanceof Date || moment.isMoment(dateOrMoment))
)
for (let i = 0; i < dateOrMoments.length; i++) {
let dateOrMoment = dateOrMoments[i];
let date = moment.isMoment(dateOrMoment) ? dateOrMoment.toDate() : dateOrMoment;
await calendarSelect(selector, date);
}
}
};
registerAsyncHelper('datepickerSelect', async function(app, selector, selected) {
assert('`datepickerSelect` expect a Date or MomentJS object as second argument', selected);
let $selector = find(selector);
assert('`datepickerSelect` couln\'t find any element with selector: ' + selector, $selector.length);
let $trigger;
if ($selector.hasClass('ember-power-datepicker-trigger')) {
$trigger = $selector;
} else {
$trigger = find(`${selector} .ember-power-datepicker-trigger`);
assert('`datepickerSelect` couln\'t find any datepicker within the selector ' + selector, $trigger.length);
selector = `${selector} .ember-power-datepicker-trigger`;
}
await clickTrigger(selector);
await calendarSelect('.ember-power-datepicker-content', selected);
});
}