Skip to content

Commit d5cda5b

Browse files
Merge remote-tracking branch 'mainline/develop' into MAGETWO-91307-clean-up-typescript-errors
2 parents be12f71 + a8325c6 commit d5cda5b

File tree

100 files changed

+8831
-3264
lines changed

Some content is hidden

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

100 files changed

+8831
-3264
lines changed
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
declare(strict_types=1);
8+
9+
namespace Magento\PageBuilder\Block\Adminhtml\ContentType\Edit;
10+
11+
use Magento\Framework\View\Element\UiComponent\Control\ButtonProviderInterface;
12+
13+
class CancelButton implements ButtonProviderInterface
14+
{
15+
/**
16+
* @var string
17+
*/
18+
private $targetName;
19+
20+
/**
21+
* Constructor
22+
*
23+
* @param $targetName
24+
*/
25+
public function __construct(string $targetName)
26+
{
27+
$this->targetName = $targetName;
28+
}
29+
30+
/**
31+
* Retrieve button data
32+
*
33+
* @return array
34+
*/
35+
public function getButtonData(): array
36+
{
37+
return [
38+
'label' => __('Cancel'),
39+
'class' => 'cancel',
40+
'on_click' => '',
41+
'data_attribute' => [
42+
'mage-init' => [
43+
'buttonAdapter' => [
44+
'actions' => [
45+
[
46+
'targetName' => $this->targetName,
47+
'actionName' => 'closeModal',
48+
'params' => [
49+
false,
50+
]
51+
]
52+
]
53+
]
54+
],
55+
'form-role' => 'cancel',
56+
],
57+
'sort_order' => 90
58+
];
59+
}
60+
}

app/code/Magento/PageBuilder/Block/Adminhtml/ContentType/Edit/Close.php renamed to app/code/Magento/PageBuilder/Block/Adminhtml/ContentType/Edit/CloseButton.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
7+
68
namespace Magento\PageBuilder\Block\Adminhtml\ContentType\Edit;
79

810
use Magento\Framework\View\Element\UiComponent\Control\ButtonProviderInterface;
911

10-
class Close implements ButtonProviderInterface
12+
class CloseButton implements ButtonProviderInterface
1113
{
1214
/**
1315
* @var string

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,17 @@ public function render(array $itemData, array $additionalData = [])
4444

4545
$rootElementAttributes = [
4646
'data-role' => 'buttons',
47-
'data-appearance' => 'default',
48-
'class' => $eavData['css_classes'] ?? ''
47+
'data-appearance' => 'inline',
48+
'class' => $eavData['css_classes'] ?? '',
49+
'style' => 'display: inline-block;'
4950
];
5051

5152
if (isset($itemData['formData'])) {
5253
$style = $this->styleExtractor->extractStyle($itemData['formData']);
5354
if (strpos($style, 'padding') === false) {
5455
$style .= ($style ? ' ' : '') . 'padding: 10px 10px 0px;';
5556
}
56-
$rootElementAttributes['style'] = $style;
57+
$rootElementAttributes['style'] .= ' ' . $style;
5758
}
5859

5960
$rootElementHtml = '<div';

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

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ class Map implements RendererInterface
2424
*/
2525
private $eavAttributeLoader;
2626

27+
/**
28+
* @var array
29+
*/
30+
private $rootElementAttributes;
31+
2732
public function __construct(
2833
StyleExtractorInterface $styleExtractor,
2934
EavAttributeLoaderInterface $eavAttributeLoader
@@ -42,26 +47,21 @@ public function render(array $itemData, array $additionalData = [])
4247
}
4348
$eavData = $this->eavAttributeLoader->load($itemData['entityId']);
4449

45-
$rootElementAttributes = [
50+
$this->rootElementAttributes = [
4651
'data-role' => 'map',
4752
'data-appearance' => 'default',
4853
'class' => $eavData['css_classes'] ?? '',
4954
'data-show-controls' => 'true',
50-
'data-position' => '{}',
55+
'data-locations' => '[]',
5156
];
5257

53-
if (isset($eavData['map'])) {
54-
$map = explode(',', $eavData['map']);
55-
$rootElementAttributes['data-position'] = '{&quot;lat&quot;:'
56-
. $map[0]
57-
. ',&quot;lng&quot;:'
58-
. $map[1]
59-
. '}';
60-
}
58+
$this->renderMapLocations($eavData);
6159

6260
if (isset($itemData['formData'])) {
6361
$formData = $itemData['formData'];
64-
$formData['height'] = $eavData['map_height'] ?? '300px';
62+
$formData['height'] = $eavData['map_height']
63+
&& strpos($eavData['map_height'], '%') === false
64+
? $eavData['map_height'] : '300px';
6565

6666
$style = $this->styleExtractor->extractStyle($formData);
6767
if ($style) {
@@ -70,16 +70,33 @@ public function render(array $itemData, array $additionalData = [])
7070
} else {
7171
$style .= ' display: none;';
7272
}
73-
$rootElementAttributes['style'] = $style;
73+
$this->rootElementAttributes['style'] = $style;
7474
}
7575
}
7676

7777
$rootElementHtml = '<div';
78-
foreach ($rootElementAttributes as $attributeName => $attributeValue) {
78+
foreach ($this->rootElementAttributes as $attributeName => $attributeValue) {
7979
$rootElementHtml .= $attributeValue !== '' ? " $attributeName=\"$attributeValue\"" : '';
8080
}
8181
$rootElementHtml .= '></div>';
8282

8383
return $rootElementHtml;
8484
}
85+
86+
/**
87+
* Extract and render Map Location data from EAV
88+
*
89+
* @param array $eavData
90+
*/
91+
private function renderMapLocations($eavData)
92+
{
93+
if (isset($eavData['map'])) {
94+
$map = explode(',', $eavData['map']);
95+
$this->rootElementAttributes['data-locations'] = '[{&quot;position&quot;:{&quot;latitude&quot;:'
96+
. $map[0]
97+
. ',&quot;longitude&quot;:'
98+
. $map[1]
99+
. '}}]';
100+
}
101+
}
85102
}

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

Lines changed: 58 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@
136136
</arguments>
137137
<waitForElementVisible time="10" selector="{{PageBuilderActionsSection.contentTypeInStage(contentType.role)}}" stepKey="waitForContentTypeInStageVisible"/>
138138
<moveMouseOver selector="{{PageBuilderActionsSection.contentTypeInStage(contentType.role)}}" x="10" y="0" stepKey="onMouseOverContentTypeStage"/>
139-
<wait time="4" stepKey="waitForMouseOverAnimation"/>
139+
<waitForPageLoad stepKey="waitForPageLoad"/>
140140
<waitForElementVisible time="10" selector="{{PageBuilderActionsSection.contentTypeOptionsMenu(contentType.role)}}" stepKey="waitForOptions"/>
141141
<click selector="{{PageBuilderActionsSection.contentTypeEdit(contentType.role)}}" stepKey="clickEditContentType"/>
142142
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskToDisappear"/>
@@ -153,7 +153,7 @@
153153
</arguments>
154154
<waitForElementVisible time="20" selector="{{PageBuilderActionsSection.contentTypeInStageByIndex(contentType.role, contentTypeIndex)}}" stepKey="waitForContentTypeInStageVisible"/>
155155
<moveMouseOver selector="{{PageBuilderActionsSection.contentTypeInStageByIndex(contentType.role, contentTypeIndex)}}" x="10" y="0" stepKey="onMouseOverContentTypeStage"/>
156-
<wait time="0.5" stepKey="waitForMouseOverAnimation"/>
156+
<waitForPageLoad stepKey="waitForPageLoad"/>
157157
<waitForElementVisible time="10" selector="{{PageBuilderActionsSection.contentTypeOptionsMenuByIndex(contentType.role, contentTypeIndex)}}" stepKey="waitForOptions"/>
158158
<waitForElementVisible selector="{{PageBuilderActionsSection.contentTypeEditByIndex(contentType.role, contentTypeIndex)}}" stepKey="waitForEditButton"/>
159159
<click selector="{{PageBuilderActionsSection.contentTypeEditByIndex(contentType.role, contentTypeIndex)}}" stepKey="clickEditContentType"/>
@@ -162,6 +162,22 @@
162162
<see userInput="Edit {{contentType.name}}" selector="{{PageBuilderActionsSection.editFormTitle}}" stepKey="seeContentTypeNameInEditFormTitle"/>
163163
<waitForPageLoad stepKey="waitForAnimation2" time="30"/>
164164
</actionGroup>
165+
<actionGroup name="openPageBuilderEditPanelSmallByIndex">
166+
<arguments>
167+
<argument name="contentType" defaultValue=""/>
168+
<argument name="contentTypeIndex" defaultValue="1" type="string"/>
169+
</arguments>
170+
<waitForElementVisible time="20" selector="{{PageBuilderActionsSection.contentTypeInStageByIndex(contentType.role, contentTypeIndex)}}" stepKey="waitForButtonElement"/>
171+
<click selector="{{PageBuilderActionsSection.contentTypeInStageByIndex(contentType.role, contentTypeIndex)}}" stepKey="clickButtonElement"/>
172+
<waitForPageLoad stepKey="waitForPageLoad"/>
173+
<waitForElementVisible time="10" selector="{{PageBuilderActionsSection.contentTypeOptionsMenuByIndex(contentType.role, contentTypeIndex)}}" stepKey="waitForOptions"/>
174+
<waitForElementVisible selector="{{PageBuilderActionsSection.contentTypeEditByIndex(contentType.role, contentTypeIndex)}}" stepKey="waitForEditButton"/>
175+
<click selector="{{PageBuilderActionsSection.contentTypeEditByIndex(contentType.role, contentTypeIndex)}}" stepKey="clickEditButton"/>
176+
<waitForElementVisible time="5" selector="{{PageBuilderActionsSection.editForm}}" stepKey="waitForEditForm"/>
177+
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskToDisappear"/>
178+
<see userInput="Edit {{contentType.name}}" selector="{{PageBuilderActionsSection.editFormTitle}}" stepKey="seeContentTypeNameInEditFormTitle"/>
179+
<waitForPageLoad stepKey="waitForPageLoad2"/>
180+
</actionGroup>
165181
<actionGroup name="duplicateContentType">
166182
<arguments>
167183
<argument name="contentType" defaultValue=""/>
@@ -174,6 +190,20 @@
174190
<click selector="{{PageBuilderActionsSection.contentTypeDuplicate(contentType.role, targetIndex)}}" stepKey="clickDuplicateContentType"/>
175191
<waitForElementVisible selector="{{PageBuilderActionsSection.contentTypeInStageByIndex(contentType.role, expectedIndex)}}" stepKey="waitForDuplicateContentType"/>
176192
</actionGroup>
193+
<actionGroup name="duplicateSmallContentType">
194+
<arguments>
195+
<argument name="contentType" defaultValue=""/>
196+
<argument name="targetIndex" defaultValue="1" type="string"/>
197+
<argument name="expectedIndex" defaultValue="2" type="string"/>
198+
</arguments>
199+
<waitForElementVisible selector="{{PageBuilderActionsSection.contentTypeInStageByIndex(contentType.role, targetIndex)}}" stepKey="waitForContentTypeInStageVisible"/>
200+
<click selector="{{PageBuilderActionsSection.contentTypeInStageByIndex(contentType.role, targetIndex)}}" stepKey="clickContentTypeStage"/>
201+
<waitForPageLoad stepKey="waitForPageLoad1"/>
202+
<waitForElementVisible selector="{{PageBuilderActionsSection.contentTypeOptionsMenuByIndex(contentType.role, targetIndex)}}" stepKey="waitForOptionsMenu"/>
203+
<click selector="{{PageBuilderActionsSection.contentTypeDuplicate(contentType.role, targetIndex)}}" stepKey="clickDuplicateContentType"/>
204+
<waitForPageLoad stepKey="waitForPageLoad2"/>
205+
<waitForElementVisible selector="{{PageBuilderActionsSection.contentTypeInStageByIndex(contentType.role, expectedIndex)}}" stepKey="waitForDuplicateContentType"/>
206+
</actionGroup>
177207
<actionGroup name="openPageBuilderOptionsByIndex">
178208
<arguments>
179209
<argument name="contentType" defaultValue=""/>
@@ -183,14 +213,14 @@
183213
<moveMouseOver selector="{{PageBuilderActionsSection.contentTypeInStageByIndex(contentType.role, contentTypeNumber)}}" x="10" y="0" stepKey="onMouseOverContentTypeStage"/>
184214
<waitForElementVisible time="10" selector="{{PageBuilderActionsSection.contentTypeEditByIndex(contentType.role, contentTypeNumber)}}" stepKey="waitForOptions" />
185215
</actionGroup>
186-
<!-- Remove a content type which is in it's default state -->
187216
<actionGroup name="removeEmptyContentTypeFromStage">
217+
<!-- Remove a content type which is in it's default state -->
188218
<arguments>
189219
<argument name="contentType" defaultValue=""/>
190220
</arguments>
191221
<waitForElementVisible time="10" selector="{{PageBuilderActionsSection.contentTypeInStage(contentType.role)}}" stepKey="waitForContentTypeInStageVisible" />
192222
<moveMouseOver selector="{{PageBuilderActionsSection.contentTypeInStage(contentType.role)}}" x="10" y="5" stepKey="onMouseOverContentTypeStage"/>
193-
<wait time="0.5" stepKey="waitForMouseOverAnimation" />
223+
<waitForPageLoad stepKey="waitForPageLoad"/>
194224
<waitForElementVisible time="10" selector="{{PageBuilderActionsSection.contentTypeOptionsMenuByIndex(contentType.role, '1')}}" stepKey="waitForOptions" />
195225
<click selector="{{PageBuilderActionsSection.contentTypeRemove(contentType.role)}}" stepKey="clickRemoveContentType"/>
196226
</actionGroup>
@@ -204,22 +234,34 @@
204234
<seeElement selector="{{PageBuilderActionsSection.contentTypeInStageByIndex(contentType.role, contentTypeNumber)}}" stepKey="seeContentTypeInStage" />
205235
<waitForElementVisible time="20" selector="{{PageBuilderActionsSection.contentTypeInStageByIndex(contentType.role, contentTypeNumber)}}" stepKey="waitForContentTypeInStageVisible" />
206236
<moveMouseOver selector="{{PageBuilderActionsSection.contentTypeInStageByIndex(contentType.role, contentTypeNumber)}}" x="{{x}}" y="{{y}}" stepKey="onMouseOverContentTypeStage"/>
207-
<wait time="0.5" stepKey="waitForMouseOverAnimation" />
237+
<waitForPageLoad stepKey="waitForPageLoad"/>
208238
<waitForElementVisible time="10" selector="{{PageBuilderActionsSection.contentTypeOptionsMenuByIndex(contentType.role, contentTypeNumber)}}" stepKey="waitForOptions" />
209239
<click selector="{{PageBuilderActionsSection.contentTypeRemoveByIndex(contentType.role, contentTypeNumber)}}" stepKey="clickRemoveContentType"/>
210240
</actionGroup>
241+
<actionGroup name="removeContentTypeFromStageSmallByIndex">
242+
<arguments>
243+
<argument name="contentType" defaultValue=""/>
244+
<argument name="contentTypeIndex" defaultValue="2" type="string"/>
245+
</arguments>
246+
<waitForElementVisible time="10" selector="{{PageBuilderActionsSection.contentTypeInStageByIndex(contentType.role, contentTypeIndex)}}" stepKey="waitForButtonElement"/>
247+
<click selector="{{PageBuilderActionsSection.contentTypeInStageByIndex(contentType.role, contentTypeIndex)}}" stepKey="clickButtonElement"/>
248+
<waitForPageLoad stepKey="waitForPageLoad"/>
249+
<waitForElementVisible time="10" selector="{{PageBuilderActionsSection.contentTypeOptionsMenuByIndex(contentType.role, contentTypeIndex)}}" stepKey="waitForOptions"/>
250+
<waitForElementVisible time="10" selector="{{PageBuilderActionsSection.contentTypeRemoveByIndex(contentType.role, contentTypeIndex)}}" stepKey="waitForRemoveButton"/>
251+
<click selector="{{PageBuilderActionsSection.contentTypeRemoveByIndex(contentType.role, contentTypeIndex)}}" stepKey="clickRemoveContentType"/>
252+
<waitForPageLoad stepKey="waitForPageLoad2"/>
253+
</actionGroup>
211254
<actionGroup name="confirmRemovalModal">
212255
<waitForElementVisible time="10" selector="{{PageBuilderActionsSection.modal}}" stepKey="waitForModal" />
213256
<seeElement selector="{{PageBuilderActionsSection.modal}}" stepKey="seeRemovalModal"/>
214257
<waitForElementVisible time="10" selector="{{PageBuilderActionsSection.modalOk}}" stepKey="waitForModalOk" />
215-
<wait time="1" stepKey="waitForModalEventBinding" />
258+
<waitForPageLoad stepKey="waitForPageLoad1"/>
216259
<click selector="{{PageBuilderActionsSection.modalOk}}" stepKey="confirmRemoveModal"/>
217260
<waitForElementNotVisible time="1" selector="{{PageBuilderActionsSection.modalOk}}" stepKey="waitForModalHide" />
218-
<waitForPageLoad stepKey="waitForPageLoad"/>
261+
<waitForPageLoad stepKey="waitForPageLoad2"/>
219262
</actionGroup>
220-
221-
<!-- Remove a content type which has been configured with data or has children -->
222263
<actionGroup name="removeContentTypeFromStage">
264+
<!-- Remove a content type which has been configured with data or has children -->
223265
<arguments>
224266
<argument name="contentType" defaultValue=""/>
225267
</arguments>
@@ -354,12 +396,12 @@
354396
<actionGroup name="fillSlideOutPanelLinkUrlField">
355397
<arguments>
356398
<argument name="property" defaultValue=""/>
357-
<argument name="selection" defaultValue=""/>
399+
<argument name="selection" defaultValue="" type="string"/>
358400
<argument name="newTab" defaultValue=""/>
359401
</arguments>
360402
<waitForElementVisible time="10" selector="{{PageBuilderSection.LinkSelect(property.fieldName)}}" stepKey="waitForLinkSelect"/>
361403
<waitForElement time="10" selector="{{PageBuilderActionsSection.panelFieldControl(property.section, property.fieldName)}}" stepKey="waitForElementVisible"/>
362-
<selectOption selector="{{PageBuilderActionsSection.panelFieldControl(property.section, property.fieldName)}}" userInput="{{selection.value}}" stepKey="selectOption"/>
404+
<selectOption selector="{{PageBuilderActionsSection.panelFieldControl(property.section, property.fieldName)}}" userInput="{{selection}}" stepKey="selectOption"/>
363405
<fillField selector="{{PageBuilderSection.LinkInput(property.fieldName)}}" userInput="{{property.value}}" stepKey="inputLink"/>
364406
<conditionalClick selector="{{PageBuilderActionsSection.panelFieldControlSwitch(newTab.fieldName)}}" dependentSelector="{{PageBuilderActionsSection.panelFieldControlCheckboxState(newTab.fieldName, newTab.value)}}" visible="false" stepKey="conditionalClickNewTab"/>
365407
<waitForElementVisible selector="{{PageBuilderActionsSection.panelFieldControlCheckboxState(newTab.fieldName, newTab.value)}}" stepKey="waitForNewTabStateChange"/>
@@ -368,12 +410,12 @@
368410
<actionGroup name="validateSlideOutPanelLinkUrlField">
369411
<arguments>
370412
<argument name="property" defaultValue=""/>
371-
<argument name="selection" defaultValue=""/>
413+
<argument name="selection" defaultValue="" type="string"/>
372414
<argument name="newTab" defaultValue=""/>
373415
</arguments>
374416
<waitForElementVisible time="10" selector="{{PageBuilderSection.LinkSelect(property.fieldName)}}" stepKey="waitForLinkSelect"/>
375417
<waitForElement time="10" selector="{{PageBuilderActionsSection.panelFieldControl(property.section, property.fieldName)}}" stepKey="waitForElementVisible"/>
376-
<seeInField selector="{{PageBuilderActionsSection.panelFieldControl(property.section, property.fieldName)}}" userInput="{{selection.value}}" stepKey="seeOptionIsSelected"/>
418+
<seeInField selector="{{PageBuilderActionsSection.panelFieldControl(property.section, property.fieldName)}}" userInput="{{selection}}" stepKey="seeOptionIsSelected"/>
377419
<seeInField selector="{{PageBuilderSection.LinkInput(property.fieldName)}}" userInput="{{property.value}}" stepKey="seeInField"/>
378420
<waitForElementVisible time="10" selector="{{PageBuilderActionsSection.panelFieldControlCheckboxState(newTab.fieldName, newTab.value)}}" stepKey="waitForNewTab"/>
379421
</actionGroup>
@@ -595,11 +637,12 @@
595637
</actionGroup>
596638
<actionGroup name="saveEditPanelAndValidateFieldErrorGeneralSection">
597639
<arguments>
640+
<argument name="form" defaultValue="PageBuilderActionsSection"/>
598641
<argument name="property"/>
599642
</arguments>
600643
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMask"/>
601-
<waitForElementVisible time="5" selector="{{PageBuilderActionsSection.editFormSave}}" stepKey="waitForColumnSaveButton" />
602-
<click selector="{{PageBuilderActionsSection.editFormSave}}" stepKey="clickSaveColumn"/>
644+
<waitForElementVisible time="5" selector="{{form.editFormSave}}" stepKey="waitForSaveButton"/>
645+
<click selector="{{form.editFormSave}}" stepKey="clickSaveButton"/>
603646
<waitForElementVisible selector="{{PageBuilderActionsSection.panelFieldValidationError(property.section, property.fieldName)}}" stepKey="waitForErrorField"/>
604647
<waitForElementVisible selector="{{PageBuilderActionsSection.panelFieldValidationErrorMessage(property.section, property.fieldName, property.errorMessage)}}" stepKey="waitForErrorMessage"/>
605648
</actionGroup>

0 commit comments

Comments
 (0)