You are here

public function LayoutBuilderQuickEditTest::testQuickEditIgnoresDuplicateFields in Drupal 9

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 95

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',
    'uid',
    'created',
  ]);
}