Skip to content

Commit 968532b

Browse files
committed
ACP2E-2909: dynamic-rows.js:658 Uncaught TypeError: dataRecord.slice while editing bundle products
- Added the jasmine test coverage.
1 parent 51ae13d commit 968532b

File tree

2 files changed

+45
-1
lines changed

2 files changed

+45
-1
lines changed

app/code/Magento/Bundle/view/adminhtml/web/js/components/bundle-dynamic-rows-grid.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ define([
179179
},
180180

181181
/**
182-
* Processing add child if the record index is not a number.
182+
* Parse and processing the add child method to update the latest records if the record index is not a number.
183183
*
184184
* @param {Array} data
185185
* @param {Array} newData
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/************************************************************************
2+
*
3+
* Copyright 2024 Adobe
4+
* All Rights Reserved.
5+
*
6+
* ************************************************************************
7+
*/
8+
/*eslint max-nested-callbacks: 0*/
9+
define(['Magento_Bundle/js/components/bundle-dynamic-rows-grid'],
10+
function(BundleDynamicRowsGrid) {
11+
'use strict';
12+
13+
describe('Magento_Bundle/js/components/bundle-dynamic-rows-grid', function () {
14+
let dynamicRowsGrid;
15+
16+
beforeEach(function () {
17+
dynamicRowsGrid = new BundleDynamicRowsGrid();
18+
});
19+
20+
describe('test parseProcessingAddChild method', function() {
21+
it('Check the processingAddChild method should call when recordIndex is a valid number', function () {
22+
let data = [4];
23+
let newData = [4];
24+
25+
spyOn(dynamicRowsGrid, 'processingAddChild').and.callThrough();
26+
27+
dynamicRowsGrid.parseProcessingAddChild(data, newData);
28+
29+
expect(dynamicRowsGrid.processingAddChild).toHaveBeenCalled();
30+
});
31+
32+
it('Check the processingAddChild method should not call when recordIndex is inValid number', function () {
33+
let data = NaN;
34+
let newData = [2];
35+
36+
spyOn(dynamicRowsGrid, 'processingAddChild').and.callThrough();
37+
38+
dynamicRowsGrid.parseProcessingAddChild(data, newData);
39+
40+
expect(dynamicRowsGrid.processingAddChild).not.toHaveBeenCalled();
41+
});
42+
});
43+
});
44+
});

0 commit comments

Comments
 (0)