Skip to content

Commit e04033e

Browse files
authored
Merge pull request #176 from magento-obsessive-owls/cms-team-1-delivery
[Owls] Products contents order, anchor tag issues, text wrapping
2 parents 31439c7 + aaa5af1 commit e04033e

File tree

75 files changed

+1325
-363
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+1325
-363
lines changed

app/code/Magento/PageBuilder/Setup/DataConverter/Renderer/AdvancedSliderItem.php

+6-2
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,11 @@ public function render(array $itemData, array $additionalData = []) : string
120120
}
121121

122122
// mobile wrapper div
123-
$rootElementHtml = '<div' . $this->printAttributes($rootElementAttributes) . '><div data-element="link"';
123+
$linkNodeName = isset($eavData['link_url']) ? 'a' : 'div';
124+
$linkDataElementName = isset($eavData['link_url']) ? 'link' : 'empty_link';
125+
126+
$rootElementHtml = '<div' . $this->printAttributes($rootElementAttributes) . '>';
127+
$rootElementHtml .= '<' . $linkNodeName . ' data-element="' . $linkDataElementName . '"';
124128
$rootElementHtml .= isset($eavData['link_url']) ? ' href="' . $eavData['link_url'] . '">' : '>';
125129
$rootElementHtml .= '<div'
126130
. $this->printAttributes($wrapperDivElementAttributes)
@@ -135,7 +139,7 @@ public function render(array $itemData, array $additionalData = []) : string
135139
. $buttonElementHtml
136140
. '</div></div></div>';
137141

138-
$rootElementHtml .= '</div></div>';
142+
$rootElementHtml .= '</' . $linkNodeName . '></div>';
139143

140144
return $rootElementHtml;
141145
}

app/code/Magento/PageBuilder/Setup/DataConverter/Renderer/ButtonItem.php

+11-4
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ class ButtonItem implements RendererInterface
2626
*/
2727
private $eavAttributeLoader;
2828

29+
/**
30+
* @param StyleExtractorInterface $styleExtractor
31+
* @param EavAttributeLoaderInterface $eavAttributeLoader
32+
*/
2933
public function __construct(
3034
StyleExtractorInterface $styleExtractor,
3135
EavAttributeLoaderInterface $eavAttributeLoader
@@ -35,7 +39,7 @@ public function __construct(
3539
}
3640

3741
/**
38-
* {@inheritdoc}
42+
* @inheritdoc
3943
*/
4044
public function render(array $itemData, array $additionalData = []) : string
4145
{
@@ -67,12 +71,15 @@ public function render(array $itemData, array $additionalData = []) : string
6771
$rootElementHtml .= $attributeValue ? " $attributeName=\"$attributeValue\"" : '';
6872
}
6973

70-
$rootElementHtml .= '><a data-element="link" href="'
71-
. ($eavData['link_url'] ?? '') . '"'
74+
$linkNodeName = isset($eavData['link_url']) ? 'a' : 'div';
75+
$linkDataElementName = isset($eavData['link_url']) ? 'link' : 'empty_link';
76+
77+
$rootElementHtml .= '><' . $linkNodeName . ' data-element="' . $linkDataElementName . '"'
78+
. (isset($eavData['link_url']) ? ' href="' . $eavData['link_url'] . '"' : '')
7279
. $buttonStyleAttribute
7380
. ' class="pagebuilder-button-primary"><span data-element="link_text">'
7481
. ($eavData['link_text'] ?? '')
75-
. '</span></a></div>';
82+
. '</span></' . $linkNodeName . '></div>';
7683

7784
return $rootElementHtml;
7885
}

app/code/Magento/PageBuilder/Setup/DataConverter/Renderer/Driver.php

+18-7
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ public function __construct(
5050

5151
/**
5252
* @inheritdoc
53+
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
5354
*/
5455
public function render(array $itemData, array $additionalData = []) : string
5556
{
@@ -84,11 +85,19 @@ public function render(array $itemData, array $additionalData = []) : string
8485
}
8586
}
8687
$rootElementAttributes['style'] .= $margin;
87-
$linkAttributes = [
88-
'data-element' => 'link',
89-
'href' => $eavData['link_url'] ?? '',
90-
'target' => isset($eavData['target_blank']) && $eavData['target_blank'] ? '_blank' : '',
91-
];
88+
89+
// if link_url is present, add href and target attribute
90+
if (isset($eavData['link_url'])) {
91+
$linkAttributes = [
92+
'data-element' => 'link',
93+
'href' => $eavData['link_url'],
94+
'target' => isset($eavData['target_blank']) && $eavData['target_blank'] ? '_blank' : '',
95+
];
96+
} else {
97+
$linkAttributes = [
98+
'data-element' => 'empty_link',
99+
];
100+
}
92101

93102
$imageAttributes = [
94103
'data-element' => 'wrapper',
@@ -120,9 +129,11 @@ public function render(array $itemData, array $additionalData = []) : string
120129
. '</button>';
121130
}
122131

132+
$linkNodeName = isset($eavData['link_url']) ? 'a' : 'div';
133+
123134
return '<div'
124135
. $this->printAttributes($rootElementAttributes)
125-
. '><div'
136+
. '><' . $linkNodeName
126137
. $this->printAttributes($linkAttributes)
127138
. '>'
128139
. $imageElementHtml
@@ -133,7 +144,7 @@ public function render(array $itemData, array $additionalData = []) : string
133144
. $overlayElementHtml
134145
. '<div class="pagebuilder-poster-content"><div data-element="content"></div>'
135146
. $buttonHtml
136-
. '</div></div></div></div></div>';
147+
. '</div></div></div></' . $linkNodeName . '></div>';
137148
}
138149

139150
/**
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<!-- Consider moving action group to core, or utilising core action group if one is added at a later date -->
11+
<actionGroup name="addUpSellProductBySku" extends="addRelatedProductBySku">
12+
<click selector="{{AdminProductFormRelatedUpSellCrossSellSection.AddUpSellProductsButton}}" stepKey="clickAddRelatedProductButton"/>
13+
<conditionalClick selector="{{AdminAddUpSellProductsModalSection.Modal}} {{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminAddUpSellProductsModalSection.Modal}} {{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters"/>
14+
<click selector="{{AdminAddUpSellProductsModalSection.Modal}} {{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters"/>
15+
<fillField selector="{{AdminAddUpSellProductsModalSection.Modal}} {{AdminProductGridFilterSection.skuFilter}}" userInput="{{sku}}" stepKey="fillProductSkuFilter"/>
16+
<click selector="{{AdminAddUpSellProductsModalSection.Modal}} {{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/>
17+
<waitForPageLoad stepKey="waitForPageToLoad"/>
18+
<click selector="{{AdminAddUpSellProductsModalSection.Modal}}{{AdminProductModalSlideGridSection.productGridXRowYColumnButton('1', '1')}}" stepKey="selectProduct"/>
19+
<click selector="{{AdminAddUpSellProductsModalSection.AddSelectedProductsButton}}" stepKey="addRelatedProductSelected"/>
20+
<waitForPageLoad stepKey="waitForPageToLoad1"/>
21+
</actionGroup>
22+
</actionGroups>

app/code/Magento/PageBuilder/Test/Mftf/ActionGroup/WYSIWYGActionGroup.xml

+15
Original file line numberDiff line numberDiff line change
@@ -161,4 +161,19 @@
161161
<actualResult type="variable">textareaValue</actualResult>
162162
</assertEquals>
163163
</actionGroup>
164+
<actionGroup name="validateContentWordHeight">
165+
<arguments>
166+
<argument name="page"/>
167+
<argument name="height" type="string"/>
168+
<argument name="index" defaultValue="1" type="string"/>
169+
</arguments>
170+
<!-- Validate content height -->
171+
<comment userInput="Validate content height" stepKey="commentValidateContentHeight"/>
172+
<executeJS function="return {{page.contentJS(index)}}.getBoundingClientRect().height" stepKey="elementContentHeight"/>
173+
<executeJS function="return Math.round(({$elementContentHeight}/{{height}})*100)/100" stepKey="contentHeightRatio"/>
174+
<assertEquals stepKey="assertContentHeightRatio">
175+
<expectedResult type="int">1</expectedResult>
176+
<actualResult type="variable">contentHeightRatio</actualResult>
177+
</assertEquals>
178+
</actionGroup>
164179
</actionGroups>

app/code/Magento/PageBuilder/Test/Mftf/Data/BannerData.xml

-3
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,6 @@
8888
<data key="fieldName">link_url</data>
8989
<data key="value"/>
9090
</entity>
91-
<entity name="PageBuilderBannerLinkUrlProperty_EmptyFrontend" type="pagebuilder_banner_linkUrl_property">
92-
<data key="value">javascript:void(0)</data>
93-
</entity>
9491
<entity name="PageBuilderBannerLinkUrlPropertyValidate" type="pagebuilder_banner_linkUrl_property">
9592
<data key="name">Link</data>
9693
<data key="section">contents</data>

app/code/Magento/PageBuilder/Test/Mftf/Data/ButtonItemData.xml

-3
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,6 @@
8686
<entity name="PageBuilderButtonItemLink_Empty" type="pagebuilder_button_item_link_property" extends="PageBuilderButtonItemLink_Template">
8787
<data key="value"/>
8888
</entity>
89-
<entity name="PageBuilderButtonItemLink_EmptyFrontend" type="pagebuilder_button_item_link_property" extends="PageBuilderButtonItemLink_Template">
90-
<data key="value">javascript:void(0)</data>
91-
</entity>
9289
<entity name="PageBuilderButtonItemLink_NotSecure" type="pagebuilder_button_item_link_property" extends="PageBuilderButtonItemLink_Template">
9390
<data key="value">http://url.magento/</data>
9491
</entity>

app/code/Magento/PageBuilder/Test/Mftf/Data/CommonContentTypeData.xml

+8
Original file line numberDiff line numberDiff line change
@@ -113,4 +113,12 @@
113113
<data key="name">Box Shadow</data>
114114
<data key="value">rgb(153, 153, 153) 0px 0px 0px 1px</data>
115115
</entity>
116+
<!-- Message -->
117+
<entity name="PageBuilderMessageProperty_WordBreak" type="pagebuilder_message_property">
118+
<data key="name">Message Text</data>
119+
<data key="section">contents</data>
120+
<data key="role">textarea</data>
121+
<data key="fieldName">message</data>
122+
<data key="value">Magento1111111 Page11111111111</data>
123+
</entity>
116124
</entities>

app/code/Magento/PageBuilder/Test/Mftf/Data/SlideData.xml

-3
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,6 @@
5454
<data key="fieldName">link_url</data>
5555
<data key="value"/>
5656
</entity>
57-
<entity name="PageBuilderSlideItemLinkURL_EmptyFrontend" type="pagebuilder_slide_item_link_url_property">
58-
<data key="value">javascript:void(0)</data>
59-
</entity>
6057
<entity name="PageBuilderSlideItemLinkURL_External" type="pagebuilder_slide_item_link_url_property">
6158
<data key="name">Link</data>
6259
<data key="section">general</data>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
11+
<!-- Consider moving to core, when up-sell tests are implemented -->
12+
<section name="AdminProductFormRelatedUpSellCrossSellSection">
13+
<element name="AddUpSellProductsButton" type="button" selector="button[data-index='button_upsell']" timeout="30"/>
14+
</section>
15+
<section name="AdminAddUpSellProductsModalSection">
16+
<element name="Modal" type="button" selector=".product_form_product_form_related_upsell_modal"/>
17+
<element name="AddSelectedProductsButton" type="button" selector="//aside[contains(@class, 'product_form_product_form_related_upsell_modal')]//button/span[contains(text(), 'Add Selected Products')]" timeout="30"/>
18+
</section>
19+
</sections>

app/code/Magento/PageBuilder/Test/Mftf/Section/CatalogSection.xml

+11
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,15 @@
1111
<section name="PageBuilderCatalog">
1212
<element name="openPageBuilder" type="button" selector="[data-index='description'] button.action-default"/>
1313
</section>
14+
<section name="StorefrontProductFullWidth">
15+
<element name="description" type="button" selector=".page-main-description"/>
16+
<element name="attributes" type="button" selector=".page-main-pagebuilder-attributes"/>
17+
<element name="moreInformation" type="button" selector=".additional-attributes-wrapper"/>
18+
<!-- Consider moving the below to core -->
19+
<element name="infoMain" type="button" selector=".product-info-main"/>
20+
<element name="media" type="button" selector=".product.media"/>
21+
<element name="reviews" type="button" selector=".block.review-add"/>
22+
<element name="related" type="button" selector=".block.related"/>
23+
<element name="upsell" type="button" selector=".block.upsell"/>
24+
</section>
1425
</sections>

app/code/Magento/PageBuilder/Test/Mftf/Section/PageBuilderBannerSection.xml

+5
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
<element name="backgroundImage" type="button" selector="(//div[@data-role='banner'])[{{arg1}}]//div[@data-element='wrapper'][contains(@style,'background-image: url(') and contains(@style,'{{arg2}}')]" parameterized="true"/>
3232
<element name="noBackgroundImage" type="button" selector="(//div[@data-role='banner'])[{{arg1}}]//div[@data-element='wrapper'][not(contains(@style,'background-image:'))]" parameterized="true"/>
3333
<!-- Content Configuration -->
34+
<element name="contentJS" type="text" selector="document.querySelectorAll('[data-role=banner] [data-element=content]')[{{arg1}} - 1]" parameterized="true"/>
3435
<element name="messageContent" type="text" selector="(//div[@data-role='banner'])[{{arg1}}]//div[@data-element='wrapper']//div[@data-element='content']//p[.='{{arg2}}']" parameterized="true"/>
3536
<element name="noMessageContent" type="text" selector="(//div[@data-role='banner'])[{{arg1}}]//div[@data-element='wrapper']//div[@data-element='content'][.='Edit Banner Text'][not(*)]" parameterized="true"/>
3637
<element name="messageContentTextArea" type="text" selector="(//div[@data-role='banner'])[{{arg1}}]//div[@data-element='wrapper']//div[@data-element='content'][.='{{arg2}}']" parameterized="true"/>
@@ -61,6 +62,9 @@
6162
<element name="posterPadding" type="text" selector="(//div[@data-role='banner'])[{{arg1}}]//div[@data-element='overlay'][contains(@style,'padding: {{arg2}}px;')]" parameterized="true"/>
6263
<element name="collagePadding" type="text" selector="(//div[@data-role='banner'])[{{arg1}}]//div[@data-element='wrapper'][contains(@style,'padding: {{arg2}}px;')]" parameterized="true"/>
6364
</section>
65+
<section name="BannerOnFrontendEmptyLink">
66+
<element name="linkUrl" type="button" selector="(//div[@data-role='banner'])[{{arg1}}]/div[@data-element='empty_link'][not(@href) and not(@target)][not(@href='{{arg2}}')]" parameterized="true"/>
67+
</section>
6468
<section name="BannerOnBackend">
6569
<element name="base" type="button" selector="(//div[contains(@class,'pagebuilder-banner') and contains(@class,'pagebuilder-content-type')])[{{arg1}}]" parameterized="true"/>
6670
<element name="hidden" type="button" selector="(//div[contains(@class,'pagebuilder-banner') and contains(@class,'pagebuilder-content-type')])[{{arg1}}]/ancestor::*[contains(@class, 'pagebuilder-content-type-wrapper') and contains(@class, 'pagebuilder-content-type-hidden')]" parameterized="true"/>
@@ -91,6 +95,7 @@
9195
<element name="backgroundImage" type="button" selector="(//div[contains(@class,'pagebuilder-banner') and @data-element='main'])[{{arg1}}]//div[@data-element='wrapper'][contains(@style,'background-image: url(') and contains(@style,'{{arg2}}')]" parameterized="true"/>
9296
<element name="noBackgroundImage" type="button" selector="(//div[contains(@class,'pagebuilder-banner') and @data-element='main'])[{{arg1}}]//div[@data-element='wrapper'][not(contains(@style,'background-image:'))]" parameterized="true"/>
9397
<!-- Content Configuration -->
98+
<element name="contentJS" type="text" selector="document.querySelectorAll('[data-role=banner] div.inline-wysiwyg')[{{arg1}} - 1]" parameterized="true"/>
9499
<element name="messageContent" type="text" selector="(//div[contains(@class,'pagebuilder-banner') and @data-element='main'])[{{arg1}}]//div[@data-element='content']//p[.='{{arg2}}']" parameterized="true"/>
95100
<element name="noMessageContent" type="text" selector="(//div[contains(@class,'pagebuilder-banner') and @data-element='main'])[{{arg1}}]//div[@data-element='content'][.='Edit Banner Text'][not(*)]" parameterized="true"/>
96101
<element name="messageContentText" type="text" selector="(//div[contains(@class,'pagebuilder-banner')])[{{arg1}}]/div//div[contains(@class, 'pagebuilder-banner-text-content')]//*[contains(.,'{{arg2}}') and contains(@class, 'inline-wysiwyg')]" parameterized="true"/>

0 commit comments

Comments
 (0)