// the description is placed after the form element.
$field_id = 'edit-form-textfield-test-description-invisible';
$description_id =
$field_id . '--description';
// Verify that the #description element is visually-hidden.
$this->
assertSession()->
elementExists('xpath', '//input[@id="' .
$field_id . '" and @aria-describedby="' .
$description_id . '"]/following-sibling::div[contains(@class, "visually-hidden")]'
);
} /**
* Tests forms in theme-less environments.
*/
public function testFormsInThemeLessEnvironments() { $form =
$this->
getFormWithLimitedProperties();
$render_service =
$this->container->
get('renderer'
);
// This should not throw any notices.
$render_service->
renderPlain($form);
} /**
* Return a form with element with not all properties defined.
*/
protected function getFormWithLimitedProperties() { $form =
[];