function ElementTest::testPlaceHolderText
Same name in other branches
- 8.9.x core/modules/system/tests/src/Functional/Form/ElementTest.php \Drupal\Tests\system\Functional\Form\ElementTest::testPlaceHolderText()
- 10 core/modules/system/tests/src/Functional/Form/ElementTest.php \Drupal\Tests\system\Functional\Form\ElementTest::testPlaceHolderText()
- 11.x core/modules/system/tests/src/Functional/Form/ElementTest.php \Drupal\Tests\system\Functional\Form\ElementTest::testPlaceHolderText()
Tests placeholder text for elements that support placeholders.
File
-
core/
modules/ system/ tests/ src/ Functional/ Form/ ElementTest.php, line 29
Class
- ElementTest
- Tests building and processing of core form elements.
Namespace
Drupal\Tests\system\Functional\FormCode
public function testPlaceHolderText() {
$this->drupalGet('form-test/placeholder-text');
foreach ([
'textfield',
'tel',
'url',
'password',
'email',
'number',
'textarea',
] as $type) {
$field = $this->assertSession()
->fieldExists("edit-{$type}");
$this->assertSame('placeholder-text', $field->getAttribute('placeholder'));
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.