function ImageTestBase::addImage

Same name in other branches
  1. 9 core/modules/ckeditor5/tests/src/FunctionalJavascript/ImageTestBase.php \Drupal\Tests\ckeditor5\FunctionalJavascript\ImageTestBase::addImage()
  2. 10 core/modules/ckeditor5/tests/src/FunctionalJavascript/ImageTestBase.php \Drupal\Tests\ckeditor5\FunctionalJavascript\ImageTestBase::addImage()

Add an image to the CKEditor 5 editable zone.

1 method overrides ImageTestBase::addImage()
ImageTestTestBase::addImage in core/modules/ckeditor5/tests/src/FunctionalJavascript/ImageTestTestBase.php
Add an image to the CKEditor 5 editable zone.

File

core/modules/ckeditor5/tests/src/FunctionalJavascript/ImageTestBase.php, line 85

Class

ImageTestBase
@coversDefaultClass \Drupal\ckeditor5\Plugin\CKEditor5Plugin\Image @group ckeditor5 @internal

Namespace

Drupal\Tests\ckeditor5\FunctionalJavascript

Code

protected function addImage() {
    $page = $this->getSession()
        ->getPage();
    $src = $this->imageAttributes()['src'];
    $this->waitForEditor();
    $this->pressEditorButton('Insert image via URL');
    $dialog = $page->find('css', '.ck-dialog');
    $src_input = $dialog->find('css', '.ck-image-insert-url input[type=text]');
    $src_input->setValue($src);
    $dialog->find('xpath', "//button[span[text()='Accept']]")
        ->click();
    // Wait for the image to be uploaded and rendered by CKEditor 5.
    $this->assertNotEmpty($this->assertSession()
        ->waitForElementVisible('css', '.ck-widget.image > img[src="' . $src . '"]'));
}

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