Skip to content

Commit 07f8767

Browse files
committed
ACP2E-3076: Error when deleting bundle options
1 parent 2e62245 commit 07f8767

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed
Lines changed: 44 additions & 0 deletions
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+
9+
define(['Magento_Bundle/js/components/bundle-dynamic-rows', 'uiRegistry', 'uiCollection'],
10+
function (BundleDynamicRows, registry, uiCollection) {
11+
'use strict';
12+
13+
describe('Magento_Bundle/js/components/bundle-dynamic-rows', function () {
14+
let unit;
15+
16+
beforeEach(function () {
17+
unit = new BundleDynamicRows({
18+
dataScope: 'bundle-dynamic-rows',
19+
label: 'Dynamic Rows',
20+
collapsibleHeader: true,
21+
columnsHeader: false,
22+
deleteProperty: false,
23+
addButton: false,
24+
name: 'dynamic',
25+
bundleSelectionsName: 'bundle_selections'
26+
});
27+
});
28+
29+
describe ('test removeBundleItemsFromOption method', function () {
30+
it('Check if bundle items are removed from option', function () {
31+
let bundleSelections = new uiCollection;
32+
33+
spyOn(bundleSelections, 'destroyChildren').and.callThrough();
34+
spyOn(registry, 'get').and.returnValue(bundleSelections);
35+
spyOn(unit, 'removeBundleItemsFromOption').and.callThrough();
36+
37+
unit.removeBundleItemsFromOption(1);
38+
39+
expect(registry.get).toHaveBeenCalledWith('dynamic.1.bundle_selections');
40+
expect(bundleSelections.destroyChildren).toHaveBeenCalled();
41+
});
42+
});
43+
});
44+
});

0 commit comments

Comments
 (0)