function ImageUrlTest::testImageUrlWidget

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

Tests the Drupal image URL widget.

File

core/modules/ckeditor5/tests/src/FunctionalJavascript/ImageUrlTest.php, line 98

Class

ImageUrlTest
@coversDefaultClass <a href="/api/drupal/core%21modules%21ckeditor5%21src%21Plugin%21CKEditor5Plugin%21Image.php/class/Image/11.x" title="CKEditor 5 Image plugin." class="local">\Drupal\ckeditor5\Plugin\CKEditor5Plugin\Image</a> @group ckeditor5 @group #slow @internal

Namespace

Drupal\Tests\ckeditor5\FunctionalJavascript

Code

public function testImageUrlWidget() : void {
    $assert_session = $this->assertSession();
    $page = $this->getSession()
        ->getPage();
    $image_selector = '.ck-widget.image-inline';
    $src = $this->imageAttributes()['src'];
    $this->drupalGet($this->host
        ->toUrl('edit-form'));
    $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();
    $this->assertNotEmpty($assert_session->waitForElementVisible('css', $image_selector));
    $this->click($image_selector);
    $this->assertVisibleBalloon('[aria-label="Image toolbar"]');
    $this->pressEditorButton('Update image URL');
    $panel = $page->find('css', '.ck-dropdown__panel .ck-image-insert-url');
    $src_input = $panel->find('css', 'input[type=text]');
    $this->assertEquals($src, $src_input->getValue());
}

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