.../FunctionalJavascript/EntityEmbedTestBase.php | 19 ------ tests/src/FunctionalJavascript/MediaImageTest.php | 79 ---------------------- 2 files changed, 98 deletions(-) diff --git a/tests/src/FunctionalJavascript/EntityEmbedTestBase.php b/tests/src/FunctionalJavascript/EntityEmbedTestBase.php index 113e7a6..65e5e82 100644 --- a/tests/src/FunctionalJavascript/EntityEmbedTestBase.php +++ b/tests/src/FunctionalJavascript/EntityEmbedTestBase.php @@ -58,23 +58,4 @@ JS; $this->getSession()->wait($timeout, $condition); } - /** - * Creates an embed code with given attributes. - * - * @param array $attributes - * The attributes to add. - * - * @return string - * A string containing a element with the given attributes. - */ - protected function createEmbedCode(array $attributes) { - $dom = Html::load('This placeholder should not be rendered.'); - $xpath = new \DOMXPath($dom); - $drupal_entity = $xpath->query('//drupal-entity')[0]; - foreach ($attributes as $attribute => $value) { - $drupal_entity->setAttribute($attribute, $value); - } - return Html::serialize($dom); - } - } diff --git a/tests/src/FunctionalJavascript/MediaImageTest.php b/tests/src/FunctionalJavascript/MediaImageTest.php index f6df168..88e61a0 100644 --- a/tests/src/FunctionalJavascript/MediaImageTest.php +++ b/tests/src/FunctionalJavascript/MediaImageTest.php @@ -404,85 +404,6 @@ class MediaImageTest extends EntityEmbedTestBase { $img = $this->assertSession()->elementExists('css', 'img'); $this->assertEmpty($img->getAttribute('alt')); $this->assertEmpty($img->getAttribute('title')); - - // Test the same embed with different alt and title text. - $input = $this->createEmbedCode([ - 'alt' => 'alt 1', - 'title' => 'title 1', - 'data-embed-button' => 'test_media_entity_embed', - 'data-entity-embed-display' => 'view_mode:media.embed', - 'data-entity-embed-display-settings' => '', - 'data-entity-type' => 'media', - 'data-entity-uuid' => $media->uuid(), - 'data-langcode' => 'en', - ]); - $input .= $this->createEmbedCode([ - 'alt' => 'alt 2', - 'title' => 'title 2', - 'data-embed-button' => 'test_media_entity_embed', - 'data-entity-embed-display' => 'view_mode:media.embed', - 'data-entity-embed-display-settings' => '', - 'data-entity-type' => 'media', - 'data-entity-uuid' => $media->uuid(), - 'data-langcode' => 'en', - ]); - $input .= $this->createEmbedCode([ - 'alt' => 'alt 3', - 'title' => 'title 3', - 'data-embed-button' => 'test_media_entity_embed', - 'data-entity-embed-display' => 'view_mode:media.embed', - 'data-entity-embed-display-settings' => '', - 'data-entity-type' => 'media', - 'data-entity-uuid' => $media->uuid(), - 'data-langcode' => 'en', - ]); - - $this->getSession()->switchToIFrame(); - - $this->assertSession() - ->waitForElementVisible('css', 'a.cke_button__source') - ->click(); - - $source = $this->assertSession() - ->waitForElementVisible('xpath', "//textarea[contains(@class, 'cke_source')]"); - $source->setValue($input); - - // Exit "source" mode. - $this->assertSession() - ->waitForElementVisible('css', 'a.cke_button__source') - ->click(); - - $this->assertSession()->assertWaitOnAjaxRequest(); - $this->assignNameToCkeditorIframe(); - $this->getSession()->switchToIFrame('ckeditor'); - - $img = $this->assertSession()->waitForElement('xpath', "//img[contains(@alt, 'alt 1')]"); - $this->assertEquals('alt 1', $img->getAttribute('alt')); - $this->assertEquals('title 1', $img->getAttribute('title')); - - $img = $this->assertSession()->elementExists('xpath', "//img[contains(@alt, 'alt 2')]"); - $this->assertEquals('alt 2', $img->getAttribute('alt')); - $this->assertEquals('title 2', $img->getAttribute('title')); - - $img = $this->assertSession()->elementExists('xpath', "//img[contains(@alt, 'alt 3')]"); - $this->assertEquals('alt 3', $img->getAttribute('alt')); - $this->assertEquals('title 3', $img->getAttribute('title')); - - // Save the host entity. - $this->getSession()->switchToIFrame(); - $this->assertSession()->buttonExists('Save')->press(); - - $img = $this->assertSession()->waitForElement('xpath', "//img[contains(@alt, 'alt 1')]"); - $this->assertEquals('alt 1', $img->getAttribute('alt')); - $this->assertEquals('title 1', $img->getAttribute('title')); - - $img = $this->assertSession()->elementExists('xpath', "//img[contains(@alt, 'alt 2')]"); - $this->assertEquals('alt 2', $img->getAttribute('alt')); - $this->assertEquals('title 2', $img->getAttribute('title')); - - $img = $this->assertSession()->elementExists('xpath', "//img[contains(@alt, 'alt 3')]"); - $this->assertEquals('alt 3', $img->getAttribute('alt')); - $this->assertEquals('title 3', $img->getAttribute('title')); } /**