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. 11.x core/modules/ckeditor5/tests/src/FunctionalJavascript/ImageTestBase.php \Drupal\Tests\ckeditor5\FunctionalJavascript\ImageTestBase::addImage()

Add an image to the CKEditor 5 editable zone.

2 calls to ImageTestBase::addImage()
ImageTestBase::testAltTextRequired in core/modules/ckeditor5/tests/src/FunctionalJavascript/ImageTestBase.php
Tests that alt text is required for images.
ImageTestBase::testResize in core/modules/ckeditor5/tests/src/FunctionalJavascript/ImageTestBase.php
Tests the image resize plugin.
1 method overrides ImageTestBase::addImage()
ImageTest::addImage in core/modules/ckeditor5/tests/src/FunctionalJavascript/ImageTest.php
Add an image to the CKEditor 5 editable zone.

File

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

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');
    $panel = $page->find('css', '.ck-dropdown__panel  .ck-image-insert-url');
    $src_input = $panel->find('css', 'input[type=text]');
    $src_input->setValue($src);
    $panel->find('xpath', "//button[span[text()='Insert']]")
        ->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.