ImageUrlTest.php

Same filename and directory in other branches
  1. 11.x core/modules/ckeditor5/tests/src/FunctionalJavascript/ImageUrlTest.php
  2. 10 core/modules/ckeditor5/tests/src/FunctionalJavascript/ImageUrlTest.php
  3. 9 core/modules/ckeditor5/tests/src/FunctionalJavascript/ImageUrlTest.php

Namespace

Drupal\Tests\ckeditor5\FunctionalJavascript

File

core/modules/ckeditor5/tests/src/FunctionalJavascript/ImageUrlTest.php

View source
<?php

declare (strict_types=1);
namespace Drupal\Tests\ckeditor5\FunctionalJavascript;

use Drupal\ckeditor5\Plugin\CKEditor5Plugin\Image;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses;

/**
 * Tests Drupal\ckeditor5\Plugin\CKEditor5Plugin\Image.
 *
 * @internal
 */
class ImageUrlTest extends ImageUrlTestBase {
  use ImageTestBaselineTrait;
  
  /**
   * Tests the Drupal image URL widget.
   */
  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()='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');
    $dialog = $page->find('css', '.ck-dialog');
    $src_input = $dialog->find('css', '.ck-image-insert-url input[type=text]');
    $this->assertEquals($src, $src_input->getValue());
  }

}

Classes

Title Deprecated Summary
ImageUrlTest Tests Drupal\ckeditor5\Plugin\CKEditor5Plugin\Image.

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