diff --git a/tests/src/FunctionalJavascript/MediaImageTest.php b/tests/src/FunctionalJavascript/MediaImageTest.php index 32f781b..3ffee4d 100644 --- a/tests/src/FunctionalJavascript/MediaImageTest.php +++ b/tests/src/FunctionalJavascript/MediaImageTest.php @@ -3,6 +3,7 @@ namespace Drupal\Tests\entity_embed\FunctionalJavascript; use Drupal\Component\Utility\Html; +use Drupal\editor\Entity\Editor; use Drupal\entity_embed\Plugin\entity_embed\EntityEmbedDisplay\MediaImageDecorator; use Drupal\field\Entity\FieldConfig; use Drupal\file\Entity\File; @@ -574,12 +575,44 @@ class MediaImageTest extends EntityEmbedTestBase { * Tests linkability of the CKEditor widget. */ public function testCkeditorWidgetIsLinkable() { + + // Remove DrupalImage. + // See https://www.drupal.org/project/entity_embed/issues/3061050 + $editor = Editor::load('full_html'); + $settings = $editor->getSettings(); + $rows = $settings['toolbar']['rows']; + foreach ($rows as $row_key => $row) { + foreach ($row as $group_key => $group) { + foreach ($group['items'] as $item_key => $item) { + if ($item === 'DrupalImage') { + unset($settings['toolbar']['rows'][$row_key][$group_key]['items'][$item_key]); + } + } + } + } + + $editor->setSettings($settings); + $editor->save(); + $this->host->body->value = ''; $this->host->save(); $this->drupalLogin($this->adminUser); $this->drupalGet('node/' . $this->host->id() . '/edit'); $this->waitForEditor(); + + // Test that drupal link works properly without DrupalImage plugin. + // See https://www.drupal.org/project/entity_embed/issues/3061050 + $this->pressEditorButton('drupallink'); + $this->assertSession()->waitForId('drupal-modal'); + $this->assertSession() + ->waitForElementVisible('css', '#editor-link-dialog-form') + ->findField('attributes[href]') + ->setValue('http://www.drupal.org'); + $this->assertSession()->elementExists('css', 'button.form-submit')->press(); + $this->assertSession()->assertWaitOnAjaxRequest(); + + // Now test linking an entity embed. $this->assignNameToCkeditorIframe(); $this->getSession()->switchToIFrame('ckeditor');