function QuickEditLoadingTest::testWithPendingRevision

Same name in other branches
  1. 9 core/modules/quickedit/tests/src/FunctionalJavascript/QuickEditLoadingTest.php \Drupal\Tests\quickedit\FunctionalJavascript\QuickEditLoadingTest::testWithPendingRevision()

Test 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->drupalPostForm('node/add/article', [
        'title[0][value]' => 'foo',
    ], 'Preview');
    // Verify that quickedit is not active on preview.
    $this->assertNoRaw('data-quickedit-entity-id="node/' . $this->testNode
        ->id() . '"');
    $this->assertNoRaw('data-quickedit-field-id="node/' . $this->testNode
        ->id() . '/title/' . $this->testNode
        ->language()
        ->getId() . '/full"');
    $this->drupalGet('node/' . $this->testNode
        ->id());
    $this->assertRaw('data-quickedit-entity-id="node/' . $this->testNode
        ->id() . '"');
    $this->assertRaw('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->assertNoRaw('data-quickedit-entity-id="node/' . $this->testNode
        ->id() . '"');
    $this->assertNoRaw('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.