Skip to content

Commit 45d00ce

Browse files
committed
Merge remote-tracking branch 'origin/MAGETWO-73342' into 2.2-develop-pr39
2 parents e166691 + efd8482 commit 45d00ce

File tree

43 files changed

+877
-979
lines changed

Some content is hidden

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

43 files changed

+877
-979
lines changed

app/code/Magento/Braintree/view/adminhtml/web/js/braintree.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ define([
2424
scriptLoaded: false,
2525
braintree: null,
2626
selectedCardType: null,
27+
checkout: null,
2728
imports: {
2829
onActiveChange: 'active'
2930
}
@@ -147,14 +148,21 @@ define([
147148

148149
this.disableEventListeners();
149150

151+
if (self.checkout) {
152+
self.checkout.teardown(function () {
153+
self.checkout = null;
154+
});
155+
}
156+
150157
self.braintree.setup(self.clientToken, 'custom', {
151158
id: self.selector,
152159
hostedFields: self.getHostedFields(),
153160

154161
/**
155162
* Triggered when sdk was loaded
156163
*/
157-
onReady: function () {
164+
onReady: function (checkout) {
165+
self.checkout = checkout;
158166
$('body').trigger('processStop');
159167
self.enableEventListeners();
160168
},

app/code/Magento/Catalog/Test/Mftf/Section/AdminProductCustomizableOptionsSection.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@
1414
<element name="useDefaultOptionTitle" type="text" selector="[data-index='options'] tr.data-row [data-index='title'] [name^='options_use_default']"/>
1515
<element name="useDefaultOptionValueTitleByIndex" type="text" selector="[data-index='options'] [data-index='values'] tr[data-repeat-index='{{var1}}'] [name^='options_use_default']" parameterized="true"/>
1616
<element name="addOptionBtn" type="button" selector="button[data-index='button_add']"/>
17-
<element name="fillOptionTitle" type="input" selector="//span[text()='{{var1}}']/parent::div/parent::div/parent::div//span[text()='Option Title']/parent::label/parent::div//input[@class='admin__control-text']" parameterized="true"/>
18-
<element name="checkSelect" type="select" selector="//span[text()='{{var1}}']/parent::div/parent::div/parent::div//span[text()='Option Type']/parent::label/parent::div//div[@data-role='selected-option']" parameterized="true"/>
17+
<element name="fillOptionTitle" type="input" selector="//span[text()='{{var1}}']/parent::div/parent::div/parent::div//label[text()='Option Title']/parent::span/parent::div//input[@class='admin__control-text']" parameterized="true"/>
18+
<element name="checkSelect" type="select" selector="//span[text()='{{var1}}']/parent::div/parent::div/parent::div//label[text()='Option Type']/parent::span/parent::div//div[@data-role='selected-option']" parameterized="true"/>
1919
<element name="checkDropDown" type="select" selector="//span[text()='{{var1}}']/parent::div/parent::div/parent::div//parent::label/parent::div//li[@class='admin__action-multiselect-menu-inner-item']//label[text()='Drop-down']" parameterized="true"/>
2020
<element name="clickAddValue" type="button" selector="//span[text()='{{var1}}']/parent::div/parent::div/parent::div//tfoot//button" parameterized="true"/>
21-
<element name="fillOptionValueTitle" type="input" selector="//span[text()='{{var1}}']/parent::div/parent::div/parent::div//tbody/tr[@data-repeat-index='{{var2}}']//span[text()='Title']/parent::label/parent::div//div[@class='admin__field-control']/input" parameterized="true"/>
21+
<element name="fillOptionValueTitle" type="input" selector="//span[text()='{{var1}}']/parent::div/parent::div/parent::div//tbody/tr[@data-repeat-index='{{var2}}']//label[text()='Title']/parent::span/parent::div//div[@class='admin__field-control']/input" parameterized="true"/>
2222
<element name="fillOptionValuePrice" type="input" selector="//span[text()='{{var1}}']/parent::div/parent::div/parent::div//tbody/tr[@data-repeat-index='{{var2}}']//span[text()='Price']/parent::label/parent::div//div[@class='admin__control-addon']/input" parameterized="true"/>
23-
<element name="clickSelectPriceType" type="select" selector="//span[text()='{{var1}}']/parent::div/parent::div/parent::div//tbody//tr[@data-repeat-index='{{var2}}']//span[text()='Price Type']/parent::label/parent::div//select" parameterized="true"/>
23+
<element name="clickSelectPriceType" type="select" selector="//span[text()='{{var1}}']/parent::div/parent::div/parent::div//tbody//tr[@data-repeat-index='{{var2}}']//label[text()='Price Type']/parent::span/parent::div//select" parameterized="true"/>
2424
</section>
2525
</sections>

app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormSection.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
<element name="productName" type="input" selector=".admin__field[data-index=name] input"/>
1616
<element name="productNameUseDefault" type="checkbox" selector="input[name='use_default[name]']"/>
1717
<element name="productSku" type="input" selector=".admin__field[data-index=sku] input"/>
18+
<element name="enableProductAttributeLabel" type="text" selector="[data-index='status'] .admin__field-label label"/>
19+
<element name="enableProductAttributeLabelWrapper" type="text" selector="[data-index='status'] .admin__field-label"/>
1820
<element name="productStatus" type="checkbox" selector="input[name='product[status]']"/>
1921
<element name="productStatusUseDefault" type="checkbox" selector="input[name='use_default[status]']"/>
2022
<element name="productPrice" type="input" selector=".admin__field[data-index=price] input"/>
@@ -31,7 +33,7 @@
3133
<element name="visibilityUseDefault" type="checkbox" selector="//input[@name='use_default[visibility]']"/>
3234
<element name="divByDataIndex" type="input" selector="div[data-index='{{var}}']" parameterized="true"/>
3335
<element name="attributeSetSearchCount" type="text" selector="div[data-index='attribute_set_id'] .admin__action-multiselect-search-count"/>
34-
<element name="attributeLabelByText" type="text" selector="//*[@class='admin__field']//span[text()='{{attributeLabel}}']" parameterized="true"/>
36+
<element name="attributeLabelByText" type="text" selector="//*[@class='admin__field']//label[text()='{{attributeLabel}}']" parameterized="true"/>
3537
<element name="addAttributeBtn" type="button" selector="#addAttribute"/>
3638
</section>
3739
<section name="ProductInWebsitesSection">

app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/WebsitesTest.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,11 @@ protected function setUp()
9090
->disableOriginalConstructor()
9191
->getMock();
9292
$this->websiteRepositoryMock = $this->getMockBuilder(\Magento\Store\Api\WebsiteRepositoryInterface::class)
93-
->setMethods(['getList', 'getDefault'])
93+
->setMethods(['getDefault'])
9494
->getMockForAbstractClass();
9595
$this->websiteRepositoryMock->expects($this->any())
9696
->method('getDefault')
9797
->willReturn($this->websiteMock);
98-
$this->websiteRepositoryMock->expects($this->any())
99-
->method('getList')
100-
->willReturn([$this->websiteMock, $this->secondWebsiteMock]);
10198
$this->groupRepositoryMock = $this->getMockBuilder(\Magento\Store\Api\GroupRepositoryInterface::class)
10299
->setMethods(['getList'])
103100
->getMockForAbstractClass();
@@ -111,8 +108,10 @@ protected function setUp()
111108
->method('getWebsiteIds')
112109
->willReturn($this->assignedWebsites);
113110
$this->storeManagerMock = $this->getMockBuilder(\Magento\Store\Model\StoreManagerInterface::class)
114-
->setMethods(['isSingleStoreMode'])
111+
->setMethods(['isSingleStoreMode', 'getWebsites'])
115112
->getMockForAbstractClass();
113+
$this->storeManagerMock->method('getWebsites')
114+
->willReturn([$this->websiteMock, $this->secondWebsiteMock]);
116115
$this->storeManagerMock->expects($this->any())
117116
->method('isSingleStoreMode')
118117
->willReturn(false);

app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Websites.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,11 @@ protected function getFieldsForFieldset()
175175
$label = __('Websites');
176176

177177
$defaultWebsiteId = $this->websiteRepository->getDefault()->getId();
178+
$isOnlyOneWebsiteAvailable = count($websitesList) === 1;
178179
foreach ($websitesList as $website) {
179180
$isChecked = in_array($website['id'], $websiteIds)
180-
|| ($defaultWebsiteId == $website['id'] && $isNewProduct);
181+
|| ($defaultWebsiteId == $website['id'] && $isNewProduct)
182+
|| $isOnlyOneWebsiteAvailable;
181183
$children[$website['id']] = [
182184
'arguments' => [
183185
'data' => [
@@ -397,8 +399,9 @@ protected function getWebsitesList()
397399
$this->websitesList = [];
398400
$groupList = $this->groupRepository->getList();
399401
$storesList = $this->storeRepository->getList();
402+
$websiteList = $this->storeManager->getWebsites(true);
400403

401-
foreach ($this->websiteRepository->getList() as $website) {
404+
foreach ($websiteList as $website) {
402405
$websiteId = $website->getId();
403406
if (!$websiteId) {
404407
continue;

app/code/Magento/Catalog/view/frontend/templates/product/view/gallery.phtml

Lines changed: 74 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
* See COPYING.txt for license details.
55
*/
66

7-
// @codingStandardsIgnoreFile
8-
97
/**
108
* Product media data template
119
*
@@ -15,19 +13,19 @@
1513
<div class="gallery-placeholder _block-content-loading" data-gallery-role="gallery-placeholder">
1614
<div data-role="loader" class="loading-mask">
1715
<div class="loader">
18-
<img src="<?= /* @escapeNotVerified */ $block->getViewFileUrl('images/loader-1.gif') ?>"
19-
alt="<?= /* @escapeNotVerified */ __('Loading...') ?>">
16+
<img src="<?= $block->escapeUrl($block->getViewFileUrl('images/loader-1.gif')) ?>"
17+
alt="<?= $block->escapeHtml(__('Loading...')) ?>">
2018
</div>
2119
</div>
2220
</div>
2321
<!--Fix for jumping content. Loader must be the same size as gallery.-->
2422
<script>
2523
var config = {
26-
"width": <?= /* @escapeNotVerified */ $block->getImageAttribute('product_page_image_medium', 'width') ?>,
27-
"thumbheight": <?php /* @escapeNotVerified */ echo $block->getImageAttribute('product_page_image_small', 'height')
28-
?: $block->getImageAttribute('product_page_image_small', 'width'); ?>,
29-
"navtype": "<?= /* @escapeNotVerified */ $block->getVar("gallery/navtype") ?>",
30-
"height": <?= /* @escapeNotVerified */ $block->getImageAttribute('product_page_image_medium', 'height') ?>
24+
"width": <?= $block->escapeHtml($block->getImageAttribute('product_page_image_medium', 'width')) ?>,
25+
"thumbheight": <?= $block->escapeHtml($block->getImageAttribute('product_page_image_small', 'height')
26+
?: $block->getImageAttribute('product_page_image_small', 'width')); ?>,
27+
"navtype": "<?= $block->escapeHtml($block->getVar("gallery/navtype")) ?>",
28+
"height": <?= $block->escapeHtml($block->getImageAttribute('product_page_image_medium', 'height')) ?>
3129
},
3230
thumbBarHeight = 0,
3331
loader = document.querySelectorAll('[data-gallery-role="gallery-placeholder"] [data-role="loader"]')[0];
@@ -43,50 +41,82 @@
4341
"[data-gallery-role=gallery-placeholder]": {
4442
"mage/gallery/gallery": {
4543
"mixins":["magnifier/magnify"],
46-
"magnifierOpts": <?= /* @escapeNotVerified */ $block->getMagnifier() ?>,
47-
"data": <?= /* @escapeNotVerified */ $block->getGalleryImagesJson() ?>,
44+
"magnifierOpts": <?= /* @noEscape */ $block->getMagnifier() ?>,
45+
"data": <?= /* @noEscape */ $block->getGalleryImagesJson() ?>,
4846
"options": {
49-
"nav": "<?= /* @escapeNotVerified */ $block->getVar("gallery/nav") ?>",
50-
"loop": <?= /* @escapeNotVerified */ $block->getVar("gallery/loop") ? 'true' : 'false' ?>,
51-
"keyboard": <?= /* @escapeNotVerified */ $block->getVar("gallery/keyboard") ? 'true' : 'false' ?>,
52-
"arrows": <?= /* @escapeNotVerified */ $block->getVar("gallery/arrows") ? 'true' : 'false' ?>,
53-
"allowfullscreen": <?= /* @escapeNotVerified */ $block->getVar("gallery/allowfullscreen") ? 'true' : 'false' ?>,
54-
"showCaption": <?= /* @escapeNotVerified */ $block->getVar("gallery/caption") ? 'true' : 'false' ?>,
55-
"width": "<?= /* @escapeNotVerified */ $block->getImageAttribute('product_page_image_medium', 'width') ?>",
56-
"thumbwidth": "<?= /* @escapeNotVerified */ $block->getImageAttribute('product_page_image_small', 'width') ?>",
57-
<?php if ($block->getImageAttribute('product_page_image_small', 'height') || $block->getImageAttribute('product_page_image_small', 'width')): ?>
58-
"thumbheight": <?php /* @escapeNotVerified */ echo $block->getImageAttribute('product_page_image_small', 'height')
59-
?: $block->getImageAttribute('product_page_image_small', 'width'); ?>,
47+
"nav": "<?= $block->escapeHtml($block->getVar("gallery/nav")) ?>",
48+
<?php if (($block->getVar("gallery/loop"))) : ?>
49+
"loop": <?= $block->escapeHtml($block->getVar("gallery/loop")) ?>,
50+
<?php endif; ?>
51+
<?php if (($block->getVar("gallery/keyboard"))) : ?>
52+
"keyboard": <?= $block->escapeHtml($block->getVar("gallery/keyboard")) ?>,
53+
<?php endif; ?>
54+
<?php if (($block->getVar("gallery/arrows"))) : ?>
55+
"arrows": <?= $block->escapeHtml($block->getVar("gallery/arrows")) ?>,
56+
<?php endif; ?>
57+
<?php if (($block->getVar("gallery/allowfullscreen"))) : ?>
58+
"allowfullscreen": <?= $block->escapeHtml($block->getVar("gallery/allowfullscreen")) ?>,
59+
<?php endif; ?>
60+
<?php if (is_bool($block->getVar("gallery/caption"))) : ?>
61+
"showCaption": <?= /* @noEscape */ $block->getVar("gallery/caption") ? 'true' : 'false'; ?>,
62+
<?php endif; ?>
63+
<?php
64+
$imgWidth = $block->getImageAttribute('product_page_image_medium', 'width');
65+
$thumbWidth = $block->getImageAttribute('product_page_image_small', 'width');
66+
?>
67+
"width": "<?= $block->escapeHtml($imgWidth) ?>",
68+
"thumbwidth": "<?= $block->escapeHtml($thumbWidth) ?>",
69+
<?php
70+
$thumbHeight = $block->getImageAttribute('product_page_image_small', 'height')
71+
?: $block->getImageAttribute('product_page_image_small', 'width');
72+
?>
73+
<?php if ($thumbHeight) : ?>
74+
"thumbheight": <?= $block->escapeHtml($thumbHeight); ?>,
6075
<?php endif; ?>
61-
<?php if (($block->getVar("gallery/thumbmargin"))): ?>
62-
"thumbmargin": <?= /* @noEscape */ (int)$block->getVar("gallery/thumbmargin"); ?>,
76+
<?php if (($block->getVar("gallery/thumbmargin"))) : ?>
77+
"thumbmargin": <?= (int)$block->getVar("gallery/thumbmargin"); ?>,
6378
<?php endif; ?>
64-
<?php if ($block->getImageAttribute('product_page_image_medium', 'height') || $block->getImageAttribute('product_page_image_medium', 'width')): ?>
65-
"height": <?php /* @escapeNotVerified */ echo $block->getImageAttribute('product_page_image_medium', 'height')
66-
?: $block->getImageAttribute('product_page_image_medium', 'width'); ?>,
79+
<?php
80+
$imgHeight = $block->getImageAttribute('product_page_image_medium', 'height')
81+
?: $block->getImageAttribute('product_page_image_medium', 'width')
82+
?>
83+
<?php if ($imgHeight) : ?>
84+
"height": <?= $block->escapeHtml($imgHeight); ?>,
6785
<?php endif; ?>
68-
<?php if ($block->getVar("gallery/transition/duration")): ?>
69-
"transitionduration": <?= /* @escapeNotVerified */ $block->getVar("gallery/transition/duration") ?>,
86+
<?php if ($block->getVar("gallery/transition/duration")) : ?>
87+
"transitionduration": <?= $block->escapeHtml($block->getVar("gallery/transition/duration")) ?>,
7088
<?php endif; ?>
71-
"transition": "<?= /* @escapeNotVerified */ $block->getVar("gallery/transition/effect") ?>",
72-
"navarrows": <?= /* @escapeNotVerified */ $block->getVar("gallery/navarrows") ? 'true' : 'false' ?>,
73-
"navtype": "<?= /* @escapeNotVerified */ $block->getVar("gallery/navtype") ?>",
74-
"navdir": "<?= /* @escapeNotVerified */ $block->getVar("gallery/navdir") ?>"
89+
"transition": "<?= $block->escapeHtml($block->getVar("gallery/transition/effect")) ?>",
90+
<?php if (($block->getVar("gallery/navarrows"))) : ?>
91+
"navarrows": <?= $block->escapeHtml($block->getVar("gallery/navarrows")) ?>,
92+
<?php endif; ?>
93+
"navtype": "<?= $block->escapeHtml($block->getVar("gallery/navtype")) ?>",
94+
"navdir": "<?= $block->escapeHtml($block->getVar("gallery/navdir")) ?>"
7595
},
7696
"fullscreen": {
77-
"nav": "<?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/nav") ?>",
78-
"loop": <?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/loop") ? 'true' : 'false' ?>,
79-
"navdir": "<?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/navdir") ?>",
80-
"navarrows": <?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/navarrows") ? 'true' : 'false' ?>,
81-
"navtype": "<?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/navtype") ?>",
82-
"arrows": <?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/arrows") ? 'true' : 'false' ?>,
83-
"showCaption": <?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/caption") ? 'true' : 'false' ?>,
84-
<?php if ($block->getVar("gallery/fullscreen/transition/duration")): ?>
85-
"transitionduration": <?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/transition/duration") ?>,
97+
"nav": "<?= $block->escapeHtml($block->getVar("gallery/fullscreen/nav")) ?>",
98+
<?php if ($block->getVar("gallery/fullscreen/loop")) : ?>
99+
"loop": <?= $block->escapeHtml($block->getVar("gallery/fullscreen/loop")) ?>,
100+
<?php endif; ?>
101+
"navdir": "<?= $block->escapeHtml($block->getVar("gallery/fullscreen/navdir")) ?>",
102+
<?php if ($block->getVar("gallery/transition/navarrows")) : ?>
103+
"navarrows": <?= $block->escapeHtml($block->getVar("gallery/fullscreen/navarrows")) ?>,
104+
<?php endif; ?>
105+
"navtype": "<?= $block->escapeHtml($block->getVar("gallery/fullscreen/navtype")) ?>",
106+
<?php if ($block->getVar("gallery/fullscreen/arrows")) : ?>
107+
"arrows": <?= $block->escapeHtml($block->getVar("gallery/fullscreen/arrows")) ?>,
108+
<?php endif; ?>
109+
<?php if (is_bool($block->getVar("gallery/fullscreen/caption"))) : ?>
110+
<?php $showCaption = $block->getVar("gallery/fullscreen/caption") ? 'true' : 'false'; ?>
111+
"showCaption": <?= /* @noEscape */ $showCaption ?>,
112+
<?php endif; ?>
113+
<?php if ($block->getVar("gallery/fullscreen/transition/duration")) : ?>
114+
"transitionduration": <?=
115+
$block->escapeHtml($block->getVar("gallery/fullscreen/transition/duration")) ?>,
86116
<?php endif; ?>
87-
"transition": "<?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/transition/effect") ?>"
117+
"transition": "<?= $block->escapeHtml($block->getVar("gallery/fullscreen/transition/effect")) ?>"
88118
},
89-
"breakpoints": <?= /* @escapeNotVerified */ $block->getBreakpoints() ?>
119+
"breakpoints": <?= /* @noEscape */ $block->getBreakpoints() ?>
90120
}
91121
}
92122
}

0 commit comments

Comments
 (0)