You are here

public function QuickEditLoadingTest::testContentBlock in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/quickedit/tests/src/FunctionalJavascript/QuickEditLoadingTest.php \Drupal\Tests\quickedit\FunctionalJavascript\QuickEditLoadingTest::testContentBlock()
  2. 10 core/modules/quickedit/tests/src/FunctionalJavascript/QuickEditLoadingTest.php \Drupal\Tests\quickedit\FunctionalJavascript\QuickEditLoadingTest::testContentBlock()

Tests that Quick Edit's data- attributes are present for content blocks.

File

core/modules/quickedit/tests/src/FunctionalJavascript/QuickEditLoadingTest.php, line 323

Class

QuickEditLoadingTest
Tests loading of in-place editing functionality and lazy loading of its in-place editors.

Namespace

Drupal\Tests\quickedit\FunctionalJavascript

Code

public function testContentBlock() {
  \Drupal::service('module_installer')
    ->install([
    'block_content',
  ]);

  // Create and place a content_block block.
  $block = BlockContent::create([
    'info' => $this
      ->randomMachineName(),
    'type' => 'basic',
    'langcode' => 'en',
  ]);
  $block
    ->save();
  $this
    ->drupalPlaceBlock('block_content:' . $block
    ->uuid());

  // Check that the data- attribute is present.
  $this
    ->drupalLogin($this->editorUser);
  $this
    ->drupalGet('');
  $this
    ->assertSession()
    ->responseContains('data-quickedit-entity-id="block_content/1"');
}