Skip to content

Commit b73d513

Browse files
MAGETWO-80198: [2.2.x] - Fix issue #10565 #10575
1 parent 7ca7002 commit b73d513

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

app/code/Magento/Ui/view/base/web/js/form/element/multiselect.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ define([
5252
* @param {Array} data - current component value
5353
*/
5454
setPrepareToSendData: function (data) {
55-
if (!data.length) {
55+
if (_.isUndefined(data) || !data.length) {
5656
data = '';
5757
}
5858

dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/element/multiselect.test.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ define([
5252
expect(obj.source.set).toHaveBeenCalledWith(dataScope + '-prepared-for-send', '');
5353
});
5454

55+
it('Check method call with undefined as parameter.', function () {
56+
expect(obj.setPrepareToSendData(undefined)).toBeUndefined();
57+
expect(obj.source.set).toHaveBeenCalledWith(dataScope + '-prepared-for-send', '');
58+
});
59+
5560
it('Check method call with array with data as parameter.', function () {
5661
expect(obj.setPrepareToSendData(['1', '2', '3'])).toBeUndefined();
5762
expect(obj.source.set).toHaveBeenCalledWith(dataScope + '-prepared-for-send', ['1', '2', '3']);

0 commit comments

Comments
 (0)