Issue #3268318 by lauriii, Wim Leers, tim.plunkett: [drupalMedia] <a> with GHS allowed attributes downcast wraps data-caption with <a>
parent
96728e54e1
commit
417d64dd00
File diff suppressed because one or more lines are too long
|
@ -40,7 +40,7 @@ function upcastMediaLink() {
|
||||||
|
|
||||||
// There's an <drupal-media> inside an <a> element - we consume it so it
|
// There's an <drupal-media> inside an <a> element - we consume it so it
|
||||||
// won't be picked up by the Link plugin.
|
// 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
|
// Consume the `href` attribute so the default one will not convert it to
|
||||||
// $text attribute.
|
// $text attribute.
|
||||||
|
|
|
@ -791,16 +791,6 @@ class MediaTest extends WebDriverTestBase {
|
||||||
// linking media.
|
// linking media.
|
||||||
$this->assertNotEmpty($xpath->query('//a[@href="http://linking-embedded-media.com"]/drupal-media[@data-caption="baz"]'));
|
$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.
|
// Add `class="trusted"` to the link.
|
||||||
$this->assertEmpty($xpath->query('//a[@href="http://linking-embedded-media.com" and @class="trusted"]'));
|
$this->assertEmpty($xpath->query('//a[@href="http://linking-embedded-media.com" and @class="trusted"]'));
|
||||||
$this->pressEditorButton('Source');
|
$this->pressEditorButton('Source');
|
||||||
|
@ -857,6 +847,10 @@ class MediaTest extends WebDriverTestBase {
|
||||||
$assert_session->elementNotExists('css', '.ck-content a');
|
$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"]');
|
$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.
|
// Assert the "dataDowncast" HTML after making changes.
|
||||||
$xpath = new \DOMXPath($this->getEditorDataAsDom());
|
$xpath = new \DOMXPath($this->getEditorDataAsDom());
|
||||||
$this->assertNotEmpty($xpath->query('//drupal-media'));
|
$this->assertNotEmpty($xpath->query('//drupal-media'));
|
||||||
|
|
Loading…
Reference in New Issue