Skip to content

Commit b3d4e24

Browse files
committed
Merge remote-tracking branch 'origin/MC-33699-CE-2' into MC-33699
# Conflicts: # app/code/Magento/Swatches/Block/Adminhtml/Attribute/Edit/Options/Visual.php
2 parents 12296fa + c658468 commit b3d4e24

File tree

4 files changed

+44
-43
lines changed

4 files changed

+44
-43
lines changed

app/code/Magento/ImportExport/Ui/DataProvider/ExportFileDataProvider.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,9 @@ public function getData()
103103
$result['items'][]['file_name'] = $this->getPathToExportFile($this->fileIO->getPathInfo($file));
104104
}
105105

106-
$pageSize = (int) $this->request->getParam('paging')['pageSize'];
107-
$pageCurrent = (int) $this->request->getParam('paging')['current'];
106+
$paging = $this->request->getParam('paging');
107+
$pageSize = (int) ($paging['pageSize'] ?? 0);
108+
$pageCurrent = (int) ($paging['current'] ?? 0);
108109
$pageOffset = ($pageCurrent - 1) * $pageSize;
109110
$result['totalRecords'] = count($result['items']);
110111
$result['items'] = array_slice($result['items'], $pageOffset, $pageSize);

app/code/Magento/LayeredNavigation/Test/Mftf/Test/AdminCheckResultsOfColorAndOtherFiltersTest.xml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,23 @@
1313
<argument name="categoryName" value="$$createCategory.name$$"/>
1414
</actionGroup>
1515
<!-- Choose First attribute filter -->
16-
<waitForElementVisible selector="{{StorefrontCategorySidebarSection.filterOptionTitle('$$createConfigProductAttribute.default_frontend_label$$')}}" stepKey="waitForCartRuleButton"/>
17-
<click selector="{{StorefrontCategorySidebarSection.filterOptionTitle('$$createConfigProductAttribute.default_frontend_label$$')}}" stepKey="expandFirstAttribute"/>
18-
<waitForPageLoad stepKey="waitForFilterLoad"/>
19-
<click selector="{{LayeredNavigationSection.filterOptionContent('$$createConfigProductAttribute.default_frontend_label$$','option2')}}" stepKey="expandFirstAttributeOption"/>
20-
<waitForPageLoad stepKey="waitForAttributeOption"/>
21-
<seeElement selector="{{StorefrontCategoryMainSection.specifiedProductItemInfo($$createFirstConfigurableProduct.name$$)}}" stepKey="seeFirstProduct"/>
22-
<seeElement selector="{{StorefrontCategoryMainSection.specifiedProductItemInfo($$createSecondConfigurableProduct.name$$)}}" stepKey="seeSecondProduct"/>
23-
<seeElement selector="{{StorefrontCategoryMainSection.specifiedProductItemInfo($$createThirdConfigurableProduct.name$$)}}" stepKey="seeSimpleProduct"/>
24-
<actionGroup ref="StorefrontGoToCategoryPageActionGroup" stepKey="goToCategoryPageAgain">
16+
<waitForElementVisible selector="{{StorefrontCategorySidebarSection.filterOptionTitle('$$createConfigProductAttribute.default_frontend_label$$')}}" after="goToCategoryPage" stepKey="waitForCartRuleButton"/>
17+
<click selector="{{StorefrontCategorySidebarSection.filterOptionTitle('$$createConfigProductAttribute.default_frontend_label$$')}}" after="waitForCartRuleButton" stepKey="expandFirstAttribute"/>
18+
<waitForPageLoad after="expandFirstAttribute" stepKey="waitForFilterLoad"/>
19+
<click selector="{{LayeredNavigationSection.filterOptionContent('$$createConfigProductAttribute.default_frontend_label$$','option2')}}" after="waitForFilterLoad" stepKey="expandFirstAttributeOption"/>
20+
<waitForPageLoad after="expandFirstAttributeOption" stepKey="waitForAttributeOption"/>
21+
<seeElement selector="{{StorefrontCategoryMainSection.specifiedProductItemInfo($$createFirstConfigurableProduct.name$$)}}" after="waitForAttributeOption" stepKey="seeFirstProduct"/>
22+
<seeElement selector="{{StorefrontCategoryMainSection.specifiedProductItemInfo($$createSecondConfigurableProduct.name$$)}}" after="seeFirstProduct" stepKey="seeSecondProduct"/>
23+
<seeElement selector="{{StorefrontCategoryMainSection.specifiedProductItemInfo($$createThirdConfigurableProduct.name$$)}}" after="seeSecondProduct" stepKey="seeSimpleProduct"/>
24+
<actionGroup ref="StorefrontGoToCategoryPageActionGroup" after="seeSimpleProduct" stepKey="goToCategoryPageAgain">
2525
<argument name="categoryName" value="$$createCategory.name$$"/>
2626
</actionGroup>
2727
<!-- Choose Second attribute filter -->
28-
<click selector="{{StorefrontCategorySidebarSection.filterOptionTitle('$$createConfigProductAttribute2.default_frontend_label$$')}}" stepKey="expandSecondAttributeOption"/>
29-
<waitForPageLoad stepKey="waitForFilterPageLoad"/>
30-
<click selector="{{LayeredNavigationSection.filterOptionContent('$$createConfigProductAttribute2.default_frontend_label$$','option1')}}" stepKey="expandSecondAttribute"/>
31-
<waitForPageLoad stepKey="waitForProductListLoad"/>
32-
<seeElement selector="{{StorefrontCategoryMainSection.specifiedProductItemInfo($$createFirstConfigurableProduct.name$$)}}" stepKey="seeFourthProduct"/>
33-
<seeElement selector="{{StorefrontCategoryMainSection.specifiedProductItemInfo($$createSecondConfigurableProduct.name$$)}}" stepKey="seeFifthProduct"/>
28+
<click selector="{{StorefrontCategorySidebarSection.filterOptionTitle('$$createConfigProductAttribute2.default_frontend_label$$')}}" after="goToCategoryPageAgain" stepKey="expandSecondAttributeOption"/>
29+
<waitForPageLoad after="expandSecondAttributeOption" stepKey="waitForFilterPageLoad"/>
30+
<click selector="{{LayeredNavigationSection.filterOptionContent('$$createConfigProductAttribute2.default_frontend_label$$','option1')}}" after="waitForFilterPageLoad" stepKey="expandSecondAttribute"/>
31+
<waitForPageLoad after="expandSecondAttribute" stepKey="waitForProductListLoad"/>
32+
<seeElement selector="{{StorefrontCategoryMainSection.specifiedProductItemInfo($$createFirstConfigurableProduct.name$$)}}" after="waitForProductListLoad" stepKey="seeFourthProduct"/>
33+
<seeElement selector="{{StorefrontCategoryMainSection.specifiedProductItemInfo($$createSecondConfigurableProduct.name$$)}}" after="seeFourthProduct" stepKey="seeFifthProduct"/>
3434
</test>
3535
</tests>

app/code/Magento/Swatches/Block/Adminhtml/Attribute/Edit/Options/Visual.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -94,16 +94,16 @@ protected function reformatSwatchLabels($swatchStoreValue = null)
9494
}
9595
$newSwatch = [];
9696
foreach ($swatchStoreValue as $key => $value) {
97-
if (!is_string($value)) {
98-
continue;
99-
}
100-
if ($value[0] == '#') {
101-
$newSwatch[$key] = 'background: ' . $value;
102-
} elseif ($value[0] == '/') {
103-
$mediaUrl = $this->swatchHelper->getSwatchMediaUrl();
104-
$newSwatch[$key] = 'background: url(' . $mediaUrl . $value . '); background-size: cover;';
97+
if (is_string($value) && !empty($value)) {
98+
if ($value[0] == '#') {
99+
$newSwatch[$key] = 'background: ' . $value;
100+
} elseif ($value[0] == '/') {
101+
$mediaUrl = $this->swatchHelper->getSwatchMediaUrl();
102+
$newSwatch[$key] = 'background: url(' . $mediaUrl . $value . '); background-size: cover;';
103+
}
105104
}
106105
}
106+
107107
return $newSwatch;
108108
}
109109
}

app/code/Magento/Swatches/Test/Mftf/Test/AdminCreateImageSwatchTest.xml

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -89,20 +89,20 @@
8989

9090
<!-- Verify after round trip to the server -->
9191
<grabAttributeFrom selector="{{AdminManageSwatchSection.nthSwatch('1')}}" userInput="style" stepKey="grabSwatch1"/>
92-
<assertContains stepKey="assertSwatch1">
92+
<assertStringContainsString stepKey="assertSwatch1">
9393
<expectedResult type="string">adobe-thumb</expectedResult>
9494
<actualResult type="string">{$grabSwatch1}</actualResult>
95-
</assertContains>
95+
</assertStringContainsString>
9696
<grabAttributeFrom selector="{{AdminManageSwatchSection.nthSwatch('2')}}" userInput="style" stepKey="grabSwatch2"/>
97-
<assertContains stepKey="assertSwatch2">
97+
<assertStringContainsString stepKey="assertSwatch2">
9898
<expectedResult type="string">adobe-small</expectedResult>
9999
<actualResult type="string">{$grabSwatch2}</actualResult>
100-
</assertContains>
100+
</assertStringContainsString>
101101
<grabAttributeFrom selector="{{AdminManageSwatchSection.nthSwatch('3')}}" userInput="style" stepKey="grabSwatch3"/>
102-
<assertContains stepKey="assertSwatch3">
102+
<assertStringContainsString stepKey="assertSwatch3">
103103
<expectedResult type="string">adobe-base</expectedResult>
104104
<actualResult type="string">{$grabSwatch3}</actualResult>
105-
</assertContains>
105+
</assertStringContainsString>
106106

107107
<!-- Create a configurable product to verify the storefront with -->
108108
<amOnPage url="{{AdminProductCreatePage.url(BaseConfigurableProduct.attribute_set_id, BaseConfigurableProduct.type_id)}}" stepKey="goToCreateConfigurableProduct"/>
@@ -133,40 +133,40 @@
133133

134134
<!-- Verify the storefront -->
135135
<grabAttributeFrom selector="{{StorefrontProductInfoMainSection.nthSwatchOption('1')}}" userInput="style" stepKey="grabSwatch4"/>
136-
<assertContains stepKey="assertSwatch4">
136+
<assertStringContainsString stepKey="assertSwatch4">
137137
<expectedResult type="string">adobe-thumb</expectedResult>
138138
<actualResult type="string">{$grabSwatch4}</actualResult>
139-
</assertContains>
139+
</assertStringContainsString>
140140
<grabAttributeFrom selector="{{StorefrontProductInfoMainSection.nthSwatchOption('2')}}" userInput="style" stepKey="grabSwatch5"/>
141-
<assertContains stepKey="assertSwatch5">
141+
<assertStringContainsString stepKey="assertSwatch5">
142142
<expectedResult type="string">adobe-small</expectedResult>
143143
<actualResult type="string">{$grabSwatch5}</actualResult>
144-
</assertContains>
144+
</assertStringContainsString>
145145
<grabAttributeFrom selector="{{StorefrontProductInfoMainSection.nthSwatchOption('3')}}" userInput="style" stepKey="grabSwatch6"/>
146-
<assertContains stepKey="assertSwatch6">
146+
<assertStringContainsString stepKey="assertSwatch6">
147147
<expectedResult type="string">adobe-base</expectedResult>
148148
<actualResult type="string">{$grabSwatch6}</actualResult>
149-
</assertContains>
149+
</assertStringContainsString>
150150

151151
<!-- Go to the product listing page and see text swatch options -->
152152
<amOnPage url="$createCategory.custom_attributes[url_key]$.html" stepKey="goToCategoryPageStorefront"/>
153153
<waitForPageLoad stepKey="waitForProductListingPage"/>
154154

155155
<!-- Verify the storefront -->
156156
<grabAttributeFrom selector="{{StorefrontProductInfoMainSection.nthSwatchOption('1')}}" userInput="style" stepKey="grabSwatch7"/>
157-
<assertContains stepKey="assertSwatch7">
157+
<assertStringContainsString stepKey="assertSwatch7">
158158
<expectedResult type="string">adobe-thumb</expectedResult>
159159
<actualResult type="string">{$grabSwatch7}</actualResult>
160-
</assertContains>
160+
</assertStringContainsString>
161161
<grabAttributeFrom selector="{{StorefrontProductInfoMainSection.nthSwatchOption('2')}}" userInput="style" stepKey="grabSwatch8"/>
162-
<assertContains stepKey="assertSwatch8">
162+
<assertStringContainsString stepKey="assertSwatch8">
163163
<expectedResult type="string">adobe-small</expectedResult>
164164
<actualResult type="string">{$grabSwatch8}</actualResult>
165-
</assertContains>
165+
</assertStringContainsString>
166166
<grabAttributeFrom selector="{{StorefrontProductInfoMainSection.nthSwatchOption('3')}}" userInput="style" stepKey="grabSwatch9"/>
167-
<assertContains stepKey="assertSwatch9">
167+
<assertStringContainsString stepKey="assertSwatch9">
168168
<expectedResult type="string">adobe-base</expectedResult>
169169
<actualResult type="string">{$grabSwatch9}</actualResult>
170-
</assertContains>
170+
</assertStringContainsString>
171171
</test>
172172
</tests>

0 commit comments

Comments
 (0)