function LayoutBuilderQuickEditTest::testQuickEditIgnoresDuplicateFields

Same name in other branches
  1. 8.9.x core/modules/layout_builder/tests/src/FunctionalJavascript/LayoutBuilderQuickEditTest.php \Drupal\Tests\layout_builder\FunctionalJavascript\LayoutBuilderQuickEditTest::testQuickEditIgnoresDuplicateFields()

Tests that Quick Edit still works even when there are duplicate fields.

See also

https://www.drupal.org/project/drupal/issues/3041850

File

core/modules/quickedit/tests/src/FunctionalJavascript/LayoutBuilderQuickEditTest.php, line 97

Class

LayoutBuilderQuickEditTest
Tests that Layout Builder functions with Quick Edit.

Namespace

Drupal\Tests\quickedit\FunctionalJavascript

Code

public function testQuickEditIgnoresDuplicateFields() {
    // Place the body field a second time using Layout Builder.
    $this->enableLayouts('admin/structure/types/manage/article/display/default');
    $page = $this->getSession()
        ->getPage();
    $assert_session = $this->assertSession();
    $this->loginLayoutAdmin();
    $this->drupalGet('admin/structure/types/manage/article/display/default/layout');
    $page->clickLink('Add block');
    $this->assertNotEmpty($assert_session->waitForElementVisible('css', '#drupal-off-canvas'));
    $assert_session->waitForElementVisible('named', [
        'link',
        'Body',
    ]);
    $page->clickLink('Body');
    $assert_session->waitForElementVisible('named', [
        'button',
        'Add block',
    ]);
    $page->pressButton('Add block');
    $assert_session->waitForElementVisible('named', [
        'button',
        'Save layout',
    ]);
    $page->pressButton('Save layout');
    $this->assertNotEmpty($assert_session->waitForElement('css', '.messages--status'));
    $assert_session->pageTextContains('The layout has been saved.');
    $this->drupalLogin($this->contentAuthorUser);
    $this->usingLayoutBuilder = TRUE;
    $this->assertQuickEditInit([
        'title',
    ]);
    $this->drupalLogin($this->drupalCreateUser([
        'access contextual links',
        'access in-place editing',
        'access content',
        'edit any article content',
        'administer nodes',
    ]));
    $this->assertQuickEditInit([
        'title',
        'uid',
        'created',
    ]);
}

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