function MediaTest::testConversion
Same name in other branches
- 10 core/modules/ckeditor5/tests/src/FunctionalJavascript/MediaTest.php \Drupal\Tests\ckeditor5\FunctionalJavascript\MediaTest::testConversion()
- 11.x core/modules/ckeditor5/tests/src/FunctionalJavascript/MediaTest.php \Drupal\Tests\ckeditor5\FunctionalJavascript\MediaTest::testConversion()
Tests that `<drupal-media>` is converted into a block element.
File
-
core/
modules/ ckeditor5/ tests/ src/ FunctionalJavascript/ MediaTest.php, line 236
Class
- MediaTest
- @coversDefaultClass \Drupal\ckeditor5\Plugin\CKEditor5Plugin\Media @group ckeditor5 @internal
Namespace
Drupal\Tests\ckeditor5\FunctionalJavascriptCode
public function testConversion() {
// Wrap the `<drupal-media>` markup in a `<p>`.
$original_value = $this->host->body->value;
$this->host->body->value = '<p>foo' . $original_value . '</p>';
$this->host
->save();
$this->drupalGet($this->host
->toUrl('edit-form'));
$this->waitForEditor();
$assert_session = $this->assertSession();
$assert_session->waitForElementVisible('css', 'img[src*="image-test.png"]', 1000);
$editor_html = $this->getEditorDataAsHtmlString();
// Observe that `<drupal-media>` was moved into its own block element.
$this->assertEquals('<p>foo</p>' . $original_value, str_replace(' ', '', $editor_html));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.