public function HtmlTest::testHtmlClass in Drupal 10
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/Component/Utility/HtmlTest.php \Drupal\Tests\Component\Utility\HtmlTest::testHtmlClass()
- 9 core/tests/Drupal/Tests/Component/Utility/HtmlTest.php \Drupal\Tests\Component\Utility\HtmlTest::testHtmlClass()
Tests that Html::getClass() cleans the class name properly.
@coversDefaultClass ::getClass
File
- core/
tests/ Drupal/ Tests/ Component/ Utility/ HtmlTest.php, line 92
Class
Namespace
Drupal\Tests\Component\UtilityCode
public function testHtmlClass() {
// Verify Drupal coding standards are enforced.
$this
->assertSame('class-name--ü', Html::getClass('CLASS NAME_[Ü]'), 'Enforce Drupal coding standards.');
// Test Html::getClass() handles Drupal\Component\Render\MarkupInterface
// input.
$markup = HtmlTestMarkup::create('CLASS_FROM_OBJECT');
$this
->assertSame('class-from-object', Html::getClass($markup), 'Markup object is converted to CSS class.');
}