Skip to content

Commit 499d43d

Browse files
author
Oleksandr Gorkun
committed
MC-33823: Merge CE, EE and B2B changes
1 parent 3d41bae commit 499d43d

File tree

4 files changed

+55
-30
lines changed

4 files changed

+55
-30
lines changed

app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/configure.phtml

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,33 +11,34 @@
1111
<?= /* @noEscape */ $secureRenderer->renderEventListenerAsTag(
1212
'onload',
1313
"window.productConfigure && productConfigure.onLoadIFrame()",
14-
'#product_composite_configure_iframe'
14+
'iframe[name=\'product_composite_configure_iframe\']:last-of-type'
1515
) ?>
1616
<?= /* @noEscape */ $secureRenderer->renderStyleAsTag(
1717
"width:0; height:0; border:0px solid #fff; position:absolute; top:-1000px; left:-1000px",
18-
'#product_composite_configure_iframe'
18+
'iframe[name=\'product_composite_configure_iframe\']:last-of-type'
1919
) ?>
2020

2121
<form action="" method="post" id="product_composite_configure_form" enctype="multipart/form-data"
22-
target="product_composite_configure_iframe">
22+
target="product_composite_configure_iframe" class="product_composite_configure_form">
2323
<div class="entry-edit">
24-
<div id="product_composite_configure_messages">
24+
<div id="product_composite_configure_messages" class="product_composite_configure_messages">
2525
<div class="messages"><div class="message message-error error"><div></div></div></div>
2626
</div>
2727
<?= /* @noEscape */ $secureRenderer->renderStyleAsTag(
2828
'display:none;',
29-
'#product_composite_configure_messages'
29+
'.product_composite_configure_messages:last-of-type'
3030
) ?>
3131
<div id="product_composite_configure_form_fields" class="content product-composite-configure-inner"></div>
32-
<div id="product_composite_configure_form_additional"></div>
32+
<div id="product_composite_configure_form_additional" class="product_composite_configure_form_additional">
33+
</div>
3334
<?= /* @noEscape */ $secureRenderer->renderStyleAsTag(
3435
'display:none;',
35-
'#product_composite_configure_form_additional'
36+
'.product_composite_configure_form_additional:last-of-type'
3637
) ?>
37-
<div id="product_composite_configure_form_confirmed"></div>
38+
<div id="product_composite_configure_form_confirmed" class="product_composite_configure_form_confirmed"></div>
3839
<?= /* @noEscape */ $secureRenderer->renderStyleAsTag(
3940
'display:none;',
40-
'#product_composite_configure_form_confirmed'
41+
'.product_composite_configure_form_confirmed:last-of-type'
4142
) ?>
4243
</div>
4344
<input type="hidden" name="as_js_varname" value="iFrameResponse" />
@@ -46,30 +47,30 @@
4647
<?= /* @noEscape */ $secureRenderer->renderEventListenerAsTag(
4748
'onsubmit',
4849
"productConfigure.onConfirmBtn();event.preventDefault()",
49-
'#product_composite_configure_form'
50+
'.product_composite_configure_form:last-of-type'
5051
) ?>
5152

52-
<div id="product_composite_configure_confirmed"></div>
53+
<div id="product_composite_configure_confirmed" class="product_composite_configure_confirmed"></div>
5354
<?= /* @noEscape */ $secureRenderer->renderStyleAsTag(
5455
'display:none;',
55-
'#product_composite_configure_confirmed'
56+
'.product_composite_configure_confirmed:last-of-type'
5657
) ?>
5758

5859
<?php $scriptString = <<<script
5960
require([
6061
"jquery",
6162
"mage/mage"
6263
], function(jQuery){
63-
64-
jQuery('#product_composite_configure_form').mage('form').mage('validation');
65-
64+
jQuery('.product_composite_configure_form').each(function () {
65+
Jquery(this).mage('form').mage('validation');
66+
});
6667
});
6768
script;
6869
?>
6970
<?= /* @noEscape */ $secureRenderer->renderTag('script', [], $scriptString, false); ?>
7071
</div>
7172
<?= /* @noEscape */ $secureRenderer->renderStyleAsTag(
7273
'display:none',
73-
'#product_composite_configure'
74+
'.product-configure-popup:last-of-type'
7475
) ?>
7576

app/code/Magento/Paypal/Block/Adminhtml/System/Config/Field/Country.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
*/
1010
namespace Magento\Paypal\Block\Adminhtml\System\Config\Field;
1111

12+
use Magento\Framework\View\Helper\SecureHtmlRenderer;
1213
use Magento\Paypal\Model\Config\StructurePlugin;
1314

1415
class Country extends \Magento\Config\Block\System\Config\Form\Field
@@ -51,15 +52,17 @@ class Country extends \Magento\Config\Block\System\Config\Form\Field
5152
* @param \Magento\Framework\View\Helper\Js $jsHelper
5253
* @param \Magento\Directory\Helper\Data $directoryHelper
5354
* @param array $data
55+
* @param SecureHtmlRenderer|null $secureHtmlRenderer
5456
*/
5557
public function __construct(
5658
\Magento\Backend\Block\Template\Context $context,
5759
\Magento\Backend\Model\Url $url,
5860
\Magento\Framework\View\Helper\Js $jsHelper,
5961
\Magento\Directory\Helper\Data $directoryHelper,
60-
array $data = []
62+
array $data = [],
63+
?SecureHtmlRenderer $secureHtmlRenderer = null
6164
) {
62-
parent::__construct($context, $data);
65+
parent::__construct($context, $data, $secureHtmlRenderer);
6366
$this->_url = $url;
6467
$this->_jsHelper = $jsHelper;
6568
$this->directoryHelper = $directoryHelper;
@@ -132,7 +135,7 @@ protected function _getElementHtml(\Magento\Framework\Data\Form\Element\Abstract
132135
}
133136

134137
return parent::_getElementHtml($element) . $this->_jsHelper->getScript(
135-
'require([\'prototype\'], function(){document.observe("dom:loaded", function() {' . $jsString . '});});'
138+
'require([\'prototype\'], function() { document.observe("dom:loaded", function() {' . $jsString . '}); });'
136139
);
137140
}
138141
}

app/code/Magento/Paypal/Test/Unit/Block/Adminhtml/System/Config/Field/CountryTest.php

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
use Magento\Framework\View\Helper\SecureHtmlRenderer;
1616
use Magento\Paypal\Block\Adminhtml\System\Config\Field\Country;
1717
use Magento\Paypal\Model\Config\StructurePlugin;
18-
use PHPUnit\Framework\Constraint\LogicalAnd;
1918
use PHPUnit\Framework\Constraint\StringContains;
2019
use PHPUnit\Framework\MockObject\MockObject;
2120
use PHPUnit\Framework\TestCase;
21+
use Magento\Directory\Helper\Data as DirectoryHelper;
2222

2323
class CountryTest extends TestCase
2424
{
@@ -47,6 +47,11 @@ class CountryTest extends TestCase
4747
*/
4848
protected $_url;
4949

50+
/**
51+
* @var DirectoryHelper
52+
*/
53+
private $helper;
54+
5055
protected function setUp(): void
5156
{
5257
$helper = new ObjectManager($this);
@@ -71,6 +76,7 @@ protected function setUp(): void
7176
$this->_request = $this->getMockForAbstractClass(RequestInterface::class);
7277
$this->_jsHelper = $this->createMock(Js::class);
7378
$this->_url = $this->createMock(Url::class);
79+
$this->helper = $this->createMock(DirectoryHelper::class);
7480
$secureRendererMock = $this->createMock(SecureHtmlRenderer::class);
7581
$secureRendererMock->method('renderEventListenerAsTag')
7682
->willReturnCallback(
@@ -90,7 +96,8 @@ function (string $style, string $selector): string {
9096
'request' => $this->_request,
9197
'jsHelper' => $this->_jsHelper,
9298
'url' => $this->_url,
93-
'secureRenderer' => $secureRendererMock
99+
'directoryHelper' => $this->helper,
100+
'secureHtmlRenderer' => $secureRendererMock
94101
]
95102
);
96103
}
@@ -123,15 +130,7 @@ public function testRender($requestCountry, $requestDefaultCountry, $canUseDefau
123130
'$("' . $this->_element->getHtmlId() . '").observe("change", function () {'
124131
),
125132
];
126-
if ($canUseDefault && ($requestCountry == 'US') && $requestDefaultCountry) {
127-
$constraints[] = new StringContains(
128-
'$("' . $this->_element->getHtmlId() . '_inherit").observe("click", function () {'
129-
);
130-
}
131-
$this->_jsHelper->expects($this->once())
132-
->method('getScript')
133-
->with(self::logicalAnd($constraints));
134-
$this->_url->expects($this->once())
133+
$this->_url->expects($this->at(0))
135134
->method('getUrl')
136135
->with(
137136
'*/*/*',
@@ -142,6 +141,27 @@ public function testRender($requestCountry, $requestDefaultCountry, $canUseDefau
142141
StructurePlugin::REQUEST_PARAM_COUNTRY => '__country__'
143142
]
144143
);
144+
if ($canUseDefault && ($requestCountry == 'US') && $requestDefaultCountry) {
145+
$this->helper->method('getDefaultCountry')->willReturn($requestDefaultCountry);
146+
$constraints[] = new StringContains(
147+
'$("' . $this->_element->getHtmlId() . '_inherit").observe("click", function () {'
148+
);
149+
$this->_url->expects($this->at(1))
150+
->method('getUrl')
151+
->with(
152+
'*/*/*',
153+
[
154+
'section' => 'section',
155+
'website' => 'website',
156+
'store' => 'store',
157+
StructurePlugin::REQUEST_PARAM_COUNTRY => '__country__',
158+
Country::REQUEST_PARAM_DEFAULT_COUNTRY => '__default__'
159+
]
160+
);
161+
}
162+
$this->_jsHelper->expects($this->once())
163+
->method('getScript')
164+
->with(self::logicalAnd(...$constraints));
145165
$this->_model->render($this->_element);
146166
}
147167

app/code/Magento/Wishlist/view/adminhtml/layout/customer_index_wishlist.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,5 +112,6 @@
112112
</arguments>
113113
</block>
114114
</block>
115+
<block class="Magento\Catalog\Block\Adminhtml\Product\Composite\Configure" template="Magento_Catalog::catalog/product/composite/configure.phtml" name="configure.popup"/>
115116
</container>
116117
</layout>

0 commit comments

Comments
 (0)