You are here

public function LayoutBuilderQuickEditTest::testQuickEditIgnoresDuplicateFields in Drupal 8

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/layout_builder/tests/src/FunctionalJavascript/LayoutBuilderQuickEditTest.php, line 96

Class

LayoutBuilderQuickEditTest
Tests that Layout Builder functions with Quick Edit.

Namespace

Drupal\Tests\layout_builder\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
    ->assertWaitOnAjaxRequest();
  $page
    ->clickLink('Body');
  $assert_session
    ->assertWaitOnAjaxRequest();
  $page
    ->pressButton('Add block');
  $assert_session
    ->assertWaitOnAjaxRequest();
  $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',
  ]);
}