Skip to content

Commit 7d1254d

Browse files
committed
ACP2E-1180: Number of stocks to assign to a source is limited by the URL length
1 parent ab999dd commit 7d1254d

File tree

2 files changed

+72
-4
lines changed

2 files changed

+72
-4
lines changed

app/code/Magento/Ui/view/base/web/js/grid/provider.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@ define([
1515
'Magento_Ui/js/modal/alert',
1616
'mage/translate',
1717
'uiElement',
18+
'uiRegistry',
1819
'Magento_Ui/js/grid/data-storage'
19-
], function ($, _, utils, resolver, layout, alert, $t, Element) {
20+
], function ($, _, utils, resolver, layout, alert, $t, Element, registry) {
2021
'use strict';
2122

2223
return Element.extend({
@@ -186,9 +187,9 @@ define([
186187
* @param {Object} requestConfig
187188
*/
188189
updateRequestConfig: function (requestConfig) {
189-
if (this.storage()) {
190-
_.extend(this.storage().requestConfig, requestConfig);
191-
}
190+
registry.get(this.storageConfig.provider, function (storage) {
191+
_.extend(storage.requestConfig, requestConfig);
192+
});
192193
}
193194
});
194195
});
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
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(['squire', 'underscore'], function (Squire, _) {
9+
'use strict';
10+
11+
var injector = new Squire(),
12+
storage = {
13+
requestConfig: {
14+
method: 'GET'
15+
}
16+
},
17+
mocks = {
18+
'Magento_Ui/js/core/renderer/layout': jasmine.createSpy(),
19+
'Magento_Ui/js/lib/core/element/element': {
20+
extend: function (child) {
21+
var uiElement = function () {
22+
_.extend(this, child.defaults);
23+
};
24+
25+
_.extend(uiElement.prototype, child);
26+
return uiElement;
27+
}
28+
},
29+
'Magento_Ui/js/lib/registry/registry': {
30+
async: jasmine.createSpy().and.returnValue(function (callback) {
31+
callback(storage);
32+
}),
33+
create: jasmine.createSpy(),
34+
set: jasmine.createSpy(),
35+
get: function (query, callback) {
36+
callback(storage);
37+
return storage;
38+
}
39+
},
40+
'Magento_Ui/js/grid/data-storage': jasmine.createSpy()
41+
},
42+
model;
43+
44+
beforeEach(function (done) {
45+
injector.mock(mocks);
46+
injector.require(['Magento_Ui/js/grid/provider'], function (Constr) {
47+
model = new Constr();
48+
done();
49+
});
50+
});
51+
52+
afterEach(function () {
53+
try {
54+
injector.clean();
55+
injector.remove();
56+
} catch (e) {}
57+
});
58+
59+
describe('Magento_Ui/js/grid/provider', function () {
60+
describe('"updateRequestConfig" method', function () {
61+
it('Check that storage "requestConfig" is updated.', function () {
62+
model.updateRequestConfig({method: 'PATCH'});
63+
expect(storage.requestConfig.method).toEqual('PATCH');
64+
});
65+
});
66+
});
67+
});

0 commit comments

Comments
 (0)