Skip to content

Commit fe276ac

Browse files
ENGCOM-7913: Cover form email component in checkout page with jasmine test #28842
- Merge Pull Request #28842 from mrtuvn/magento2:coverage-checkout-email-component-by-jasmine - Merged commits: 1. 4d045f5
2 parents 6a33719 + 4d045f5 commit fe276ac

File tree

1 file changed

+66
-0
lines changed
  • dev/tests/js/jasmine/tests/app/code/Magento/Checkout/frontend/js/view/form/element

1 file changed

+66
-0
lines changed
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
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', 'ko'], function (Squire, ko) {
9+
'use strict';
10+
11+
describe('Magento_Checkout/js/view/form/element/email', function () {
12+
var injector = new Squire(),
13+
mocks = {
14+
'Magento_Customer/js/model/customer': {
15+
isLoggedIn: ko.observable()
16+
},
17+
'Magento_Customer/js/action/check-email-availability': jasmine.createSpy(),
18+
'Magento_Customer/js/action/login': jasmine.createSpy(),
19+
'Magento_Checkout/js/model/quote': {
20+
isVirtual: jasmine.createSpy(),
21+
shippingAddress: jasmine.createSpy()
22+
},
23+
'Magento_Checkout/js/checkout-data': jasmine.createSpyObj(
24+
'checkoutData',
25+
[
26+
'setInputFieldEmailValue',
27+
'setValidatedEmailValue',
28+
'setCheckedEmailValue',
29+
'getInputFieldEmailValue',
30+
'getValidatedEmailValue',
31+
'getCheckedEmailValue'
32+
]
33+
),
34+
'Magento_Checkout/js/model/full-screen-loader': jasmine.createSpy(),
35+
'mage/validation': jasmine.createSpy()
36+
},
37+
Component;
38+
39+
beforeEach(function (done) {
40+
injector.mock(mocks);
41+
injector.require(['Magento_Checkout/js/view/form/element/email'], function (Constr) {
42+
Component = new Constr({
43+
provider: 'provName',
44+
name: '',
45+
index: '',
46+
isPasswordVisible: false,
47+
isEmailCheckComplete: null
48+
});
49+
done();
50+
});
51+
});
52+
53+
afterEach(function () {
54+
try {
55+
injector.clean();
56+
injector.remove();
57+
} catch (e) {}
58+
});
59+
60+
describe('"resolveInitialPasswordVisibility" method', function () {
61+
it('Check return type of method.', function () {
62+
expect(typeof Component.resolveInitialPasswordVisibility()).toEqual('boolean');
63+
});
64+
});
65+
});
66+
});

0 commit comments

Comments
 (0)