function QuickEditJavascriptTestBase::typeInPlainTextEditor

Same name and namespace in other branches
  1. 8.9.x core/modules/quickedit/tests/src/FunctionalJavascript/QuickEditJavascriptTestBase.php \Drupal\Tests\quickedit\FunctionalJavascript\QuickEditJavascriptTestBase::typeInPlainTextEditor()

Simulates typing in a 'plain_text' in-place editor.

Parameters

string $css_selector: The CSS selector to find the DOM element (with the 'contenteditable=true' attribute set), to type in.

string $text: The text to type.

See also

\Drupal\quickedit\Plugin\InPlaceEditor\PlainTextEditor

3 calls to QuickEditJavascriptTestBase::typeInPlainTextEditor()
CKEditor5IntegrationTest::testArticleNode in core/modules/quickedit/tests/src/FunctionalJavascript/CKEditor5IntegrationTest.php
Tests if an article node can be in-place edited with Quick Edit.
CKEditor5IntegrationTest::testDiscard in core/modules/quickedit/tests/src/FunctionalJavascript/CKEditor5IntegrationTest.php
Tests that changes can be discarded.
LayoutBuilderIntegrationTest::testArticleNode in core/modules/quickedit/tests/src/FunctionalJavascript/LayoutBuilderIntegrationTest.php
Tests if an article node can be in-place edited with Quick Edit.

File

core/modules/quickedit/tests/src/FunctionalJavascript/QuickEditJavascriptTestBase.php, line 282

Class

QuickEditJavascriptTestBase
Base class for testing the QuickEdit.

Namespace

Drupal\Tests\quickedit\FunctionalJavascript

Code

protected function typeInPlainTextEditor($css_selector, $text) {
    $field = $this->getSession()
        ->getPage()
        ->find('css', $css_selector);
    $field->setValue(Key::END . $text);
    $this->getSession()
        ->evaluateScript("document.querySelector('{$css_selector}').dispatchEvent(new Event('blur', {bubbles:true}))");
}

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