function ComponentRenderTest::checkIncludeDefaultContent

Same name in this branch
  1. 11.x core/tests/Drupal/KernelTests/Components/ComponentRenderTest.php \Drupal\KernelTests\Components\ComponentRenderTest::checkIncludeDefaultContent()
Same name in other branches
  1. 10 core/modules/sdc/tests/src/Kernel/ComponentRenderTest.php \Drupal\Tests\sdc\Kernel\ComponentRenderTest::checkIncludeDefaultContent()
  2. 10 core/tests/Drupal/KernelTests/Components/ComponentRenderTest.php \Drupal\KernelTests\Components\ComponentRenderTest::checkIncludeDefaultContent()

Check using a component with an include and default context.

1 call to ComponentRenderTest::checkIncludeDefaultContent()
ComponentRenderTest::testRender in core/modules/sdc/tests/src/Kernel/ComponentRenderTest.php
Test that components render correctly.

File

core/modules/sdc/tests/src/Kernel/ComponentRenderTest.php, line 53

Class

ComponentRenderTest
Tests the correct rendering of components.

Namespace

Drupal\Tests\sdc\Kernel

Code

protected function checkIncludeDefaultContent() : void {
    $build = [
        '#type' => 'inline_template',
        '#template' => "{% embed('sdc_theme_test_base:my-card-no-schema') %}{% block card_body %}Foo bar{% endblock %}{% endembed %}",
    ];
    $crawler = $this->renderComponentRenderArray($build);
    $this->assertNotEmpty($crawler->filter('#sdc-wrapper [data-component-id="sdc_theme_test_base:my-card-no-schema"] .component--my-card-no-schema__body:contains("Foo bar")'));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.