Skip to content

Commit f09957d

Browse files
committed
ACP2E-104: [Magento Cloud] Customizable options Drag and drop issue
- Fixed the CR comments
1 parent 4738ebe commit f09957d

File tree

5 files changed

+42
-26
lines changed

5 files changed

+42
-26
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AdminOpenAndApplyCustomOptionsPerPageActionGroup">
12+
<annotations>
13+
<description>Open the custom option drop down section and assign the user defined custom value</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="perPageInputValue" type="string" defaultValue="1"/>
17+
</arguments>
18+
19+
<click selector="{{AdminProductGridPaginationSection.perPageDropdown}}" stepKey="clickProductPerPageDropdown"/>
20+
<click selector="{{AdminProductGridPaginationSection.perPageOption('Custom')}}" stepKey="selectCustomPerPage"/>
21+
<fillField selector="{{AdminProductGridPaginationSection.perPageInput}}" userInput="{{perPageInputValue}}" stepKey="fillCustomPerPage"/>
22+
<click selector="{{AdminProductGridPaginationSection.perPageApplyInput}}" stepKey="applyCustomPerPage"/>
23+
<waitForPageLoad stepKey="waitForPageRefreshCustomPerPage"/>
24+
</actionGroup>
25+
</actionGroups>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,6 @@
5757
<element name="optionSku" type="input" selector="//*[@data-index='custom_options']//*[@data-index='options']/tbody/tr//*[@name='product[options][{{index}}][sku]']" parameterized="true"/>
5858
<element name="optionFileExtensions" type="input" selector="//*[@data-index='custom_options']//*[@data-index='options']/tbody/tr//*[@name='product[options][{{index}}][file_extension]']" parameterized="true"/>
5959
<element name="importOptions" type="button" selector="//button[@data-index='button_import']" timeout="30"/>
60+
<element name="customOptionTableRows" type="button" selector=".admin__dynamic-rows[data-index='values'] tr.data-row" timeout="30"/>
6061
</section>
6162
</sections>

app/code/Magento/Catalog/Test/Mftf/Test/AdminValidateSimpleProductWithCustomOptionsPerPageTest.xml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,10 @@
5151
</actionGroup>
5252

5353
<!-- Validate custom options dynamic rows per page -->
54-
<comment userInput="Admin to validate the custom options dynamic rows per page" stepKey="validateCustomOptionsDynamicRowsPerPage"/>
55-
<click selector="{{AdminProductGridPaginationSection.perPageDropdown}}" stepKey="clickProductPerPageDropdown"/>
56-
<click selector="{{AdminProductGridPaginationSection.perPageOption('Custom')}}" stepKey="selectCustomPerPage"/>
57-
<fillField selector="{{AdminProductGridPaginationSection.perPageInput}}" userInput="1" stepKey="fillCustomPerPage"/>
58-
<click selector="{{AdminProductGridPaginationSection.perPageApplyInput}}" stepKey="applyCustomPerPage"/>
59-
<waitForPageLoad stepKey="waitForPageRefreshCustomPerPage"/>
60-
<waitForElementVisible selector=".admin__dynamic-rows[data-index='values'] tr.data-row" stepKey="waitForRowsToBeVisible"/>
61-
<seeNumberOfElements selector=".admin__dynamic-rows[data-index='values'] tr.data-row" userInput="1" stepKey="see4RowsOfOptions"/>
54+
<actionGroup ref="AdminOpenAndApplyCustomOptionsPerPageActionGroup" stepKey="openAndApplyPerPageDropdown">
55+
<argument name="perPageInputValue" value="1"/>
56+
</actionGroup>
57+
<waitForElementVisible selector="{{AdminProductCustomizableOptionsSection.customOptionTableRows}}" stepKey="waitForRowsToBeVisible"/>
58+
<seeNumberOfElements selector="{{AdminProductCustomizableOptionsSection.customOptionTableRows}}" userInput="1" stepKey="see4RowsOfOptions"/>
6259
</test>
6360
</tests>

app/code/Magento/Catalog/view/adminhtml/web/js/components/dynamic-rows-per-page.js

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ define([
77
'Magento_Ui/js/dynamic-rows/dynamic-rows',
88
'underscore',
99
'mageUtils',
10-
'uiLayout'
11-
], function (DynamicRows, _, utils, layout) {
10+
'uiLayout',
11+
'rjsResolver'
12+
], function (DynamicRows, _, utils, layout, resolver) {
1213
'use strict';
1314

1415
return DynamicRows.extend({
@@ -46,13 +47,10 @@ define([
4647
},
4748
links: {
4849
options: '${ $.sizesConfig.name }:options',
49-
perPageSize: '${ $.sizesConfig.name }:value'
50-
},
51-
statefull: {
52-
perPageSize: true
50+
pageSize: '${ $.sizesConfig.name }:value'
5351
},
5452
listens: {
55-
'perPageSize': 'onPageSizeChange'
53+
'pageSize': 'onPageSizeChange'
5654
},
5755
modules: {
5856
sizes: '${ $.sizesConfig.name }'
@@ -92,7 +90,7 @@ define([
9290
initObservable: function () {
9391
this._super()
9492
.track([
95-
'perPageSize'
93+
'pageSize'
9694
]);
9795

9896
return this;
@@ -102,16 +100,11 @@ define([
102100
* Handles changes of the page size.
103101
*/
104102
onPageSizeChange: function () {
105-
if (this.getRecordCount()) {
106-
if (this.perPageSize !== undefined) {
107-
this.pageSize = this.perPageSize;
103+
resolver(function () {
104+
if (this.elems().length) {
108105
this.reload();
109-
} else {
110-
this.perPageSize = this.pageSize;
111106
}
112-
} else {
113-
this.perPageSize = this.pageSize;
114-
}
107+
}, this);
115108
}
116109
});
117110
});

app/code/Magento/Catalog/view/adminhtml/web/template/components/dynamic-rows-per-page.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
</tr>
3333
</thead>
3434

35-
<tbody>
35+
<tbody afterRender="onPageSizeChange">
3636
<tr class="data-row" repeat="foreach: elems, item: '$record'">
3737
<td if="dndConfig.enabled"
3838
class="col-draggable"
@@ -59,7 +59,7 @@
5959
<span translate="addButtonLabel"></span>
6060
</button>
6161

62-
<div class="admin__data-grid-pager-wrap" afterRender="onPageSizeChange">
62+
<div class="admin__data-grid-pager-wrap">
6363
<scope args="sizes" render=""></scope>
6464

6565
<div class="admin__control-table-pagination" visible="!!element.getRecordCount() && pages() > 1">

0 commit comments

Comments
 (0)