3 namespace Drupal\Tests\system\Functional\Theme;
5 use Drupal\Tests\BrowserTestBase;
8 * Tests attributes inserted in the 'html' and 'body' elements on the page.
12 class HtmlAttributesTest extends BrowserTestBase {
19 public static $modules = ['theme_test'];
22 * Tests that attributes in the 'html' and 'body' elements can be altered.
24 public function testThemeHtmlAttributes() {
26 $this->assertSession()->responseContains('<html lang="en" dir="ltr" theme_test_html_attribute="theme test html attribute value">');
27 $attributes = $this->xpath('/body[@theme_test_body_attribute="theme test body attribute value"]');
28 $this->assertTrue(count($attributes) == 1, "Attribute set in the 'body' element via hook_preprocess_HOOK() found.");