diff --git a/features/show_featured_pages_on_homepage.feature b/features/show_featured_pages_on_homepage.feature index daa2964..b0dfe46 100644 --- a/features/show_featured_pages_on_homepage.feature +++ b/features/show_featured_pages_on_homepage.feature @@ -15,6 +15,6 @@ Feature: Show featured pages on homepage Scenario: See the featured pages on homepage When I visit this channel's homepage Then I should see 3 featured pages. - And I should see featured page "Blog Page 1" + And I should see featured page "Modern design trends in Europe" And I should see featured page "Blog Page 2" - And I should see featured page "Blog Page 3" + And I should see featured page "Shoe sizes tables of the World" diff --git a/spec/Renderer/Block/SuluBlockRendererStrategySpec.php b/spec/Renderer/Block/SuluBlockRendererStrategySpec.php index d3dabf8..da565ea 100644 --- a/spec/Renderer/Block/SuluBlockRendererStrategySpec.php +++ b/spec/Renderer/Block/SuluBlockRendererStrategySpec.php @@ -22,9 +22,8 @@ class SuluBlockRendererStrategySpec extends ObjectBehavior function let( SuluBlockRenderStrategyInterface $blockRenderer1, SuluBlockRenderStrategyInterface $blockRenderer2, - LoggerInterface $logger - ) - { + LoggerInterface $logger, + ) { $this->beConstructedWith([$blockRenderer1, $blockRenderer2], $logger); } diff --git a/spec/Renderer/Page/SuluPageRendererStrategySpec.php b/spec/Renderer/Page/SuluPageRendererStrategySpec.php index 9d465b4..648d019 100644 --- a/spec/Renderer/Page/SuluPageRendererStrategySpec.php +++ b/spec/Renderer/Page/SuluPageRendererStrategySpec.php @@ -21,7 +21,7 @@ class SuluPageRendererStrategySpec extends ObjectBehavior function let( SuluPageRenderStrategyInterface $pageRenderer1, SuluPageRenderStrategyInterface $pageRenderer2, - LoggerInterface $logger + LoggerInterface $logger, ) { $this->beConstructedWith([$pageRenderer1, $pageRenderer2], $logger); } diff --git a/tests/Application/assets/shop/entry.js b/tests/Application/assets/shop/entry.js index e69de29..058b864 100644 --- a/tests/Application/assets/shop/entry.js +++ b/tests/Application/assets/shop/entry.js @@ -0,0 +1,2 @@ +import './scss/main.scss'; +import './img'; diff --git a/tests/Application/assets/shop/img/a-fashionable-young-man-in-suit-walking-down-the-stiars.webp b/tests/Application/assets/shop/img/a-fashionable-young-man-in-suit-walking-down-the-stiars.webp new file mode 100644 index 0000000..d3fbc7d Binary files /dev/null and b/tests/Application/assets/shop/img/a-fashionable-young-man-in-suit-walking-down-the-stiars.webp differ diff --git a/tests/Application/assets/shop/img/fashion-magazines-on-table.webp b/tests/Application/assets/shop/img/fashion-magazines-on-table.webp new file mode 100644 index 0000000..3628ad2 Binary files /dev/null and b/tests/Application/assets/shop/img/fashion-magazines-on-table.webp differ diff --git a/tests/Application/assets/shop/img/index.js b/tests/Application/assets/shop/img/index.js new file mode 100644 index 0000000..84138d9 --- /dev/null +++ b/tests/Application/assets/shop/img/index.js @@ -0,0 +1,4 @@ +import './a-fashionable-young-man-in-suit-walking-down-the-stiars.webp'; +import './fashion-magazines-on-table.webp'; +import './laughing-woman-in-yellowish-dress-on-stairs.webp'; +import './trench-coat-in-shopping-window.webp'; diff --git a/tests/Application/assets/shop/img/laughing-woman-in-yellowish-dress-on-stairs.webp b/tests/Application/assets/shop/img/laughing-woman-in-yellowish-dress-on-stairs.webp new file mode 100644 index 0000000..54b1daf Binary files /dev/null and b/tests/Application/assets/shop/img/laughing-woman-in-yellowish-dress-on-stairs.webp differ diff --git a/tests/Application/assets/shop/img/trench-coat-in-shopping-window.webp b/tests/Application/assets/shop/img/trench-coat-in-shopping-window.webp new file mode 100644 index 0000000..e7f3bc2 Binary files /dev/null and b/tests/Application/assets/shop/img/trench-coat-in-shopping-window.webp differ diff --git a/tests/Application/assets/shop/scss/helpers.scss b/tests/Application/assets/shop/scss/helpers.scss new file mode 100644 index 0000000..9cec4ae --- /dev/null +++ b/tests/Application/assets/shop/scss/helpers.scss @@ -0,0 +1,20 @@ +.pl-0 { + padding-left: 0 !important; +} + +.pr-0 { + padding-right: 0 !important; +} + +.mb-15 { + margin-bottom: 15px !important; +} + +.d-block { + display: block !important; +} + +.text-15 { + font-size: 15px !important; + line-height: 1.8 !important; +} diff --git a/tests/Application/assets/shop/scss/main.scss b/tests/Application/assets/shop/scss/main.scss new file mode 100644 index 0000000..e2909b2 --- /dev/null +++ b/tests/Application/assets/shop/scss/main.scss @@ -0,0 +1 @@ +@import "helpers"; diff --git a/tests/Application/templates/bundles/BitBagSyliusSuluPlugin/shop/page/featuredPages.html.twig b/tests/Application/templates/bundles/BitBagSyliusSuluPlugin/shop/page/featuredPages.html.twig index f07cd00..757cf57 100644 --- a/tests/Application/templates/bundles/BitBagSyliusSuluPlugin/shop/page/featuredPages.html.twig +++ b/tests/Application/templates/bundles/BitBagSyliusSuluPlugin/shop/page/featuredPages.html.twig @@ -1,14 +1,39 @@ -
+
{% for link in links %}
-
-
- {{ link.content.title }} -
-
-
- {{ link.content.article|raw }} +
+ {% set has_thumbnail = link.content.thumbnail_url is defined %} + {% if has_thumbnail %} + + {% endif %} +
+ + {% if link.content.excerpt_title != '' %} + {{ link.content.excerpt_title }} + {% else %} + {{ link.content.title }} + {% endif %} + +

+ {% if link.content.excerpt_description != '' %} + {{ link.content.excerpt_description|raw }} + {% else %} + {{ link.content.article|raw }} + {% endif %} +

diff --git a/tests/Application/templates/bundles/SyliusShopBundle/_styles.html.twig b/tests/Application/templates/bundles/SyliusShopBundle/_styles.html.twig index fd2c7cb..c97ec83 100644 --- a/tests/Application/templates/bundles/SyliusShopBundle/_styles.html.twig +++ b/tests/Application/templates/bundles/SyliusShopBundle/_styles.html.twig @@ -1 +1,2 @@ {{ encore_entry_link_tags('shop-entry', null, 'shop') }} +{{ encore_entry_link_tags('test_app-entry', null, 'shop') }} diff --git a/tests/Application/webpack.config.js b/tests/Application/webpack.config.js index 0d3d978..eb4b31b 100644 --- a/tests/Application/webpack.config.js +++ b/tests/Application/webpack.config.js @@ -9,6 +9,7 @@ const uiBundleResources = path.resolve(syliusBundles, 'UiBundle/Resources/privat Encore .setOutputPath('public/build/shop/') .setPublicPath('/build/shop') + .addEntry('test_app-entry', './assets/shop/entry.js') .addEntry('shop-entry', '../../vendor/sylius/sylius/src/Sylius/Bundle/ShopBundle/Resources/private/entry.js') .disableSingleRuntimeChunk() .cleanupOutputBeforeBuild() diff --git a/tests/Behat/ApiResponseMock/featured_pages.json b/tests/Behat/ApiResponseMock/featured_pages.json index 00a76e2..46c0e48 100644 --- a/tests/Behat/ApiResponseMock/featured_pages.json +++ b/tests/Behat/ApiResponseMock/featured_pages.json @@ -10,42 +10,46 @@ "article": "

FeaturedPages

", "links": [ { - "id": "6c0542ce-a3e9-449d-b684-783a2e7d38ae", + "id": "7c6acba2-d1b6-4985-96e2-b12db89b8414", "nodeType": 1, "type": "page", "template": "blog_page", "content": { "title": "Blog Page 1", "url": "/blog-page-1", - "article": "

Blog Page 1

", - "excerptTitle": "", - "excerptDescription": "" + "article": "Fashion in Europe encompass a minimalist approach, sustainable materials, and the use of natural light. Emphasizing functionality, elegance, and eco-friendly solutions, these trends prioritize harmonious, sleek interiors with an innovative design approach. European design trends showcase simplicity of form and a commitment to innovation.", + "excerpt_title": "Modern design trends in Europe", + "excerpt_description": "", + "thumbnail_url": "build/shop/images/a-fashionable-young-man-in-suit-walking-down-the-stiars.webp", + "thumbnail_alt": "Example thumbnail 2" }, "view": { "title": [], "url": [], "article": [], - "excerptTitle": [], - "excerptDescription": [] + "excerpt_title": [], + "excerpt_description": [] }, - "author": "1", - "authored": "2024-02-12T20:36:49+0000", + "author": 1, + "authored": "2024-02-12T20:35:45+0000", "changer": 1, - "changed": "2024-02-13T13:58:45+0000", + "changed": "2024-02-12T20:35:45+0000", "creator": 1, - "created": "2024-02-12T20:36:49+0000" + "created": "2024-02-12T20:35:45+0000" }, { - "id": "7c6acba2-d1b6-4985-96e2-b12db89b8414", + "id": "7c6acba2-d1b6-4985-96e2-b12db89b8415", "nodeType": 1, "type": "page", "template": "blog_page", "content": { "title": "Blog Page 2", "url": "/blog-page-2", - "article": "

Blog Page 2

", - "excerptTitle": "", - "excerptDescription": "" + "article": "Winter is coming! So here is the problem: how to dress warm and look good at the same time?", + "excerpt_title": "", + "excerpt_description": "From layering techniques to the best fabric choices, this guide offers practical tips for creating fashionable winter looks without sacrificing comfort. Whether it's cozy sweaters, insulated boots, or fashionable outerwear, this guide covers everything you need to know to stay comfortable and chic in the winter.", + "thumbnail_url": "build/shop/images/fashion-magazines-on-table.webp", + "thumbnail_alt": "Example thumbnail 3" }, "view": { "title": [], @@ -62,30 +66,32 @@ "created": "2024-02-12T20:35:45+0000" }, { - "id": "7c6acba2-d1b6-4985-96e2-b12db89b8414", + "id": "6c0542ce-a3e9-449d-b684-783a2e7d38ae", "nodeType": 1, "type": "page", "template": "blog_page", "content": { "title": "Blog Page 3", "url": "/blog-page-3", - "article": "

Blog Page 3

", - "excerptTitle": "", - "excerptDescription": "" + "article": "Shoe size tables vary worldwide. Many countries use the metric system for shoe sizing, while others rely on the imperial system. It's important to consult a specific shoe size conversion chart when purchasing footwear internationally.", + "excerpt_title": "Shoe sizes tables of the World", + "excerpt_description": "Shoe size tables vary worldwide. Many countries use the metric system for shoe sizing, while others rely on the imperial system. It's important to consult a specific shoe size conversion chart when purchasing footwear internationally.", + "thumbnail_url": "build/shop/images/laughing-woman-in-yellowish-dress-on-stairs.webp", + "thumbnail_alt": "Example thumbnail 1" }, "view": { "title": [], "url": [], "article": [], - "excerptTitle": [], - "excerptDescription": [] + "excerpt_title": [], + "excerpt_description": [] }, - "author": 1, - "authored": "2024-02-12T20:35:45+0000", + "author": "1", + "authored": "2024-02-12T20:36:49+0000", "changer": 1, - "changed": "2024-02-12T20:35:45+0000", + "changed": "2024-02-13T13:58:45+0000", "creator": 1, - "created": "2024-02-12T20:35:45+0000" + "created": "2024-02-12T20:36:49+0000" } ], "blocks": [] diff --git a/tests/Behat/Context/Ui/SuluPageContext.php b/tests/Behat/Context/Ui/SuluPageContext.php index 4872d84..cb74f23 100644 --- a/tests/Behat/Context/Ui/SuluPageContext.php +++ b/tests/Behat/Context/Ui/SuluPageContext.php @@ -44,7 +44,7 @@ public function iShouldSeeAFeaturedPage(string $pageTitle) /** @var NodeElement $page */ foreach ($pages as $page) { - if ($page->find('css', 'span')?->getText() === $pageTitle) { + if ($page->find('css', 'div.ten.wide.wide.column.pr-0 > a')?->getText() === $pageTitle) { return; } }