Issue #3268318 by lauriii, Wim Leers, tim.plunkett: [drupalMedia] <a> with GHS allowed attributes downcast wraps data-caption with <a>

merge-requests/2111/head
bnjmnm 2022-04-13 11:03:08 -04:00
parent 96728e54e1
commit 417d64dd00
3 changed files with 6 additions and 12 deletions

File diff suppressed because one or more lines are too long

View File

@ -40,7 +40,7 @@ function upcastMediaLink() {
// There's an <drupal-media> inside an <a> element - we consume it so it
// won't be picked up by the Link plugin.
const consumableAttributes = { attributes: ['href'] };
const consumableAttributes = { attributes: ['href'], name: true };
// Consume the `href` attribute so the default one will not convert it to
// $text attribute.

View File

@ -791,16 +791,6 @@ class MediaTest extends WebDriverTestBase {
// linking media.
$this->assertNotEmpty($xpath->query('//a[@href="http://linking-embedded-media.com"]/drupal-media[@data-caption="baz"]'));
// Remove caption from media for now to avoid incompatibility issues in GHS
// linked media integration.
// @todo remove this step after
// https://www.drupal.org/project/drupal/issues/3268318 has been resolved.
$this->assertNotEmpty($drupalmedia = $assert_session->waitForElementVisible('css', '.ck-content .ck-widget.drupal-media'));
$drupalmedia->click();
$this->assertVisibleBalloon('.ck-toolbar[aria-label="Drupal Media toolbar"]');
$this->getBalloonButton('Toggle caption off')->click();
$this->assertTrue($assert_session->waitForElementRemoved('css', '.ck-content .ck-widget.drupal-media figcaption'));
// Add `class="trusted"` to the link.
$this->assertEmpty($xpath->query('//a[@href="http://linking-embedded-media.com" and @class="trusted"]'));
$this->pressEditorButton('Source');
@ -857,6 +847,10 @@ class MediaTest extends WebDriverTestBase {
$assert_session->elementNotExists('css', '.ck-content a');
$assert_session->elementExists('css', '.ck-content .drupal-media.ck-widget > div[aria-label] > article > div > img[src*="image-test.png"]');
// Ensure that figcaption exists.
// @see https://www.drupal.org/project/drupal/issues/3268318
$assert_session->elementExists('css', '.ck-content .drupal-media.ck-widget > figcaption');
// Assert the "dataDowncast" HTML after making changes.
$xpath = new \DOMXPath($this->getEditorDataAsDom());
$this->assertNotEmpty($xpath->query('//drupal-media'));