Skip to content
Snippets Groups Projects
Commit f25412aa authored by Gábor Hojtsy's avatar Gábor Hojtsy
Browse files

Issue #3027236 by rachel_norfolk, kjay, tonypaulbarker, akshay_d, shaal,...

Issue #3027236 by rachel_norfolk, kjay, tonypaulbarker, akshay_d, shaal, Eli-T, Not Real, babusaheb.vikas: Umami - hero block is identical on Home and Recipe pages, so potentially confusing
parent 000dbabc
No related branches found
No related tags found
No related merge requests found
langcode: en
status: true
dependencies:
content:
- 'block_content:banner_block:9aadf4a1-ded6-4017-a10d-a5e043396edf'
enforced:
module:
- demo_umami_content
module:
- block_content
- system
theme:
- umami
id: umami_banner_home
theme: umami
region: banner_top
weight: -7
provider: null
plugin: 'block_content:9aadf4a1-ded6-4017-a10d-a5e043396edf'
settings:
id: 'block_content:9aadf4a1-ded6-4017-a10d-a5e043396edf'
label: 'Umami Home Banner'
provider: block_content
label_display: '0'
status: true
info: ''
view_mode: full
visibility:
request_path:
id: request_path
pages: '<front>'
negate: false
context_mapping: { }
......@@ -14,7 +14,7 @@ dependencies:
id: umami_banner_recipes
theme: umami
region: banner_top
weight: -10
weight: -8
provider: null
plugin: 'block_content:4c7d58a3-a45d-412d-9068-259c57e40541'
settings:
......@@ -28,6 +28,6 @@ settings:
visibility:
request_path:
id: request_path
pages: "/recipes\r\n<front>"
pages: "/recipes\r\n"
negate: false
context_mapping: { }
Image diff could not be displayed: it is too large. Options to address this: view the blob.
......@@ -329,9 +329,9 @@ protected function importPages() {
protected function importBlockContent() {
$module_path = $this->moduleHandler->getModule('demo_umami_content')->getPath();
$block_content_entities = [
'umami_recipes_banner' => [
'uuid' => '4c7d58a3-a45d-412d-9068-259c57e40541',
'info' => 'Umami Recipes Banner',
'umami_home_banner' => [
'uuid' => '9aadf4a1-ded6-4017-a10d-a5e043396edf',
'info' => 'Umami Home Banner',
'type' => 'banner_block',
'field_title' => [
'value' => 'Super easy vegetarian pasta bake',
......@@ -342,7 +342,7 @@ protected function importBlockContent() {
$node = reset($nodes);
return $this->aliasManager->getAliasByPath('/node/' . $node->id());
}),
'title' => 'Super easy vegetarian pasta bake',
'title' => 'View recipe',
],
'field_summary' => [
'value' => 'A wholesome pasta bake is the ultimate comfort food. This delicious bake is super quick to prepare and an ideal midweek meal for all the family.',
......@@ -352,6 +352,29 @@ protected function importBlockContent() {
'alt' => 'Mouth watering vegetarian pasta bake with rich tomato sauce and cheese toppings',
],
],
'umami_recipes_banner' => [
'uuid' => '4c7d58a3-a45d-412d-9068-259c57e40541',
'info' => 'Umami Recipes Banner',
'type' => 'banner_block',
'field_title' => [
'value' => 'Vegan chocolate and nut brownies',
],
'field_content_link' => [
'uri' => 'internal:' . call_user_func(function () {
$nodes = $this->entityTypeManager->getStorage('node')->loadByProperties(['title' => 'Vegan chocolate and nut brownies']);
$node = reset($nodes);
return $this->aliasManager->getAliasByPath('/node/' . $node->id());
}),
'title' => 'View recipe',
],
'field_summary' => [
'value' => 'These sumptuous brownies should be gooey on the inside and crisp on the outside. A perfect indulgence!',
],
'field_banner_image' => [
'target_id' => $this->createFileEntity($module_path . '/default_content/images/vegan-brownies-hero-umami.jpg'),
'alt' => 'A stack of chocolate and pecan brownies, sprinkled with pecan crumbs and crushed walnut, fresh out of the oven',
],
],
'umami_disclaimer' => [
'uuid' => '9b4dcd67-99f3-48d0-93c9-2c46648b29de',
'info' => 'Umami disclaimer',
......
......@@ -73,7 +73,6 @@ public function testReinstall() {
$this->assertRecipesImported($node_storage);
$this->assertArticlesImported($node_storage);
$this->assertImportedCustomBlock($block_storage);
}
/**
......@@ -120,16 +119,19 @@ protected function assertArticlesImported(EntityStorageInterface $node_storage)
*/
protected function assertImportedCustomBlock(EntityStorageInterface $block_storage) {
$assert = $this->assertSession();
$this->drupalGet('/recipes');
foreach ($this->expectedBlocks() as $block_info) {
$this->drupalGet($block_info['path']);
// Verify that the block is placed.
$assert->pageTextContains($block_info['unique_text']);
// For blocks that have image alt text, also verify the presence of the
// expected alt text.
if (isset($block_info['image_alt_text'])) {
$img_alt_text = $assert->elementExists('css', $block_info['image_css_selector'])->getAttribute('alt');
$this->assertEquals($block_info['image_alt_text'], $img_alt_text);
}
// Verify that the block can be loaded.
$count = $block_storage->getQuery()
->condition('type', $block_info['type'])
......@@ -147,18 +149,29 @@ protected function assertImportedCustomBlock(EntityStorageInterface $block_stora
protected function expectedBlocks() {
return [
[
'path' => '<front>',
'type' => 'banner_block',
'uuid' => '4c7d58a3-a45d-412d-9068-259c57e40541',
'uuid' => '9aadf4a1-ded6-4017-a10d-a5e043396edf',
'unique_text' => 'A wholesome pasta bake is the ultimate comfort food.',
'image_css_selector' => '#block-umami-banner-recipes img',
'image_css_selector' => '#block-umami-banner-home img',
'image_alt_text' => 'Mouth watering vegetarian pasta bake with rich tomato sauce and cheese toppings',
],
[
'path' => '/recipes',
'type' => 'banner_block',
'uuid' => '4c7d58a3-a45d-412d-9068-259c57e40541',
'unique_text' => 'These sumptuous brownies should be gooey on the inside and crisp on the outside. A perfect indulgence!',
'image_css_selector' => '#block-umami-banner-recipes img',
'image_alt_text' => 'A stack of chocolate and pecan brownies, sprinkled with pecan crumbs and crushed walnut, fresh out of the oven',
],
[
'path' => '/recipes',
'type' => 'disclaimer_block',
'uuid' => '9b4dcd67-99f3-48d0-93c9-2c46648b29de',
'unique_text' => 'is a fictional magazine and publisher for illustrative purposes only',
],
[
'path' => '/recipes',
'type' => 'footer_promo_block',
'uuid' => '924ab293-8f5f-45a1-9c7f-2423ae61a241',
'unique_text' => 'Magazine exclusive articles, recipes and plenty of reasons to get your copy today.',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment