Commit c0b2bbe4 authored by phenaproxima's avatar phenaproxima Committed by Wim Leers

Issue #2881745 by phenaproxima, Wim Leers, joelhsmith, marcoscano, mgifford,...

Issue #2881745 by phenaproxima, Wim Leers, joelhsmith, marcoscano, mgifford, johnflower, edmonkey: Wrapping embedded entities in <article> is bad for accessibility, use <div> instead
parent 7239111b
......@@ -12,4 +12,4 @@
* @ingroup themeable
*/
#}
<article{{ attributes }}>{{ children }}</article>
<div{{ attributes }}>{{ children }}</div>
......@@ -41,7 +41,7 @@ class EntityEmbedFilterTest extends EntityEmbedTestBase {
$this->assertNoRaw('<drupal-entity data-entity-type="node" data-entity');
$this->assertText($this->node->body->value, 'Embedded node exists in page');
$this->assertNoText(strip_tags($content), 'Placeholder does not appear in the output when embed is successful.');
$this->assertRaw('<article class="embedded-entity">', 'Embed container found.');
$this->assertRaw('<div class="embedded-entity">', 'Embed container found.');
// Tests that embedded entity is not rendered if not accessible.
$this->node->setPublished(FALSE)->save();
......@@ -63,7 +63,7 @@ class EntityEmbedFilterTest extends EntityEmbedTestBase {
$this->assertNoRaw('<drupal-entity data-entity-type="node" data-entity');
$this->assertText($this->node->body->value, 'Embedded node exists in the page.');
$this->assertNoText(strip_tags($content), 'Placeholder does not appear in the output when embed is successful.');
$this->assertRaw('<article class="embedded-entity">', 'Embed container found.');
$this->assertRaw('<div class="embedded-entity">', 'Embed container found.');
$this->webUser->removeRole('access_unpublished');
$this->webUser->save();
$this->node->setPublished(TRUE)->save();
......@@ -79,7 +79,7 @@ class EntityEmbedFilterTest extends EntityEmbedTestBase {
$this->assertNoRaw('<drupal-entity data-entity-type="node" data-entity');
$this->assertText($this->node->body->value, 'Embedded node exists in page.');
$this->assertNoText(strip_tags($content), 'Placeholder does not appear in the output when embed is successful.');
$this->assertRaw('<article class="embedded-entity">', 'Embed container found.');
$this->assertRaw('<div class="embedded-entity">', 'Embed container found.');
$this->assertCacheTag('foo:' . $this->node->id());
// Ensure that placeholder is not replaced when embed is unsuccessful.
......@@ -106,7 +106,7 @@ class EntityEmbedFilterTest extends EntityEmbedTestBase {
$this->assertText($this->node->body->value, 'Entity specifed with UUID exists in the page.');
$this->assertNoText($sample_node->body->value, 'Entity specifed with ID does not exists in the page.');
$this->assertNoText(strip_tags($content), 'Placeholder does not appear in the output when embed is successful.');
$this->assertRaw('<article class="embedded-entity"', 'Embed container found.');
$this->assertRaw('<div class="embedded-entity"', 'Embed container found.');
// Test deprecated 'default' Entity Embed Display plugin.
$content = '<drupal-entity data-entity-type="node" data-entity-uuid="' . $this->node->uuid() . '" data-entity-embed-display="default" data-entity-embed-display-settings=\'{"view_mode":"teaser"}\'>This placeholder should not be rendered.</drupal-entity>';
......@@ -118,7 +118,7 @@ class EntityEmbedFilterTest extends EntityEmbedTestBase {
$this->drupalGet('node/' . $node->id());
$this->assertText($this->node->body->value, 'Embedded node exists in page.');
$this->assertNoText(strip_tags($content), 'Placeholder does not appear in the output when embed is successful.');
$this->assertRaw('<article class="embedded-entity"', 'Embed container found.');
$this->assertRaw('<div class="embedded-entity"', 'Embed container found.');
// Ensure that Entity Embed Display plugin is preferred over view mode when
// both attributes are present.
......@@ -131,7 +131,7 @@ class EntityEmbedFilterTest extends EntityEmbedTestBase {
$this->drupalGet('node/' . $node->id());
$this->assertText($this->node->body->value, 'Embedded node exists in page with the view mode specified by entity-embed-settings.');
$this->assertNoText(strip_tags($content), 'Placeholder does not appear in the output when embed is successful.');
$this->assertRaw('<article class="embedded-entity"', 'Embed container found.');
$this->assertRaw('<div class="embedded-entity"', 'Embed container found.');
// Ensure the embedded node doesn't contain data tags on the full page.
$this->drupalGet('node/' . $this->node->id());
......@@ -176,7 +176,7 @@ class EntityEmbedFilterTest extends EntityEmbedTestBase {
$this->assertRaw('data-align="left"', 'Alignment information found.');
$this->assertTrue((bool) $this->xpath("//img[@alt='This is alt text']"), 'Alt text found');
$this->assertTrue((bool) $this->xpath("//img[@title='This is title text']"), 'Title text found');
$this->assertRaw('<article class="embedded-entity"', 'Embed container found.');
$this->assertRaw('<div class="embedded-entity"', 'Embed container found.');
// data-entity-embed-settings is replaced with
// data-entity-embed-display-settings. Check to see if
......@@ -192,7 +192,7 @@ class EntityEmbedFilterTest extends EntityEmbedTestBase {
$this->assertNoLink($this->node->getTitle(), 'Embed settings are respected.');
$this->assertNoText($this->node->body->value, 'Embedded node exists in page.');
$this->assertNoText(strip_tags($content), 'Placeholder does not appear in the output when embed is successful.');
$this->assertRaw('<article class="embedded-entity"', 'Embed container found.');
$this->assertRaw('<div class="embedded-entity"', 'Embed container found.');
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment