@financial-times/n-conversion-forms 32.11.0 → 32.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.circleci/config.yml +1 -3
- package/.toolkitstate/ci.json +2 -2
- package/components/accept-terms-subscription.spec.js +3 -3
- package/components/company-name.spec.js +2 -4
- package/components/delivery-security-instructions.spec.js +6 -6
- package/components/graduation-date.spec.js +2 -2
- package/components/industry.spec.js +4 -4
- package/components/job-title.spec.js +2 -2
- package/components/payment-term.spec.js +2 -2
- package/components/personal-title.spec.js +4 -6
- package/components/phone.spec.js +2 -2
- package/components/position.spec.js +2 -2
- package/components/responsibility.spec.js +2 -2
- package/components/text-input.spec.js +5 -5
- package/helpers/ncf-countries.spec.js +2 -2
- package/package.json +35 -37
- package/test-jest/helpers/expect-to-render-correctly.js +1 -0
- package/utils/apple-pay.spec.js +1 -1
- package/utils/billing-postcode.spec.js +8 -8
- package/utils/company-name.spec.js +1 -1
- package/utils/delivery-address-type.spec.js +1 -1
- package/utils/delivery-option.spec.js +2 -2
- package/utils/delivery-postcode.spec.js +7 -7
- package/utils/delivery-start-date.spec.js +2 -4
- package/utils/form-element.spec.js +1 -1
- package/utils/loader.spec.js +3 -3
- package/utils/password.spec.js +2 -2
- package/utils/payment-term.spec.js +3 -3
- package/utils/payment-type.spec.js +1 -1
- package/utils/postcode.spec.js +7 -13
- package/utils/salesforce.spec.js +2 -2
- package/utils/submit.spec.js +1 -1
- package/utils/validation.spec.js +2 -2
- package/utils/zuora.spec.js +2 -0
package/.circleci/config.yml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# CONFIG GENERATED BY DOTCOM-TOOL-KIT, DO NOT EDIT BY HAND
|
|
2
2
|
version: 2.1
|
|
3
3
|
orbs:
|
|
4
|
-
tool-kit: financial-times/dotcom-tool-kit@
|
|
4
|
+
tool-kit: financial-times/dotcom-tool-kit@5
|
|
5
5
|
executors:
|
|
6
6
|
node:
|
|
7
7
|
docker:
|
|
@@ -31,8 +31,6 @@ workflows:
|
|
|
31
31
|
filters:
|
|
32
32
|
branches:
|
|
33
33
|
only: /(^renovate-.*|^nori/.*)/
|
|
34
|
-
tags:
|
|
35
|
-
only: /^v\d+\.\d+\.\d+(-.+)?/
|
|
36
34
|
- tool-kit/setup:
|
|
37
35
|
name: tool-kit/setup-<< matrix.executor >>
|
|
38
36
|
requires:
|
package/.toolkitstate/ci.json
CHANGED
|
@@ -81,13 +81,13 @@ describe('AcceptTermsSubscription', () => {
|
|
|
81
81
|
const transitionTerms2 = component.find('.terms-transition').at(1);
|
|
82
82
|
const transitionTerms3 = component.find('.terms-transition').at(2);
|
|
83
83
|
|
|
84
|
-
expect(transitionTerms1.text()).
|
|
84
|
+
expect(transitionTerms1.text()).toBe(
|
|
85
85
|
'I give consent for the chosen payment method to be charged automatically.'
|
|
86
86
|
);
|
|
87
|
-
expect(transitionTerms2.text()).
|
|
87
|
+
expect(transitionTerms2.text()).toBe(
|
|
88
88
|
'By placing your order subject to the Terms & Conditions (save for section 2) referred to below, you are waiving your statutory right to cancel our contract within 14 days of payment. Your payment is a one-time payment collected at the time of checkout, and unsubscribing or cancelling at any point (whether before or after the 14-day period) will not entitle you to a refund.'
|
|
89
89
|
);
|
|
90
|
-
expect(transitionTerms3.text()).
|
|
90
|
+
expect(transitionTerms3.text()).toBe(
|
|
91
91
|
'Please see here for the complete Terms & Conditions.'
|
|
92
92
|
);
|
|
93
93
|
});
|
|
@@ -69,9 +69,7 @@ describe('CompanyName', () => {
|
|
|
69
69
|
|
|
70
70
|
const component = mount(CompanyName(props));
|
|
71
71
|
|
|
72
|
-
expect(component.find('.o-forms-title__main').text()).
|
|
73
|
-
'Company name'
|
|
74
|
-
);
|
|
72
|
+
expect(component.find('.o-forms-title__main').text()).toBe('Company name');
|
|
75
73
|
});
|
|
76
74
|
|
|
77
75
|
it('renders with custom label wording', () => {
|
|
@@ -79,7 +77,7 @@ describe('CompanyName', () => {
|
|
|
79
77
|
|
|
80
78
|
const component = mount(CompanyName(props));
|
|
81
79
|
|
|
82
|
-
expect(component.find('.o-forms-title__main').text()).
|
|
80
|
+
expect(component.find('.o-forms-title__main').text()).toBe(
|
|
83
81
|
'Organisation name'
|
|
84
82
|
);
|
|
85
83
|
});
|
|
@@ -10,7 +10,7 @@ describe('DeliverySecurityInstructions', () => {
|
|
|
10
10
|
wrapper = shallow(<DeliverySecurityInstructions />);
|
|
11
11
|
});
|
|
12
12
|
|
|
13
|
-
test('contains textAreaProps id set to default: deliverySecurityInstructionsField
|
|
13
|
+
test('contains textAreaProps id set to default: deliverySecurityInstructionsField', () => {
|
|
14
14
|
expect(wrapper.prop('id')).toBe('deliverySecurityInstructionsField');
|
|
15
15
|
});
|
|
16
16
|
|
|
@@ -55,11 +55,11 @@ describe('DeliverySecurityInstructions', () => {
|
|
|
55
55
|
});
|
|
56
56
|
|
|
57
57
|
it('does not set maxLength when no value is given', () => {
|
|
58
|
-
expect(textAreaProps.maxLength).toBeUndefined;
|
|
58
|
+
expect(textAreaProps.maxLength).toBeUndefined();
|
|
59
59
|
});
|
|
60
60
|
|
|
61
61
|
it('does not set rows when no value is given', () => {
|
|
62
|
-
expect(textAreaProps.rows).toBeUndefined;
|
|
62
|
+
expect(textAreaProps.rows).toBeUndefined();
|
|
63
63
|
});
|
|
64
64
|
|
|
65
65
|
it('sets data-trackable to field-deliverySecurityInstructions', () => {
|
|
@@ -75,11 +75,11 @@ describe('DeliverySecurityInstructions', () => {
|
|
|
75
75
|
});
|
|
76
76
|
|
|
77
77
|
it('sets disabled to false', () => {
|
|
78
|
-
expect(textAreaProps.disabled).
|
|
78
|
+
expect(textAreaProps.disabled).toBe(false);
|
|
79
79
|
});
|
|
80
80
|
|
|
81
81
|
it('does not set value when no value is given', () => {
|
|
82
|
-
expect(textAreaProps.defaultValue).
|
|
82
|
+
expect(textAreaProps.defaultValue).toBe('');
|
|
83
83
|
});
|
|
84
84
|
});
|
|
85
85
|
|
|
@@ -117,7 +117,7 @@ describe('DeliverySecurityInstructions', () => {
|
|
|
117
117
|
});
|
|
118
118
|
|
|
119
119
|
it('sets disabled to true', () => {
|
|
120
|
-
expect(textAreaProps.disabled).
|
|
120
|
+
expect(textAreaProps.disabled).toBe(true);
|
|
121
121
|
});
|
|
122
122
|
|
|
123
123
|
it('sets value', () => {
|
|
@@ -86,13 +86,13 @@ describe('GraduationDate', () => {
|
|
|
86
86
|
const wrapper = shallow(<GraduationDate value="2020-08-28" />);
|
|
87
87
|
|
|
88
88
|
it('sets the default month', () => {
|
|
89
|
-
expect(wrapper.find('#graduationDateMonth').prop('defaultValue')).
|
|
89
|
+
expect(wrapper.find('#graduationDateMonth').prop('defaultValue')).toBe(
|
|
90
90
|
'08'
|
|
91
91
|
);
|
|
92
92
|
});
|
|
93
93
|
|
|
94
94
|
it('sets the default year', () => {
|
|
95
|
-
expect(wrapper.find('#graduationDateYear').prop('defaultValue')).
|
|
95
|
+
expect(wrapper.find('#graduationDateYear').prop('defaultValue')).toBe(
|
|
96
96
|
'2020'
|
|
97
97
|
);
|
|
98
98
|
});
|
|
@@ -71,7 +71,7 @@ describe('Industry', () => {
|
|
|
71
71
|
|
|
72
72
|
const component = mount(Industry(props));
|
|
73
73
|
|
|
74
|
-
expect(component.find('.o-forms-title__main').text()).
|
|
74
|
+
expect(component.find('.o-forms-title__main').text()).toBe(
|
|
75
75
|
'In which industry do you work?'
|
|
76
76
|
);
|
|
77
77
|
});
|
|
@@ -81,7 +81,7 @@ describe('Industry', () => {
|
|
|
81
81
|
|
|
82
82
|
const component = mount(Industry(props));
|
|
83
83
|
|
|
84
|
-
expect(component.find('.o-forms-title__main').text()).
|
|
84
|
+
expect(component.find('.o-forms-title__main').text()).toBe('Industry');
|
|
85
85
|
});
|
|
86
86
|
|
|
87
87
|
it('renders with optional title class, when not required', () => {
|
|
@@ -89,7 +89,7 @@ describe('Industry', () => {
|
|
|
89
89
|
const component = mount(Industry(props));
|
|
90
90
|
|
|
91
91
|
expect(
|
|
92
|
-
component.find('.o-forms-title.o-forms-field--optional')
|
|
93
|
-
).
|
|
92
|
+
component.find('.o-forms-title.o-forms-field--optional')
|
|
93
|
+
).toHaveLength(1);
|
|
94
94
|
});
|
|
95
95
|
});
|
|
@@ -64,7 +64,7 @@ describe('JobTitle', () => {
|
|
|
64
64
|
const component = mount(JobTitle(props));
|
|
65
65
|
|
|
66
66
|
expect(
|
|
67
|
-
component.find('.o-forms-title.o-forms-field--optional')
|
|
68
|
-
).
|
|
67
|
+
component.find('.o-forms-title.o-forms-field--optional')
|
|
68
|
+
).toHaveLength(1);
|
|
69
69
|
});
|
|
70
70
|
});
|
|
@@ -331,7 +331,7 @@ describe('PaymentTerm', () => {
|
|
|
331
331
|
},
|
|
332
332
|
];
|
|
333
333
|
const wrapper = shallow(<PaymentTerm options={options} />);
|
|
334
|
-
expect(wrapper.find('input').prop('data-base-amount')).
|
|
334
|
+
expect(wrapper.find('input').prop('data-base-amount')).toBe(100);
|
|
335
335
|
});
|
|
336
336
|
|
|
337
337
|
it('renders option.trialAmount as data-base-amount if isTrial is true', () => {
|
|
@@ -347,7 +347,7 @@ describe('PaymentTerm', () => {
|
|
|
347
347
|
},
|
|
348
348
|
];
|
|
349
349
|
const wrapper = shallow(<PaymentTerm options={options} />);
|
|
350
|
-
expect(wrapper.find('input').prop('data-base-amount')).
|
|
350
|
+
expect(wrapper.find('input').prop('data-base-amount')).toBe(1);
|
|
351
351
|
});
|
|
352
352
|
});
|
|
353
353
|
|
|
@@ -71,7 +71,7 @@ describe('PersonalTitle', () => {
|
|
|
71
71
|
|
|
72
72
|
const component = mount(PersonalTitle(props));
|
|
73
73
|
|
|
74
|
-
expect(component.find('.o-forms-title__main').text()).
|
|
74
|
+
expect(component.find('.o-forms-title__main').text()).toBe('Title');
|
|
75
75
|
});
|
|
76
76
|
|
|
77
77
|
it('renders with custom label wording', () => {
|
|
@@ -79,9 +79,7 @@ describe('PersonalTitle', () => {
|
|
|
79
79
|
|
|
80
80
|
const component = mount(PersonalTitle(props));
|
|
81
81
|
|
|
82
|
-
expect(component.find('.o-forms-title__main').text()).
|
|
83
|
-
'PersonalTitle'
|
|
84
|
-
);
|
|
82
|
+
expect(component.find('.o-forms-title__main').text()).toBe('PersonalTitle');
|
|
85
83
|
});
|
|
86
84
|
|
|
87
85
|
it('renders with optional title class, when not required', () => {
|
|
@@ -89,7 +87,7 @@ describe('PersonalTitle', () => {
|
|
|
89
87
|
const component = mount(PersonalTitle(props));
|
|
90
88
|
|
|
91
89
|
expect(
|
|
92
|
-
component.find('.o-forms-title.o-forms-field--optional')
|
|
93
|
-
).
|
|
90
|
+
component.find('.o-forms-title.o-forms-field--optional')
|
|
91
|
+
).toHaveLength(1);
|
|
94
92
|
});
|
|
95
93
|
});
|
package/components/phone.spec.js
CHANGED
|
@@ -55,7 +55,7 @@ describe('Phone', () => {
|
|
|
55
55
|
const component = mount(Phone(props));
|
|
56
56
|
|
|
57
57
|
expect(
|
|
58
|
-
component.find('.o-forms-title.o-forms-field--optional')
|
|
59
|
-
).
|
|
58
|
+
component.find('.o-forms-title.o-forms-field--optional')
|
|
59
|
+
).toHaveLength(1);
|
|
60
60
|
});
|
|
61
61
|
});
|
|
@@ -65,7 +65,7 @@ describe('Position', () => {
|
|
|
65
65
|
const component = mount(Position(props));
|
|
66
66
|
|
|
67
67
|
expect(
|
|
68
|
-
component.find('.o-forms-title.o-forms-field--optional')
|
|
69
|
-
).
|
|
68
|
+
component.find('.o-forms-title.o-forms-field--optional')
|
|
69
|
+
).toHaveLength(1);
|
|
70
70
|
});
|
|
71
71
|
});
|
|
@@ -71,7 +71,7 @@ describe('Responsibility', () => {
|
|
|
71
71
|
const component = mount(Responsibility(props));
|
|
72
72
|
|
|
73
73
|
expect(
|
|
74
|
-
component.find('.o-forms-title.o-forms-field--optional')
|
|
75
|
-
).
|
|
74
|
+
component.find('.o-forms-title.o-forms-field--optional')
|
|
75
|
+
).toHaveLength(1);
|
|
76
76
|
});
|
|
77
77
|
});
|
|
@@ -31,7 +31,7 @@ describe('Text Input', () => {
|
|
|
31
31
|
const errorMsg = component.find('.o-forms-input__error');
|
|
32
32
|
|
|
33
33
|
expect(element.exists()).toBe(true);
|
|
34
|
-
expect(errorMsg.text()).
|
|
34
|
+
expect(errorMsg.text()).toBe('Invalid value');
|
|
35
35
|
});
|
|
36
36
|
|
|
37
37
|
it('renders a field with custom input id', () => {
|
|
@@ -59,7 +59,7 @@ describe('Text Input', () => {
|
|
|
59
59
|
const component = mount(TextInput(props));
|
|
60
60
|
const element = component.find('input');
|
|
61
61
|
|
|
62
|
-
expect(element.prop('defaultValue')).
|
|
62
|
+
expect(element.prop('defaultValue')).toBe('foobar');
|
|
63
63
|
});
|
|
64
64
|
|
|
65
65
|
it('renders with disabled input', () => {
|
|
@@ -77,7 +77,7 @@ describe('Text Input', () => {
|
|
|
77
77
|
const component = mount(TextInput(props));
|
|
78
78
|
const label = component.find('.o-forms-title__main');
|
|
79
79
|
|
|
80
|
-
expect(label.text()).
|
|
80
|
+
expect(label.text()).toBe('');
|
|
81
81
|
});
|
|
82
82
|
|
|
83
83
|
it('renders with custom label wording', () => {
|
|
@@ -86,7 +86,7 @@ describe('Text Input', () => {
|
|
|
86
86
|
const component = mount(TextInput(props));
|
|
87
87
|
const label = component.find('.o-forms-title__main');
|
|
88
88
|
|
|
89
|
-
expect(label.text()).
|
|
89
|
+
expect(label.text()).toBe('Code');
|
|
90
90
|
});
|
|
91
91
|
|
|
92
92
|
it('renders with custom description wording', () => {
|
|
@@ -95,7 +95,7 @@ describe('Text Input', () => {
|
|
|
95
95
|
const component = mount(TextInput(props));
|
|
96
96
|
const description = component.find('.o-forms-title__prompt');
|
|
97
97
|
|
|
98
|
-
expect(description.text()).
|
|
98
|
+
expect(description.text()).toBe('Description text');
|
|
99
99
|
});
|
|
100
100
|
|
|
101
101
|
it('renders as required field', () => {
|
|
@@ -48,7 +48,7 @@ describe('ncf-countries', () => {
|
|
|
48
48
|
|
|
49
49
|
expect(
|
|
50
50
|
context.countries.find((country) => country.selected)
|
|
51
|
-
).
|
|
51
|
+
).toBeUndefined();
|
|
52
52
|
});
|
|
53
53
|
|
|
54
54
|
it('does not mark any countries selected if incorrect value passed', () => {
|
|
@@ -57,7 +57,7 @@ describe('ncf-countries', () => {
|
|
|
57
57
|
|
|
58
58
|
expect(
|
|
59
59
|
context.countries.find((country) => country.selected)
|
|
60
|
-
).
|
|
60
|
+
).toBeUndefined();
|
|
61
61
|
});
|
|
62
62
|
|
|
63
63
|
it('marks a country as selected if value matches code', () => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@financial-times/n-conversion-forms",
|
|
3
|
-
"version": "32.
|
|
3
|
+
"version": "32.12.0",
|
|
4
4
|
"description": "Containing jsx components and styles for forms included on Accounts and Acqusition apps (next-signup, next-profile, next-retention, etc).",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -25,61 +25,59 @@
|
|
|
25
25
|
},
|
|
26
26
|
"homepage": "https://github.com/Financial-Times/n-conversion-forms#readme",
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@babel/runtime": "^7.
|
|
29
|
-
"@financial-times/n-pricing": "
|
|
30
|
-
"classnames": "2.
|
|
28
|
+
"@babel/runtime": "^7.23.9",
|
|
29
|
+
"@financial-times/n-pricing": "7.1.0",
|
|
30
|
+
"classnames": "2.5.1",
|
|
31
31
|
"fetchres": "1.7.2",
|
|
32
32
|
"lodash.get": "4.4.2",
|
|
33
33
|
"n-common-static-data": "github:Financial-Times/n-common-static-data#v2.4.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@babel/core": "^7.
|
|
37
|
-
"@babel/plugin-transform-runtime": "^7.
|
|
38
|
-
"@babel/preset-env": "^7.
|
|
39
|
-
"@babel/preset-react": "^7.
|
|
40
|
-
"@dotcom-tool-kit/babel": "
|
|
41
|
-
"@dotcom-tool-kit/component": "
|
|
42
|
-
"@dotcom-tool-kit/eslint": "
|
|
43
|
-
"@dotcom-tool-kit/frontend-app": "
|
|
44
|
-
"@dotcom-tool-kit/jest": "
|
|
45
|
-
"@dotcom-tool-kit/lint-staged-npm": "
|
|
46
|
-
"@dotcom-tool-kit/logger": "
|
|
47
|
-
"@dotcom-tool-kit/prettier": "
|
|
48
|
-
"@financial-times/eslint-config-next": "
|
|
36
|
+
"@babel/core": "^7.23.9",
|
|
37
|
+
"@babel/plugin-transform-runtime": "^7.23.9",
|
|
38
|
+
"@babel/preset-env": "^7.23.9",
|
|
39
|
+
"@babel/preset-react": "^7.23.3",
|
|
40
|
+
"@dotcom-tool-kit/babel": "3.1.6",
|
|
41
|
+
"@dotcom-tool-kit/component": "4.1.2",
|
|
42
|
+
"@dotcom-tool-kit/eslint": "3.2.0",
|
|
43
|
+
"@dotcom-tool-kit/frontend-app": "3.2.3",
|
|
44
|
+
"@dotcom-tool-kit/jest": "3.4.0",
|
|
45
|
+
"@dotcom-tool-kit/lint-staged-npm": "3.2.0",
|
|
46
|
+
"@dotcom-tool-kit/logger": "3.4.0",
|
|
47
|
+
"@dotcom-tool-kit/prettier": "3.2.0",
|
|
48
|
+
"@financial-times/eslint-config-next": "7.1.0",
|
|
49
49
|
"@financial-times/jest-browser-resolver": "^1.0.2",
|
|
50
|
-
"@snyk/protect": "1.
|
|
51
|
-
"@storybook/addon-a11y": "^7.
|
|
52
|
-
"@storybook/addon-essentials": "7.
|
|
53
|
-
"@storybook/react": "^7.
|
|
54
|
-
"@storybook/react-webpack5": "^7.
|
|
50
|
+
"@snyk/protect": "1.1278.0",
|
|
51
|
+
"@storybook/addon-a11y": "^7.6.13",
|
|
52
|
+
"@storybook/addon-essentials": "7.6.13",
|
|
53
|
+
"@storybook/react": "^7.6.13",
|
|
54
|
+
"@storybook/react-webpack5": "^7.6.13",
|
|
55
55
|
"@sucrase/jest-plugin": "^3.0.0",
|
|
56
|
-
"check-engines": "^1.
|
|
57
|
-
"dotcom-tool-kit": "
|
|
56
|
+
"check-engines": "^1.6.0",
|
|
57
|
+
"dotcom-tool-kit": "3.4.4",
|
|
58
58
|
"enzyme": "^3.11.0",
|
|
59
59
|
"enzyme-adapter-react-16": "^1.15.7",
|
|
60
|
-
"eslint": "^8.28.0",
|
|
61
60
|
"eslint-config-prettier": "^9.1.0",
|
|
62
|
-
"eslint-plugin-jest": "^27.6.
|
|
63
|
-
"eslint-plugin-prettier": "^5.1.
|
|
61
|
+
"eslint-plugin-jest": "^27.6.3",
|
|
62
|
+
"eslint-plugin-prettier": "^5.1.3",
|
|
64
63
|
"eslint-plugin-react": "^7.33.2",
|
|
65
|
-
"eslint-plugin-storybook": "^0.6.
|
|
64
|
+
"eslint-plugin-storybook": "^0.6.15",
|
|
66
65
|
"fetch-mock": "^7.2.0",
|
|
67
|
-
"html-webpack-plugin": "^5.
|
|
68
|
-
"jest": "^29.
|
|
69
|
-
"jest-environment-jsdom": "^29.
|
|
66
|
+
"html-webpack-plugin": "^5.6.0",
|
|
67
|
+
"jest": "^29.7.0",
|
|
68
|
+
"jest-environment-jsdom": "^29.7.0",
|
|
70
69
|
"jest-serializer-html": "^7.1.0",
|
|
71
|
-
"jsdom": "^
|
|
70
|
+
"jsdom": "^24.0.0",
|
|
72
71
|
"jsdom-global": "^3.0.2",
|
|
73
|
-
"
|
|
74
|
-
"
|
|
75
|
-
"prop-types": "15.7.2",
|
|
72
|
+
"pa11y-ci": "3.1.0",
|
|
73
|
+
"prop-types": "15.8.1",
|
|
76
74
|
"react": "16.14.0",
|
|
77
75
|
"react-dom": "16.14.0",
|
|
78
76
|
"react-is": "^16.13.1",
|
|
79
77
|
"sass": "^1.55.0",
|
|
80
78
|
"sass-loader": "^10.2.1",
|
|
81
|
-
"storybook": "^7.
|
|
82
|
-
"webpack": "^5.
|
|
79
|
+
"storybook": "^7.6.13",
|
|
80
|
+
"webpack": "^5.90.1",
|
|
83
81
|
"webpack-cli": "^5.1.4"
|
|
84
82
|
},
|
|
85
83
|
"engines": {
|
package/utils/apple-pay.spec.js
CHANGED
|
@@ -138,7 +138,7 @@ describe('Apple Pay', () => {
|
|
|
138
138
|
|
|
139
139
|
it('returns merchant id from methods data', () => {
|
|
140
140
|
const methods = [{ data: { merchantIdentifier: 'test' } }];
|
|
141
|
-
expect(ApplePay.getMerchantId(methods)).
|
|
141
|
+
expect(ApplePay.getMerchantId(methods)).toBe('test');
|
|
142
142
|
});
|
|
143
143
|
});
|
|
144
144
|
|
|
@@ -81,7 +81,7 @@ describe('BillingPostcode', () => {
|
|
|
81
81
|
placeholder: 'Enter your postcode',
|
|
82
82
|
});
|
|
83
83
|
billingPostcode.changePostcodeReferenceForCountry = 'GBR';
|
|
84
|
-
expect(querySelectorStub).
|
|
84
|
+
expect(querySelectorStub).toHaveBeenCalledWith('input');
|
|
85
85
|
});
|
|
86
86
|
|
|
87
87
|
it('sets postcode placeholder to `Enter your postcode` by default', () => {
|
|
@@ -89,7 +89,7 @@ describe('BillingPostcode', () => {
|
|
|
89
89
|
placeholder: 'Enter your zip code',
|
|
90
90
|
});
|
|
91
91
|
billingPostcode.changePostcodeReferenceForCountry = 'GBR';
|
|
92
|
-
expect(billingPostcode.postcodeInput.placeholder).
|
|
92
|
+
expect(billingPostcode.postcodeInput.placeholder).toBe(
|
|
93
93
|
'Enter your postcode'
|
|
94
94
|
);
|
|
95
95
|
});
|
|
@@ -99,7 +99,7 @@ describe('BillingPostcode', () => {
|
|
|
99
99
|
placeholder: 'Enter your postcode',
|
|
100
100
|
});
|
|
101
101
|
billingPostcode.changePostcodeReferenceForCountry = 'USA';
|
|
102
|
-
expect(billingPostcode.postcodeInput.placeholder).
|
|
102
|
+
expect(billingPostcode.postcodeInput.placeholder).toBe(
|
|
103
103
|
'Enter your zip code'
|
|
104
104
|
);
|
|
105
105
|
});
|
|
@@ -109,7 +109,7 @@ describe('BillingPostcode', () => {
|
|
|
109
109
|
placeholder: 'Enter your zip code',
|
|
110
110
|
});
|
|
111
111
|
billingPostcode.changePostcodeReferenceForCountry = 'CAN';
|
|
112
|
-
expect(billingPostcode.postcodeInput.placeholder).
|
|
112
|
+
expect(billingPostcode.postcodeInput.placeholder).toBe(
|
|
113
113
|
'Enter your postal code'
|
|
114
114
|
);
|
|
115
115
|
});
|
|
@@ -117,20 +117,20 @@ describe('BillingPostcode', () => {
|
|
|
117
117
|
});
|
|
118
118
|
|
|
119
119
|
describe('getPostcodeReferenceByCountry', () => {
|
|
120
|
-
it('returns post code by default
|
|
121
|
-
expect(BillingPostcode.getPostcodeReferenceByCountry('ZAR')).
|
|
120
|
+
it('returns post code by default', () => {
|
|
121
|
+
expect(BillingPostcode.getPostcodeReferenceByCountry('ZAR')).toBe(
|
|
122
122
|
'postcode'
|
|
123
123
|
);
|
|
124
124
|
});
|
|
125
125
|
|
|
126
126
|
it('returns postal code when country is Canada', () => {
|
|
127
|
-
expect(BillingPostcode.getPostcodeReferenceByCountry('CAN')).
|
|
127
|
+
expect(BillingPostcode.getPostcodeReferenceByCountry('CAN')).toBe(
|
|
128
128
|
'postal code'
|
|
129
129
|
);
|
|
130
130
|
});
|
|
131
131
|
|
|
132
132
|
it('returns zip code when country is USA', () => {
|
|
133
|
-
expect(BillingPostcode.getPostcodeReferenceByCountry('USA')).
|
|
133
|
+
expect(BillingPostcode.getPostcodeReferenceByCountry('USA')).toBe(
|
|
134
134
|
'zip code'
|
|
135
135
|
);
|
|
136
136
|
});
|
|
@@ -39,7 +39,7 @@ describe('Delivery Address Type - Util', () => {
|
|
|
39
39
|
const deliveryAdressTypeUtilInstance = new DeliveryAdressTypeUtil(
|
|
40
40
|
document
|
|
41
41
|
);
|
|
42
|
-
expect(deliveryAdressTypeUtilInstance.getSelected()).
|
|
42
|
+
expect(deliveryAdressTypeUtilInstance.getSelected()).toBe('home');
|
|
43
43
|
});
|
|
44
44
|
|
|
45
45
|
it('returns the option selected different than the default', () => {
|
|
@@ -48,12 +48,12 @@ describe('Delivery Option - Util', () => {
|
|
|
48
48
|
deliveryoptionUtilInstance.showItem('PV');
|
|
49
49
|
expect(document.querySelector('.ncf__hidden #HD')).toBeDefined();
|
|
50
50
|
expect(document.querySelector('#PV')).toBeDefined();
|
|
51
|
-
expect(document.querySelector('.ncf__hidden #PV')).
|
|
51
|
+
expect(document.querySelector('.ncf__hidden #PV')).toBeNull();
|
|
52
52
|
deliveryoptionUtilInstance.showItem('HD');
|
|
53
53
|
deliveryoptionUtilInstance.hideItem('PV');
|
|
54
54
|
expect(document.querySelector('.ncf__hidden #PV')).toBeDefined();
|
|
55
55
|
expect(document.querySelector('#HD')).toBeDefined();
|
|
56
|
-
expect(document.querySelector('.ncf__hidden #HD')).
|
|
56
|
+
expect(document.querySelector('.ncf__hidden #HD')).toBeNull();
|
|
57
57
|
});
|
|
58
58
|
});
|
|
59
59
|
|
|
@@ -89,7 +89,7 @@ describe('DeliveryPostcode', () => {
|
|
|
89
89
|
placeholder: 'Enter your zip code',
|
|
90
90
|
});
|
|
91
91
|
deliveryPostcode.changePostcodeReferenceForCountry = 'GBR';
|
|
92
|
-
expect(deliveryPostcode.postcodeInput.placeholder).
|
|
92
|
+
expect(deliveryPostcode.postcodeInput.placeholder).toBe(
|
|
93
93
|
'Enter your postcode'
|
|
94
94
|
);
|
|
95
95
|
});
|
|
@@ -99,7 +99,7 @@ describe('DeliveryPostcode', () => {
|
|
|
99
99
|
placeholder: 'Enter your postcode',
|
|
100
100
|
});
|
|
101
101
|
deliveryPostcode.changePostcodeReferenceForCountry = 'USA';
|
|
102
|
-
expect(deliveryPostcode.postcodeInput.placeholder).
|
|
102
|
+
expect(deliveryPostcode.postcodeInput.placeholder).toBe(
|
|
103
103
|
'Enter your zip code'
|
|
104
104
|
);
|
|
105
105
|
});
|
|
@@ -109,7 +109,7 @@ describe('DeliveryPostcode', () => {
|
|
|
109
109
|
placeholder: 'Enter your zip code',
|
|
110
110
|
});
|
|
111
111
|
deliveryPostcode.changePostcodeReferenceForCountry = 'CAN';
|
|
112
|
-
expect(deliveryPostcode.postcodeInput.placeholder).
|
|
112
|
+
expect(deliveryPostcode.postcodeInput.placeholder).toBe(
|
|
113
113
|
'Enter your postal code'
|
|
114
114
|
);
|
|
115
115
|
});
|
|
@@ -117,20 +117,20 @@ describe('DeliveryPostcode', () => {
|
|
|
117
117
|
});
|
|
118
118
|
|
|
119
119
|
describe('getPostcodeReferenceByCountry', () => {
|
|
120
|
-
it('returns post code by default
|
|
121
|
-
expect(DeliveryPostcode.getPostcodeReferenceByCountry('ZAR')).
|
|
120
|
+
it('returns post code by default', () => {
|
|
121
|
+
expect(DeliveryPostcode.getPostcodeReferenceByCountry('ZAR')).toBe(
|
|
122
122
|
'postcode'
|
|
123
123
|
);
|
|
124
124
|
});
|
|
125
125
|
|
|
126
126
|
it('returns postal code when country is Canada', () => {
|
|
127
|
-
expect(DeliveryPostcode.getPostcodeReferenceByCountry('CAN')).
|
|
127
|
+
expect(DeliveryPostcode.getPostcodeReferenceByCountry('CAN')).toBe(
|
|
128
128
|
'postal code'
|
|
129
129
|
);
|
|
130
130
|
});
|
|
131
131
|
|
|
132
132
|
it('returns zip code when country is USA', () => {
|
|
133
|
-
expect(DeliveryPostcode.getPostcodeReferenceByCountry('USA')).
|
|
133
|
+
expect(DeliveryPostcode.getPostcodeReferenceByCountry('USA')).toBe(
|
|
134
134
|
'zip code'
|
|
135
135
|
);
|
|
136
136
|
});
|
|
@@ -121,10 +121,8 @@ describe('DeliveryStartDate', () => {
|
|
|
121
121
|
|
|
122
122
|
it('updates the page according to the response from the API call', async () => {
|
|
123
123
|
await setup();
|
|
124
|
-
expect(startDateFieldStub.value).
|
|
125
|
-
expect(startDateTextStub.innerHTML).
|
|
126
|
-
'Saturday 13th of April 2019'
|
|
127
|
-
);
|
|
124
|
+
expect(startDateFieldStub.value).toBe('2019-04-13');
|
|
125
|
+
expect(startDateTextStub.innerHTML).toBe('Saturday 13th of April 2019');
|
|
128
126
|
});
|
|
129
127
|
|
|
130
128
|
it('clears errors and return true if the fetch call succeeds', async () => {
|
package/utils/loader.spec.js
CHANGED
|
@@ -54,7 +54,7 @@ describe('Loader', () => {
|
|
|
54
54
|
it('cleares the content of the partial', () => {
|
|
55
55
|
loader.setContent('<div>Baz</div>');
|
|
56
56
|
loader.clearContent();
|
|
57
|
-
expect(elementStub.innerHTML).
|
|
57
|
+
expect(elementStub.innerHTML).toBe('');
|
|
58
58
|
});
|
|
59
59
|
});
|
|
60
60
|
|
|
@@ -69,11 +69,11 @@ describe('Loader', () => {
|
|
|
69
69
|
});
|
|
70
70
|
it('sets the title of the partial', () => {
|
|
71
71
|
loader.setContent({ title: 'Hooray!' });
|
|
72
|
-
expect(elementStub.innerHTML).
|
|
72
|
+
expect(elementStub.innerHTML).toBe('Hooray!');
|
|
73
73
|
});
|
|
74
74
|
it('sets the content of the partial', () => {
|
|
75
75
|
loader.setContent({ content: '<div>Baz</div>' });
|
|
76
|
-
expect(elementStub.innerHTML).
|
|
76
|
+
expect(elementStub.innerHTML).toBe('<div>Baz</div>');
|
|
77
77
|
});
|
|
78
78
|
});
|
|
79
79
|
|
package/utils/password.spec.js
CHANGED
|
@@ -53,13 +53,13 @@ describe('Password', () => {
|
|
|
53
53
|
it('sets the input type to text', () => {
|
|
54
54
|
passwordElement.type = 'password';
|
|
55
55
|
password.toggleMask(false);
|
|
56
|
-
expect(passwordElement.type).
|
|
56
|
+
expect(passwordElement.type).toBe('text');
|
|
57
57
|
});
|
|
58
58
|
|
|
59
59
|
it('sets the input type to password', () => {
|
|
60
60
|
passwordElement.type = 'text';
|
|
61
61
|
password.toggleMask(true);
|
|
62
|
-
expect(passwordElement.type).
|
|
62
|
+
expect(passwordElement.type).toBe('password');
|
|
63
63
|
});
|
|
64
64
|
});
|
|
65
65
|
});
|
|
@@ -111,7 +111,7 @@ describe('PaymentTerm', () => {
|
|
|
111
111
|
price: '£1.01',
|
|
112
112
|
},
|
|
113
113
|
});
|
|
114
|
-
expect(priceStub.innerHTML).
|
|
114
|
+
expect(priceStub.innerHTML).toBe('£1.01');
|
|
115
115
|
});
|
|
116
116
|
|
|
117
117
|
it('replaces the trial price with the correct updated trial price', () => {
|
|
@@ -127,7 +127,7 @@ describe('PaymentTerm', () => {
|
|
|
127
127
|
trialPrice: '£1.01',
|
|
128
128
|
},
|
|
129
129
|
});
|
|
130
|
-
expect(trialPriceStub.innerHTML).
|
|
130
|
+
expect(trialPriceStub.innerHTML).toBe('£1.01');
|
|
131
131
|
});
|
|
132
132
|
|
|
133
133
|
it('replaces the monthly price with the correct updated monthly price', () => {
|
|
@@ -143,7 +143,7 @@ describe('PaymentTerm', () => {
|
|
|
143
143
|
monthlyPrice: '£1.01',
|
|
144
144
|
},
|
|
145
145
|
});
|
|
146
|
-
expect(monthlyPriceStub.innerHTML).
|
|
146
|
+
expect(monthlyPriceStub.innerHTML).toBe('£1.01');
|
|
147
147
|
});
|
|
148
148
|
|
|
149
149
|
describe('updating base amount', () => {
|
|
@@ -98,7 +98,7 @@ describe('PaymentType', () => {
|
|
|
98
98
|
describe('removeError', () => {
|
|
99
99
|
it('removes a class to the paymentType element', () => {
|
|
100
100
|
paymentType.removeError();
|
|
101
|
-
expect(elementStub.classList.remove).toHaveBeenCalled;
|
|
101
|
+
expect(elementStub.classList.remove).toHaveBeenCalled();
|
|
102
102
|
});
|
|
103
103
|
});
|
|
104
104
|
|
package/utils/postcode.spec.js
CHANGED
|
@@ -29,17 +29,15 @@ describe('postcode', () => {
|
|
|
29
29
|
|
|
30
30
|
describe('getPostcodeReferenceByCountry', () => {
|
|
31
31
|
it('returns postcode by default', () => {
|
|
32
|
-
expect(Postcode.getPostcodeReferenceByCountry('GBR')).
|
|
32
|
+
expect(Postcode.getPostcodeReferenceByCountry('GBR')).toBe('postcode');
|
|
33
33
|
});
|
|
34
34
|
|
|
35
35
|
it('returns zip code when country code is USA', () => {
|
|
36
|
-
expect(Postcode.getPostcodeReferenceByCountry('USA')).
|
|
36
|
+
expect(Postcode.getPostcodeReferenceByCountry('USA')).toBe('zip code');
|
|
37
37
|
});
|
|
38
38
|
|
|
39
39
|
it('returns postal when country code is CAN', () => {
|
|
40
|
-
expect(Postcode.getPostcodeReferenceByCountry('CAN')).
|
|
41
|
-
'postal code'
|
|
42
|
-
);
|
|
40
|
+
expect(Postcode.getPostcodeReferenceByCountry('CAN')).toBe('postal code');
|
|
43
41
|
});
|
|
44
42
|
});
|
|
45
43
|
|
|
@@ -55,7 +53,7 @@ describe('postcode', () => {
|
|
|
55
53
|
describe('postcode reference name', () => {
|
|
56
54
|
it('calls querySelector with [data-reference]', () => {
|
|
57
55
|
postcode.changePostcodeReferenceForCountry = 'GBR';
|
|
58
|
-
expect(querySelectorAllStub).
|
|
56
|
+
expect(querySelectorAllStub).toHaveBeenCalledWith(
|
|
59
57
|
'[data-reference=postcode]'
|
|
60
58
|
);
|
|
61
59
|
});
|
|
@@ -102,9 +100,7 @@ describe('postcode', () => {
|
|
|
102
100
|
placeholder: 'Enter your zip code',
|
|
103
101
|
});
|
|
104
102
|
postcode.changePostcodeReferenceForCountry = 'GBR';
|
|
105
|
-
expect(postcode.postcodeInput.placeholder).
|
|
106
|
-
'Enter your postcode'
|
|
107
|
-
);
|
|
103
|
+
expect(postcode.postcodeInput.placeholder).toBe('Enter your postcode');
|
|
108
104
|
});
|
|
109
105
|
|
|
110
106
|
it('sets postcode placeholder to `Enter your zip code` when country code is USA', () => {
|
|
@@ -112,9 +108,7 @@ describe('postcode', () => {
|
|
|
112
108
|
placeholder: 'Enter your postcode',
|
|
113
109
|
});
|
|
114
110
|
postcode.changePostcodeReferenceForCountry = 'USA';
|
|
115
|
-
expect(postcode.postcodeInput.placeholder).
|
|
116
|
-
'Enter your zip code'
|
|
117
|
-
);
|
|
111
|
+
expect(postcode.postcodeInput.placeholder).toBe('Enter your zip code');
|
|
118
112
|
});
|
|
119
113
|
|
|
120
114
|
it('sets postcode placeholder to `Enter your postal code` when country code is Canada', () => {
|
|
@@ -122,7 +116,7 @@ describe('postcode', () => {
|
|
|
122
116
|
placeholder: 'Enter your zip code',
|
|
123
117
|
});
|
|
124
118
|
postcode.changePostcodeReferenceForCountry = 'CAN';
|
|
125
|
-
expect(postcode.postcodeInput.placeholder).
|
|
119
|
+
expect(postcode.postcodeInput.placeholder).toBe(
|
|
126
120
|
'Enter your postal code'
|
|
127
121
|
);
|
|
128
122
|
});
|
package/utils/salesforce.spec.js
CHANGED
|
@@ -12,7 +12,7 @@ describe('salesforce', () => {
|
|
|
12
12
|
});
|
|
13
13
|
|
|
14
14
|
it('returns the salesforce name for a country', () => {
|
|
15
|
-
expect(isoCodeToSalesforceName('GBR')).
|
|
15
|
+
expect(isoCodeToSalesforceName('GBR')).toBe('United Kingdom');
|
|
16
16
|
});
|
|
17
17
|
});
|
|
18
18
|
|
|
@@ -24,7 +24,7 @@ describe('salesforce', () => {
|
|
|
24
24
|
});
|
|
25
25
|
|
|
26
26
|
it('returns the ISO country code for Salesforce country', () => {
|
|
27
|
-
expect(salesforceNameToIsoCode('United Kingdom')).
|
|
27
|
+
expect(salesforceNameToIsoCode('United Kingdom')).toBe('GBR');
|
|
28
28
|
});
|
|
29
29
|
});
|
|
30
30
|
});
|
package/utils/submit.spec.js
CHANGED
package/utils/validation.spec.js
CHANGED
|
@@ -74,13 +74,13 @@ describe('Validation - Util', () => {
|
|
|
74
74
|
});
|
|
75
75
|
validationTest.init();
|
|
76
76
|
|
|
77
|
-
expect(global.window.onbeforeunload).
|
|
77
|
+
expect(global.window.onbeforeunload).toBeUndefined();
|
|
78
78
|
});
|
|
79
79
|
});
|
|
80
80
|
|
|
81
81
|
describe('onbeforeunload', () => {
|
|
82
82
|
it('returns null by default', () => {
|
|
83
|
-
expect(global.window.onbeforeunload()).
|
|
83
|
+
expect(global.window.onbeforeunload()).toBeNull();
|
|
84
84
|
});
|
|
85
85
|
|
|
86
86
|
it('returns true if the form has changed', () => {
|
package/utils/zuora.spec.js
CHANGED
|
@@ -110,6 +110,7 @@ describe('Zuora', () => {
|
|
|
110
110
|
expect(error instanceof Zuora.ZuoraErrorInvalidPaymentType).toBe(true);
|
|
111
111
|
});
|
|
112
112
|
|
|
113
|
+
// eslint-disable-next-line jest/valid-title
|
|
113
114
|
describe(PaymentType.CREDITCARD, () => {
|
|
114
115
|
it('calls validate', async () => {
|
|
115
116
|
window.Z.validate.mockImplementation((callback) =>
|
|
@@ -144,6 +145,7 @@ describe('Zuora', () => {
|
|
|
144
145
|
});
|
|
145
146
|
});
|
|
146
147
|
|
|
148
|
+
// eslint-disable-next-line jest/valid-title
|
|
147
149
|
describe(PaymentType.DIRECTDEBIT, () => {
|
|
148
150
|
it('calls validate', async () => {
|
|
149
151
|
zuora.onDirectDebitConfirmation = jest.fn((callback) => callback(true));
|