function QuickEditLoadingTest::testContentBlock

Same name in other branches
  1. 8.9.x 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 321

Class

QuickEditLoadingTest
Tests loading of in-place editing and lazy loading of 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"');
}

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