function FilterPlaceholderTextTest::testPlaceholderText
Same name in other branches
- 9 core/modules/views/tests/src/Functional/Handler/FilterPlaceholderTextTest.php \Drupal\Tests\views\Functional\Handler\FilterPlaceholderTextTest::testPlaceholderText()
- 10 core/modules/views/tests/src/Functional/Handler/FilterPlaceholderTextTest.php \Drupal\Tests\views\Functional\Handler\FilterPlaceholderTextTest::testPlaceholderText()
- 11.x core/modules/views/tests/src/Functional/Handler/FilterPlaceholderTextTest.php \Drupal\Tests\views\Functional\Handler\FilterPlaceholderTextTest::testPlaceholderText()
Tests that HTML placeholders are added, when appropriate.
File
-
core/
modules/ views/ tests/ src/ Functional/ Handler/ FilterPlaceholderTextTest.php, line 34
Class
- FilterPlaceholderTextTest
- Tests the placeholder text on the appropriate filter handlers.
Namespace
Drupal\Tests\views\Functional\HandlerCode
public function testPlaceholderText() {
$this->drupalGet('placeholder-text-test');
// String filter that has no placeholder configured.
$results = $this->cssSelect('input[name=title]');
$this->assertFalse($results[0]->hasAttribute('placeholder'));
// String filter that has placeholder configured.
$results = $this->cssSelect('input[name=title_with_placeholder]');
$this->assertTrue($results[0]->hasAttribute('placeholder'));
$this->assertEquals('title placeholder', $results[0]->getAttribute('placeholder'));
// Numeric filter that has no placeholders configured.
$results = $this->cssSelect('input[name="created[value]"]');
$this->assertFalse($results[0]->hasAttribute('placeholder'));
$results = $this->cssSelect('input[name="created[min]"]');
$this->assertFalse($results[0]->hasAttribute('placeholder'));
$results = $this->cssSelect('input[name="created[max]"]');
$this->assertFalse($results[0]->hasAttribute('placeholder'));
// Numeric filter that has all placeholders configured.
$results = $this->cssSelect('input[name="created_with_placeholders[value]"]');
$this->assertTrue($results[0]->hasAttribute('placeholder'));
$this->assertEquals('created placeholder', $results[0]->getAttribute('placeholder'));
$results = $this->cssSelect('input[name="created_with_placeholders[min]"]');
$this->assertTrue($results[0]->hasAttribute('placeholder'));
$this->assertEquals('min placeholder', $results[0]->getAttribute('placeholder'));
$results = $this->cssSelect('input[name="created_with_placeholders[max]"]');
$this->assertTrue($results[0]->hasAttribute('placeholder'));
$this->assertEquals('max placeholder', $results[0]->getAttribute('placeholder'));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.