Skip to content

Commit

Permalink
Merge pull request #674 from ezsystems/adjust-dbp-tests
Browse files Browse the repository at this point in the history
[Behat] Adjust tests for inlined date picker
  • Loading branch information
Łukasz Serwatka authored Oct 8, 2018
2 parents d4f2356 + 86a2aec commit 0150c5a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/lib/Behat/PageElement/DateAndTimePopup.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ class DateAndTimePopup extends Element

private const DATETIME_FORMAT = 'm/d/Y, g:i:s a';

public function __construct(UtilityContext $context)
public function __construct(UtilityContext $context, bool $isInline = false)
{
parent::__construct($context);
$calendarSelector = $isInline ? '.flatpickr-calendar.inline' : '.flatpickr-calendar.open';
$this->fields = [
'openedCalendar' => '.flatpickr-calendar.open',
'openedCalendar' => $calendarSelector,
'pickerDaySelector' => '.flatpickr-day:not(.prevMonthDay):not(.nextMonthDay)',
'pickerDayValue' => 'aria-label',
'hourSelector' => '.flatpickr-hour',
Expand Down
6 changes: 5 additions & 1 deletion src/lib/Behat/PageElement/PlatformElementFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,11 @@ public static function createElement(UtilityContext $context, string $elementNam
case LanguagePicker::ELEMENT_NAME:
return new LanguagePicker($context);
case DateAndTimePopup::ELEMENT_NAME:
return new DateAndTimePopup($context);
if (!array_key_exists(0, $parameters)) {
return new DateAndTimePopup($context);
}

return new DateAndTimePopup($context, $parameters[0]);
case ContentTypePicker::ELEMENT_NAME:
return new ContentTypePicker($context);
case UniversalDiscoveryWidget::ELEMENT_NAME:
Expand Down

0 comments on commit 0150c5a

Please sign in to comment.