function LayoutBuilderThemeSuggestionsTest::testFieldBlockViewModeTemplates
Same name in other branches
- 9 core/modules/layout_builder/tests/src/Functional/LayoutBuilderThemeSuggestionsTest.php \Drupal\Tests\layout_builder\Functional\LayoutBuilderThemeSuggestionsTest::testFieldBlockViewModeTemplates()
- 8.9.x core/modules/layout_builder/tests/src/Functional/LayoutBuilderThemeSuggestionsTest.php \Drupal\Tests\layout_builder\Functional\LayoutBuilderThemeSuggestionsTest::testFieldBlockViewModeTemplates()
- 11.x core/modules/layout_builder/tests/src/Functional/LayoutBuilderThemeSuggestionsTest.php \Drupal\Tests\layout_builder\Functional\LayoutBuilderThemeSuggestionsTest::testFieldBlockViewModeTemplates()
Tests that of view mode specific field templates are suggested.
File
-
core/
modules/ layout_builder/ tests/ src/ Functional/ LayoutBuilderThemeSuggestionsTest.php, line 75
Class
- LayoutBuilderThemeSuggestionsTest
- Tests template suggestions.
Namespace
Drupal\Tests\layout_builder\FunctionalCode
public function testFieldBlockViewModeTemplates() : void {
$assert_session = $this->assertSession();
$this->drupalGet('node/1');
// Confirm that content is displayed by layout builder.
$assert_session->elementExists('css', '.block-layout-builder');
// Text that only appears in the view mode specific template.
$assert_session->pageTextContains('I am a field template for a specific view mode!');
// The content of the body field should not be visible because it is
// displayed via a template that does not render it.
$assert_session->pageTextNotContains('This is content that the template should not render');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.