You are here

public function MediaImageTest::testCkeditorWidgetWorksForAllEmbeds in Entity Embed 8

Tests even <drupal-entity> elements whose button is not present are upcast.

@dataProvider providerCkeditorWidgetWorksForAllEmbeds

Parameters

string $data_embed_button_attribute: The HTML for a data-embed-button atttribute.

File

tests/src/FunctionalJavascript/MediaImageTest.php, line 781

Class

MediaImageTest
Test Media Image specific functionality.

Namespace

Drupal\Tests\entity_embed\FunctionalJavascript

Code

public function testCkeditorWidgetWorksForAllEmbeds($data_embed_button_attribute) {
  $this->host->body->value = '<drupal-entity data-caption="baz" ' . $data_embed_button_attribute . ' data-entity-embed-display="entity_reference:media_thumbnail" data-entity-embed-display-settings="{&quot;image_style&quot;:&quot;&quot;,&quot;image_link&quot;:&quot;&quot;}" data-entity-type="media" data-entity-uuid="' . $this->media
    ->uuid() . '"></drupal-entity>';
  $this->host
    ->save();
  $this
    ->drupalLogin($this->adminUser);
  $this
    ->drupalGet('node/' . $this->host
    ->id() . '/edit');
  $this
    ->waitForEditor();
  $this
    ->assignNameToCkeditorIframe();
  $this
    ->getSession()
    ->switchToIFrame('ckeditor');
  $this
    ->assertNotNull($this
    ->assertSession()
    ->waitForElementVisible('css', 'figcaption'));
}