public function validateForm(array &
$form, FormStateInterface
$form_state) {} /**
* Ensures maxlength attribute can be used in compatible elements.
*/
public function testAttributes() { /** @var \Drupal\Core\Form\FormBuilderInterface $form_builder */
$form_builder =
$this->container->
get('form_builder'
);
$form_state =
new FormState();
$elements =
$form_builder->
buildForm($this,
$form_state);
$this->
render($elements);
$css_selector_converter =
new CssSelectorConverter();
$elements =
$this->
xpath($css_selector_converter->
toXPath('input[name=title][maxlength=255]'
));
$this->
assertCount(1,
$elements, 'Text field has correct maxlength in form.'
);
$elements =
$this->
xpath($css_selector_converter->
toXPath('textarea[name=description][maxlength=255]'
));
$this->
assertCount(1,
$elements, 'Textarea field has correct maxlength in form.'
);
}}