function QuickEditLoadingTest::testWithPendingRevision

Same name and namespace in other branches
  1. 8.9.x 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 and lazy loading of 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"');
}

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