Skip to content

Commit 07a3994

Browse files
author
Sergii Kovalenko
committed
MAGETWO-63321: Issue when deleting item from Product options grid containing more than 20 options
1 parent cf90992 commit 07a3994

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -648,6 +648,7 @@ define([
648648
getChildItems: function (data, page) {
649649
var dataRecord = data || this.relatedData,
650650
startIndex;
651+
651652
this.startIndex = (~~this.currentPage() - 1) * this.pageSize;
652653

653654
startIndex = page || this.startIndex;

dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/dynamic-rows/dynamic.rows.test.js

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ define([
1212
var model,
1313
ElementMock = function (index) {
1414
return {
15-
destroy: new Function (),
15+
/**
16+
* @return void
17+
*/
18+
destroy: function () {},
1619
index: index
1720
};
1821
};
@@ -34,6 +37,11 @@ define([
3437
*/
3538
describe('Magento_Ui/js/dynamic-rows/dynamic-rows', function () {
3639
it('changePage without Records', function () {
40+
/**
41+
* Mock function which return length of record data
42+
*
43+
* @returns {{length: number}}
44+
*/
3745
model.recordData = function () {
3846
return {
3947
length: 0
@@ -44,6 +52,11 @@ define([
4452
});
4553

4654
it('changePage with Fake Page', function () {
55+
/**
56+
* Mock function, which return the number of pages
57+
*
58+
* @returns {number}
59+
*/
4760
model.pages = function () {
4861
return 3;
4962
};
@@ -74,13 +87,15 @@ define([
7487
expect(model.templates.record.recordId).toBe(2);//last record number is 3
7588
});
7689

77-
it ('deleteRecord with Delete Property', function () {
90+
it('deleteRecord with Delete Property', function () {
7891
var elems,
7992
recordInstanceMock = new ElementMock(1),
8093
elem2 = new ElementMock(2);
8194

8295
spyOn(recordInstanceMock, 'destroy');
83-
model.recordData({1: {}});
96+
model.recordData({
97+
1: {}
98+
});
8499
elems = [
85100
recordInstanceMock,
86101
elem2

0 commit comments

Comments
 (0)