function QuickEditLoadingTest::testContentBlock

Same name and namespace in other branches
  1. 9 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 324

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->assertRaw('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.