function ImageUrlTest::testImageUrlWidget

Same name 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 19

Class

ImageUrlTest
@coversDefaultClass \Drupal\ckeditor5\Plugin\CKEditor5Plugin\Image @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');
    $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();
    $this->assertNotEmpty($assert_session->waitForElementVisible('css', $image_selector));
    $this->click($image_selector);
    $this->assertVisibleBalloon('[aria-label="Image toolbar"]');
    $this->pressEditorButton('Update image URL');
    $dialog = $page->find('css', '.ck-dialog');
    $src_input = $dialog->find('css', '.ck-image-insert-url 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.