public function LayoutBuilderThemeSuggestionsTest::testFieldBlockViewModeTemplates in Drupal 10
Same name and namespace in other branches
- 8 core/modules/layout_builder/tests/src/Functional/LayoutBuilderThemeSuggestionsTest.php \Drupal\Tests\layout_builder\Functional\LayoutBuilderThemeSuggestionsTest::testFieldBlockViewModeTemplates()
- 9 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 73
Class
- LayoutBuilderThemeSuggestionsTest
- Tests template suggestions.
Namespace
Drupal\Tests\layout_builder\FunctionalCode
public function testFieldBlockViewModeTemplates() {
$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');
}