public function ElementTest::testPlaceHolderText in Drupal 10
Same name and namespace in other branches
- 8 core/modules/system/tests/src/Functional/Form/ElementTest.php \Drupal\Tests\system\Functional\Form\ElementTest::testPlaceHolderText()
- 9 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 30
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'));
}
}