function QuickEditLoadingTest::testTitleBaseField
Same name in other branches
- 8.9.x core/modules/quickedit/tests/src/FunctionalJavascript/QuickEditLoadingTest.php \Drupal\Tests\quickedit\FunctionalJavascript\QuickEditLoadingTest::testTitleBaseField()
Tests the loading of Quick Edit for the title base field.
File
-
core/
modules/ quickedit/ tests/ src/ FunctionalJavascript/ QuickEditLoadingTest.php, line 218
Class
- QuickEditLoadingTest
- Tests loading of in-place editing and lazy loading of in-place editors.
Namespace
Drupal\Tests\quickedit\FunctionalJavascriptCode
public function testTitleBaseField() {
$page = $this->getSession()
->getPage();
$assert = $this->assertSession();
$nid = $this->testNode
->id();
$this->drupalLogin($this->editorUser);
$this->drupalGet('node/' . $nid);
// Wait "Quick edit" button for node.
$assert->waitForElement('css', '[data-quickedit-entity-id="node/' . $nid . '"] .contextual .quickedit');
// Click by "Quick edit".
$this->clickContextualLink('[data-quickedit-entity-id="node/' . $nid . '"]', 'Quick edit');
// Switch to title field.
$page->find('css', '[data-quickedit-field-id="node/' . $nid . '/title/en/full"]')
->click();
// Wait and update title field.
$field_locator = '.field--name-title';
$text_new = 'Obligatory question';
$assert->waitForElementVisible('css', $field_locator)
->setValue($text_new);
// Wait and click by "Save" button after title field was changed.
$this->assertSession()
->waitForElementVisible('css', '.quickedit-toolgroup.ops [type="submit"][aria-hidden="false"]')
->click();
$assert->waitForElementRemoved('css', '.quickedit-toolgroup.ops [type="submit"][aria-hidden="false"]');
// Ensure that the changes take effect.
$assert->responseMatches("|\\s*{$text_new}\\s*|");
// Reload the page and check for updated title.
$this->drupalGet('node/' . $nid);
$assert->pageTextContains($text_new);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.