Commit 319f0237 authored by xjm's avatar xjm

Issue #2934850 by balsama, Berdir: Media Images should be rendered at a reasonable size by default

parent 32fc1125
......@@ -81,10 +81,13 @@ public function testMediaDisplay() {
// Here we expect to see only the image, nothing else.
// Assert only one element in the content region.
$this->assertEquals(1, count($page->findAll('css', '.media--type-image > div')));
// Assert the image is present inside the media element, with "medium"
// image style.
// Assert the image is present inside the media element.
$media_item = $assert_session->elementExists('css', '.media--type-image > div');
$assert_session->elementExists('css', 'img.image-style-medium', $media_item);
$assert_session->elementExists('css', 'img', $media_item);
// Assert that the image src is the original image and not an image style.
$media_image = $assert_session->elementExists('css', '.media--type-image img');
$expected_image_src = file_url_transform_relative(file_create_url(\Drupal::token()->replace('public://[date:custom:Y]-[date:custom:m]/example_1.jpeg')));
$this->assertEquals($expected_image_src, $media_image->getAttribute('src'));
$test_filename = $this->randomMachineName() . '.txt';
$test_filepath = 'public://' . $test_filename;
......@@ -163,8 +166,8 @@ public function testMediaDisplay() {
$assert_session->pageTextNotContains($image_media_name);
// Only one element is present inside the media container.
$this->assertEquals(1, count($page->findAll('css', '.field--name-field-related-media article.media--type-image > div')));
// Assert the image is present, with "medium" image style.
$assert_session->elementExists('css', '.field--name-field-related-media article.media--type-image img.image-style-medium');
// Assert the image is present.
$assert_session->elementExists('css', '.field--name-field-related-media article.media--type-image img');
}
}
......@@ -15,7 +15,7 @@ content:
field_media_image:
label: visually_hidden
settings:
image_style: medium
image_style: ''
image_link: file
third_party_settings: { }
type: image
......
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