function ContextualLinksTest::testRevisionContextualLinks
Same name in other branches
- 8.9.x core/modules/node/tests/src/FunctionalJavascript/ContextualLinksTest.php \Drupal\Tests\node\FunctionalJavascript\ContextualLinksTest::testRevisionContextualLinks()
- 10 core/modules/node/tests/src/FunctionalJavascript/ContextualLinksTest.php \Drupal\Tests\node\FunctionalJavascript\ContextualLinksTest::testRevisionContextualLinks()
- 11.x core/modules/node/tests/src/FunctionalJavascript/ContextualLinksTest.php \Drupal\Tests\node\FunctionalJavascript\ContextualLinksTest::testRevisionContextualLinks()
Tests the contextual links on revisions.
File
-
core/
modules/ node/ tests/ src/ FunctionalJavascript/ ContextualLinksTest.php, line 93
Class
- ContextualLinksTest
- Create a node with revisions and test contextual links.
Namespace
Drupal\Tests\node\FunctionalJavascriptCode
public function testRevisionContextualLinks() {
// Confirm that the "Edit" and "Delete" contextual links appear for the
// default revision.
$this->drupalGet('node/' . $this->nodes[0]
->id());
$page = $this->getSession()
->getPage();
$page->waitFor(10, function () use ($page) {
return $page->find('css', "main .contextual");
});
$this->toggleContextualTriggerVisibility('main');
$page->find('css', 'main .contextual button')
->press();
$links = $page->findAll('css', "main .contextual-links li a");
$this->assertEquals('Edit', $links[0]->getText());
$this->assertEquals('Delete', $links[1]->getText());
// Confirm that "Edit" and "Delete" contextual links don't appear for
// non-default revision.
$this->drupalGet("node/" . $this->nodes[0]
->id() . "/revisions/" . $this->nodes[1]
->getRevisionId() . "/view");
$this->assertSession()
->pageTextContains($this->nodes[1]
->getTitle());
$page->waitFor(10, function () use ($page) {
return $page->find('css', "main .contextual");
});
$this->toggleContextualTriggerVisibility('main');
$contextual_button = $page->find('css', 'main .contextual button');
$this->assertEmpty(0, $contextual_button ?: '');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.