function MediaPreviewTest::testMediaPointerEvent

Same name in other branches
  1. 10 core/modules/ckeditor5/tests/src/FunctionalJavascript/MediaPreviewTest.php \Drupal\Tests\ckeditor5\FunctionalJavascript\MediaPreviewTest::testMediaPointerEvent()

Ensure media preview isn't clickable.

File

core/modules/ckeditor5/tests/src/FunctionalJavascript/MediaPreviewTest.php, line 210

Class

MediaPreviewTest
@coversDefaultClass \Drupal\ckeditor5\Plugin\CKEditor5Plugin\Media @group ckeditor5 @group #slow @internal

Namespace

Drupal\Tests\ckeditor5\FunctionalJavascript

Code

public function testMediaPointerEvent() : void {
    $entityViewDisplay = EntityViewDisplay::load('media.image.view_mode_1');
    $thumbnail = $entityViewDisplay->getComponent('thumbnail');
    $thumbnail['settings']['image_link'] = 'file';
    $entityViewDisplay->setComponent('thumbnail', $thumbnail);
    $entityViewDisplay->save();
    $assert_session = $this->assertSession();
    $page = $this->getSession()
        ->getPage();
    $url = $this->host
        ->toUrl('edit-form');
    $this->drupalGet($url);
    $this->waitForEditor();
    $assert_session->waitForLink('default alt');
    $page->find('css', '.ck .drupal-media')
        ->click();
    // Assert that the media preview is not clickable by comparing the URL.
    $this->assertEquals($url->toString(), $this->getUrl());
}

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