You are here

public function QuickEditLoadingTest::testWithPendingRevision in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/quickedit/tests/src/FunctionalJavascript/QuickEditLoadingTest.php \Drupal\Tests\quickedit\FunctionalJavascript\QuickEditLoadingTest::testWithPendingRevision()
  2. 10 core/modules/quickedit/tests/src/FunctionalJavascript/QuickEditLoadingTest.php \Drupal\Tests\quickedit\FunctionalJavascript\QuickEditLoadingTest::testWithPendingRevision()

Tests Quick Edit does not appear for entities with pending revisions.

File

core/modules/quickedit/tests/src/FunctionalJavascript/QuickEditLoadingTest.php, line 187

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 testWithPendingRevision() {
  $this
    ->drupalLogin($this->editorUser);

  // Verify that the preview is loaded correctly.
  $this
    ->drupalGet('node/add/article');
  $this
    ->submitForm([
    'title[0][value]' => 'foo',
  ], 'Preview');

  // Verify that quickedit is not active on preview.
  $this
    ->assertSession()
    ->responseNotContains('data-quickedit-entity-id="node/' . $this->testNode
    ->id() . '"');
  $this
    ->assertSession()
    ->responseNotContains('data-quickedit-field-id="node/' . $this->testNode
    ->id() . '/title/' . $this->testNode
    ->language()
    ->getId() . '/full"');
  $this
    ->drupalGet('node/' . $this->testNode
    ->id());
  $this
    ->assertSession()
    ->responseContains('data-quickedit-entity-id="node/' . $this->testNode
    ->id() . '"');
  $this
    ->assertSession()
    ->responseContains('data-quickedit-field-id="node/' . $this->testNode
    ->id() . '/title/' . $this->testNode
    ->language()
    ->getId() . '/full"');

  // Wait for the page to completely load before making any changes to the
  // node. This allows Quick Edit to fetch the metadata without causing
  // database locks on SQLite.
  $this
    ->assertSession()
    ->assertWaitOnAjaxRequest();
  $this->testNode->title = 'Updated node';
  $this->testNode
    ->setNewRevision(TRUE);
  $this->testNode
    ->isDefaultRevision(FALSE);
  $this->testNode
    ->save();
  $this
    ->drupalGet('node/' . $this->testNode
    ->id());
  $this
    ->assertSession()
    ->responseNotContains('data-quickedit-entity-id="node/' . $this->testNode
    ->id() . '"');
  $this
    ->assertSession()
    ->responseNotContains('data-quickedit-field-id="node/' . $this->testNode
    ->id() . '/title/' . $this->testNode
    ->language()
    ->getId() . '/full"');
}