Skip to content

Commit b70b878

Browse files
committed
ACP2E-2909: dynamic-rows.js:658 Uncaught TypeError: dataRecord.slice while editing bundle products
- Added the test coverage.
1 parent ee221a4 commit b70b878

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/**
2+
* Copyright © Magento, Inc. All rights reserved.
3+
* See COPYING.txt for license details.
4+
*/
5+
6+
/*eslint max-nested-callbacks: 0*/
7+
8+
define(['Magento_Bundle/js/components/bundle-user-defined-checkbox'], function (BundleUserDefinedCheckbox) {
9+
'use strict';
10+
11+
describe('Magento_Bundle/js/components/bundle-user-defined-checkbox', function () {
12+
let BundleUserDefinedCheckboxObj;
13+
14+
beforeEach(function () {
15+
BundleUserDefinedCheckboxObj = new BundleUserDefinedCheckbox({
16+
dataScope: 'bundle-user-defined-checkbox'
17+
});
18+
});
19+
20+
afterEach(function () {
21+
BundleUserDefinedCheckboxObj = null;
22+
});
23+
24+
describe('The user defined a checkbox for the input type change method in the test bundle.', function () {
25+
26+
it('verify the object that needs to be defined', function () {
27+
expect(BundleUserDefinedCheckboxObj).toBeDefined();
28+
});
29+
30+
it('test the default values to ensure they are correct.', function () {
31+
expect(BundleUserDefinedCheckboxObj.inputType).toBeUndefined();
32+
expect(BundleUserDefinedCheckboxObj.visible()).toBe(true);
33+
});
34+
35+
it('when using checkbox or multi-select input types, elements should be hidden.', function () {
36+
spyOn(BundleUserDefinedCheckboxObj, 'reset').and.returnValue(BundleUserDefinedCheckboxObj);
37+
38+
BundleUserDefinedCheckboxObj.onInputTypeChange('checkbox');
39+
expect(BundleUserDefinedCheckboxObj.reset).toHaveBeenCalled();
40+
expect(BundleUserDefinedCheckboxObj.visible()).toBe(false);
41+
});
42+
43+
it('the element should be visible when the input type is not a checkbox or multi-line.', function () {
44+
spyOn(BundleUserDefinedCheckboxObj, 'visible');
45+
46+
BundleUserDefinedCheckboxObj.onInputTypeChange('text');
47+
expect(BundleUserDefinedCheckboxObj.visible).toHaveBeenCalledWith(true);
48+
49+
BundleUserDefinedCheckboxObj.onInputTypeChange('radio');
50+
expect(BundleUserDefinedCheckboxObj.visible.calls.count()).toBe(2);
51+
expect(BundleUserDefinedCheckboxObj.visible).toHaveBeenCalledWith(true);
52+
});
53+
});
54+
});
55+
});

0 commit comments

Comments
 (0)