diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/dynamic-rows-configurable.js b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/dynamic-rows-configurable.js index 7b04bebd4d73a..4624f07323d59 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/dynamic-rows-configurable.js +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/dynamic-rows-configurable.js @@ -219,7 +219,7 @@ define([ _.each(tmpData, function (row, index) { path = this.dataScope + '.' + this.index + '.' + (this.startIndex + index); row.attributes = $('').text(row.attributes).html(); - row.sku = $('').text(row.sku).html(); + row.sku = row.sku; this.source.set(path, row); }, this); @@ -405,7 +405,7 @@ define([ 'id': row.productId, 'product_link': row.productUrl, 'name': $('').text(row.name).html(), - 'sku': $('').text(row.sku).html(), + 'sku': row.sku, 'status': row.status, 'price': row.price, 'price_currency': row.priceCurrency, diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/dynamic-rows-configurable.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/dynamic-rows-configurable.test.js new file mode 100644 index 0000000000000..546392d35fe84 --- /dev/null +++ b/dev/tests/js/jasmine/tests/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/dynamic-rows-configurable.test.js @@ -0,0 +1,53 @@ +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +/* eslint-disable max-nested-callbacks */ +define([ + 'jquery', + 'Magento_ConfigurableProduct/js/components/dynamic-rows-configurable', + 'Magento_Ui/js/dynamic-rows/dynamic-rows' +], function ($, DynamicRowsConf, DynamicRows) { + 'use strict'; + + describe('Magento_ConfigurableProduct/js/components/dynamic-rows-configurable', function () { + var model; + + beforeEach(function () { + model = new DynamicRowsConf(new DynamicRows({ + isEmpty: jasmine.createSpy().and.returnValue(1), + isShowAddProductButton: jasmine.createSpy().and.returnValue(1) + })); + + }); + + it('Verify processingUnionInsertDat method', function () { + var expectedData = [], + mockData = [ + { + attributes: 'Color: dsfsd', + sku: 'Conf&-sdfs' + }, + { + attributes: 'Color: sdfs', + sku: 'Conf-dsfsd' + } + ], + sourceMock = { + get: jasmine.createSpy().and.returnValue(['code1', 'code2']), + set: jasmine.createSpy().and.callFake(function (path, row) { + expectedData.push(row); + }) + }; + + model.getChildItems = jasmine.createSpy().and.returnValue($('')); + model.source = sourceMock; + model.processingUnionInsertData(mockData); + expect(model.source.get).toHaveBeenCalled(); + expect(model.getChildItems).toHaveBeenCalled(); + expect(expectedData[1].sku).toBe('Conf&-sdfs'); + }); + + }); +});