function 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.
