function BlockHtmlTest::testHtml
Tests for valid HTML for a block.
File
- 
              core/modules/ block/ tests/ src/ Functional/ BlockHtmlTest.php, line 46 
Class
- BlockHtmlTest
- Tests block HTML ID validity.
Namespace
Drupal\Tests\block\FunctionalCode
public function testHtml() {
  $this->drupalGet('');
  // Ensure that a block's ID is converted to an HTML valid ID, and that
  // block-specific attributes are added to the same DOM element.
  $this->assertSession()
    ->elementExists('xpath', '//div[@id="block-test-html-block" and @data-custom-attribute="foo"]');
  // Ensure expected markup for a menu block.
  $this->assertSession()
    ->elementExists('xpath', '//nav[@id="block-test-menu-block"]/ul/li');
}Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.
