Skip to content

Commit 71d2e1b

Browse files
committed
Merge remote-tracking branch 'origin/2.3-develop' into MC-29343
2 parents 806ace2 + f956769 commit 71d2e1b

File tree

3 files changed

+74
-38
lines changed

3 files changed

+74
-38
lines changed

dev/tests/js/jasmine/tests/app/code/Magento/Checkout/frontend/js/view/shipping.test.js

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,23 @@ require.config({
1212
}
1313
});
1414

15-
define(['squire', 'ko', 'jquery', 'uiRegistry', 'jquery/validate'], function (Squire, ko, $, registry) {
15+
define(['squire', 'ko', 'jquery', 'jquery/validate'], function (Squire, ko, $) {
1616
'use strict';
1717

1818
var injector = new Squire(),
1919
modalStub = {
2020
openModal: jasmine.createSpy(),
2121
closeModal: jasmine.createSpy()
2222
},
23+
country = {
24+
indexedOptions: {
25+
'AD': {
26+
label: 'Andorra',
27+
labeltitle: 'Andorra',
28+
value: 'AD'
29+
}
30+
}
31+
},
2332
mocks = {
2433
'Magento_Customer/js/model/customer': {
2534
isLoggedIn: ko.observable()
@@ -62,7 +71,18 @@ define(['squire', 'ko', 'jquery', 'uiRegistry', 'jquery/validate'], function (Sq
6271
'checkoutData',
6372
['setSelectedShippingAddress', 'setNewCustomerShippingAddress', 'setSelectedShippingRate']
6473
),
65-
'Magento_Ui/js/lib/registry/registry': registry,
74+
'Magento_Ui/js/lib/registry/registry': {
75+
async: jasmine.createSpy().and.returnValue(function () {}),
76+
create: jasmine.createSpy(),
77+
set: jasmine.createSpy(),
78+
get: jasmine.createSpy().and.callFake(function (query) {
79+
if (query === 'test.shippingAddress.shipping-address-fieldset.country_id') {
80+
return country;
81+
} else if (query === 'checkout.errors') {
82+
return {};
83+
}
84+
})
85+
},
6686
'Magento_Checkout/js/model/shipping-rate-service': jasmine.createSpy()
6787
},
6888
obj;
@@ -73,8 +93,8 @@ define(['squire', 'ko', 'jquery', 'uiRegistry', 'jquery/validate'], function (Sq
7393
obj = new Constr({
7494
provider: 'provName',
7595
name: '',
76-
parentName: 'test',
7796
index: '',
97+
parentName: 'test',
7898
popUpForm: {
7999
options: {
80100
buttons: {
@@ -174,19 +194,6 @@ define(['squire', 'ko', 'jquery', 'uiRegistry', 'jquery/validate'], function (Sq
174194

175195
describe('"validateShippingInformation" method', function () {
176196
it('Check method call on negative cases.', function () {
177-
var country = {
178-
'indexedOptions': {
179-
'AD':
180-
{
181-
label: 'Andorra',
182-
labeltitle: 'Andorra',
183-
value: 'AD'
184-
}
185-
}
186-
};
187-
188-
registry.set('test.shippingAddress.shipping-address-fieldset.country_id', country);
189-
registry.set('checkout.errors', {});
190197
obj.source = {
191198
get: jasmine.createSpy().and.returnValue(true),
192199
set: jasmine.createSpy(),

dev/tests/js/jasmine/tests/app/code/Magento/Signifyd/frontend/js/Fingerprint.test.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,16 @@ define([
1010

1111
/*eslint max-nested-callbacks: ["error", 5]*/
1212
describe('Signifyd device fingerprint client script', function () {
13+
var originalTimeout;
14+
15+
beforeEach(function () {
16+
originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
17+
jasmine.DEFAULT_TIMEOUT_INTERVAL = 12000;
18+
});
19+
20+
afterEach(function () {
21+
jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
22+
});
1323

1424
it('SIGNIFYD_GLOBAL object initialization check', function (done) {
1525
var script = document.createElement('script');
@@ -32,7 +42,6 @@ define([
3242
expect(signifyd.scriptTagHasLoaded()).toBe(true);
3343
done();
3444
}, 10000);
35-
36-
}, 12000);
45+
});
3746
});
3847
});

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

Lines changed: 40 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,50 @@
33
* See COPYING.txt for license details.
44
*/
55

6+
/**
7+
* Copyright © Magento, Inc. All rights reserved.
8+
* See COPYING.txt for license details.
9+
*/
10+
611
define([
7-
'underscore',
8-
'uiRegistry',
9-
'Magento_Ui/js/form/form'
10-
], function (_, registry, Constr) {
12+
'squire'
13+
], function (Squire) {
1114
'use strict';
1215

1316
describe('Magento_Ui/js/form/form', function () {
14-
15-
var obj = new Constr({
16-
provider: 'provName',
17-
name: '',
18-
index: ''
19-
});
20-
21-
registry.set('provName', {
22-
/** Stub */
23-
on: function () {},
24-
25-
/** Stub */
26-
get: function () {},
27-
28-
/** Stub */
29-
set: function () {}
17+
var injector = new Squire(),
18+
mocks = {
19+
'Magento_Ui/js/lib/registry/registry': {
20+
/** Method stub. */
21+
get: function () {
22+
return {
23+
get: jasmine.createSpy(),
24+
set: jasmine.createSpy()
25+
};
26+
},
27+
options: jasmine.createSpy(),
28+
create: jasmine.createSpy(),
29+
set: jasmine.createSpy(),
30+
async: jasmine.createSpy()
31+
}
32+
},
33+
obj,
34+
dataScope = 'dataScope';
35+
36+
beforeEach(function (done) {
37+
injector.mock(mocks);
38+
injector.require([
39+
'Magento_Ui/js/form/form'
40+
], function (Constr) {
41+
obj = new Constr({
42+
provider: 'provName',
43+
name: '',
44+
index: '',
45+
dataScope: dataScope
46+
});
47+
48+
done();
49+
});
3050
});
3151

3252
describe('"initAdapter" method', function () {

0 commit comments

Comments
 (0)