tests/src/FunctionalJavascript/MediaImageTest.php | 41 ++++++++++++----------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/tests/src/FunctionalJavascript/MediaImageTest.php b/tests/src/FunctionalJavascript/MediaImageTest.php index 55122f8..d619080 100644 --- a/tests/src/FunctionalJavascript/MediaImageTest.php +++ b/tests/src/FunctionalJavascript/MediaImageTest.php @@ -572,12 +572,10 @@ class MediaImageTest extends EntityEmbedTestBase { } /** - * Tests linkability of the CKEditor widget. + * Tests linkability of the CKEditor widget when `drupalimage` is disabled. */ - public function testCkeditorWidgetIsLinkable() { - - // Remove DrupalImage. - // See https://www.drupal.org/project/entity_embed/issues/3061050 + public function testCkeditorWidgetIsLinkableWhenDrupalImageIsAbsent() { + // Remove the `drupalimage` plugin's `DrupalImage` button. $editor = Editor::load('full_html'); $settings = $editor->getSettings(); $rows = $settings['toolbar']['rows']; @@ -590,29 +588,22 @@ class MediaImageTest extends EntityEmbedTestBase { } } } - $editor->setSettings($settings); $editor->save(); + $this->testCkeditorWidgetIsLinkable(); + } + + /** + * Tests linkability of the CKEditor widget. + */ + public function testCkeditorWidgetIsLinkable() { $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'); @@ -634,6 +625,18 @@ class MediaImageTest extends EntityEmbedTestBase { // Verify the saved entity when viewed also contains the linked media. $this->assertSession()->elementExists('xpath', '//a[@href="http://www.drupal.org"]//div[@data-embed-button="test_media_entity_embed"]//img'); + + // Test that `drupallink` also still works independently. + $this->drupalGet('node/' . $this->host->id() . '/edit'); + $this->waitForEditor(); + $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(); } /**