public function testDateField() { $field_name =
$this->fieldStorage->
getName();
$display_repository = \Drupal::
service('entity_display.repository'
);
// Loop through defined timezones to test that date-only fields work at the
// extremes.
foreach (static::
$timezones as $timezone) { $this->
setSiteTimezone($timezone);
$this->
assertEquals($timezone,
$this->
config('system.date'
)->
get('timezone.default'
), 'Time zone set to ' .
$timezone);
// Display creation form.
$this->
drupalGet('entity_test/add'
);
$this->
assertSession()->
fieldValueEquals("{
$field_name}[0][value][date]", ''
);
$this->
assertSession()->
elementExists('xpath', '//*[@id="edit-' .
$field_name . '-wrapper"]//label[contains(@class,"js-form-required")]'
);
$this->
assertSession()->
fieldNotExists("{
$field_name}[0][value][time]"
);
// ARIA described-by.
$this->
assertSession()->
elementExists('xpath', '//input[@aria-describedby="edit-' .
$field_name . '-0-value--description"]'
);
$this->
assertSession()->
elementExists('xpath', '//div[@id="edit-' .
$field_name . '-0-value--description"]'
);