Commit b8d018e3 authored by xjm's avatar xjm

Issue #2775131 by chr.fritsch, marcoscano, katzilla, seanB, xjm, gippy,...

Issue #2775131 by chr.fritsch, marcoscano, katzilla, seanB, xjm, gippy, phenaproxima, alexpott, Berdir, lauriii, webflo, dawehner: Media entities should support contextual links
parent 9f54d00d
......@@ -32,5 +32,6 @@
*/
#}
<div{{ attributes }}>
{{ title_suffix.contextual_links }}
{{ content }}
</div>
<?php
namespace Drupal\Tests\media\Functional;
use Drupal\media\Entity\Media;
/**
* Tests views contextual links on media items.
*
* @group media
*/
class MediaContextualLinksTest extends MediaFunctionalTestBase {
/**
* {@inheritdoc}
*/
public static $modules = [
'contextual',
];
/**
* Tests contextual links.
*/
public function testMediaContextualLinks() {
// Create a media type.
$mediaType = $this->createMediaType();
// Create a media item.
$media = Media::create([
'bundle' => $mediaType->id(),
'name' => 'Unnamed',
]);
$media->save();
$user = $this->drupalCreateUser([
'administer media',
'access contextual links',
]);
$this->drupalLogin($user);
$this->drupalGet('media/' . $media->id());
$this->assertSession()->elementAttributeContains('css', 'div[data-contextual-id]', 'data-contextual-id', 'media:media=' . $media->id() . ':');
}
}
......@@ -21,6 +21,7 @@
]
%}
<article{{ attributes.addClass(classes) }}>
{{ title_suffix.contextual_links }}
{% if content %}
{{ content }}
{% endif %}
......
......@@ -13,6 +13,7 @@
*/
#}
<article{{ attributes }}>
{{ title_suffix.contextual_links }}
{% if content %}
{{ content }}
{% endif %}
......
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