@financial-times/n-conversion-forms 32.11.0 → 33.0.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/__snapshots__/package-change.spec.js.snap +0 -15
- package/components/accept-terms-subscription.jsx +0 -52
- 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/index.js +0 -1
- package/components/industry.spec.js +4 -4
- package/components/job-title.spec.js +2 -2
- package/components/package-change.jsx +9 -13
- package/components/package-change.spec.js +0 -17
- package/components/package-change.stories.js +0 -8
- package/components/payment-term.jsx +13 -45
- package/components/payment-term.spec.js +2 -49
- package/components/payment-term.stories.js +0 -20
- 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/dist/accept-terms-subscription.jsx +0 -26
- package/dist/index.js +0 -7
- package/dist/package-change.jsx +3 -5
- package/dist/payment-term.jsx +6 -30
- 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/components/seven-day-pass-experiment-confirmation.jsx +0 -110
- package/components/seven-day-pass-experiment-confirmation.stories.js +0 -33
- package/dist/seven-day-pass-experiment-confirmation.jsx +0 -93
|
@@ -24,8 +24,6 @@ function AcceptTermsSubscription(_ref) {
|
|
|
24
24
|
isPrintProduct = _ref$isPrintProduct === void 0 ? false : _ref$isPrintProduct,
|
|
25
25
|
_ref$isSingleTerm = _ref.isSingleTerm,
|
|
26
26
|
isSingleTerm = _ref$isSingleTerm === void 0 ? false : _ref$isSingleTerm,
|
|
27
|
-
_ref$is7DayPassExperi = _ref.is7DayPassExperiment,
|
|
28
|
-
is7DayPassExperiment = _ref$is7DayPassExperi === void 0 ? false : _ref$is7DayPassExperi,
|
|
29
27
|
_ref$isTermedSubscrip = _ref.isTermedSubscriptionTermType,
|
|
30
28
|
isTermedSubscriptionTermType = _ref$isTermedSubscrip === void 0 ? false : _ref$isTermedSubscrip,
|
|
31
29
|
_ref$isTransition = _ref.isTransition,
|
|
@@ -53,29 +51,6 @@ function AcceptTermsSubscription(_ref) {
|
|
|
53
51
|
'aria-required': 'true',
|
|
54
52
|
required: true
|
|
55
53
|
};
|
|
56
|
-
if (is7DayPassExperiment) {
|
|
57
|
-
return /*#__PURE__*/_react["default"].createElement("div", divProps, /*#__PURE__*/_react["default"].createElement("ul", {
|
|
58
|
-
className: "o-typography-list ncf__accept-terms-list"
|
|
59
|
-
}, /*#__PURE__*/_react["default"].createElement("li", null, /*#__PURE__*/_react["default"].createElement("span", {
|
|
60
|
-
className: "terms-transition terms-transition--immediate"
|
|
61
|
-
}, "I give consent for my chosen payment method to be charged automatically.")), /*#__PURE__*/_react["default"].createElement("li", null, /*#__PURE__*/_react["default"].createElement("span", {
|
|
62
|
-
className: "terms-transition terms-transition--immediate"
|
|
63
|
-
}, "By placing your order subject to the Terms & Conditions (save for section 2) referred to below, you agree that we may start your 7-day pass immediately upon our acceptance of your order and that you are waiving your statutory right to cancel our contract within 14 days of confirmation. Your payment is a one-time payment collected at the time of checkout, and cancelling at any point (whether before or after the 14-day period) will not entitle you to a refund.")), /*#__PURE__*/_react["default"].createElement("li", null, /*#__PURE__*/_react["default"].createElement("span", {
|
|
64
|
-
className: "terms-transition"
|
|
65
|
-
}, "Please see here for the complete", ' ', /*#__PURE__*/_react["default"].createElement("a", {
|
|
66
|
-
className: "ncf__link--external",
|
|
67
|
-
href: "http://help.ft.com/help/legal-privacy/terms-conditions/",
|
|
68
|
-
target: "_blank",
|
|
69
|
-
rel: "noopener noreferrer"
|
|
70
|
-
}, "Terms & Conditions"), "."))), /*#__PURE__*/_react["default"].createElement("label", {
|
|
71
|
-
className: labelClassName,
|
|
72
|
-
htmlFor: "termsAcceptance"
|
|
73
|
-
}, /*#__PURE__*/_react["default"].createElement("input", inputProps), /*#__PURE__*/_react["default"].createElement("span", {
|
|
74
|
-
className: "o-forms-input__label"
|
|
75
|
-
}, "I agree to the above terms & conditions."), /*#__PURE__*/_react["default"].createElement("p", {
|
|
76
|
-
className: "o-forms-input__error"
|
|
77
|
-
}, "Please accept our terms & conditions")));
|
|
78
|
-
}
|
|
79
54
|
if (isTermedSubscriptionTermType) {
|
|
80
55
|
return /*#__PURE__*/_react["default"].createElement("div", divProps, /*#__PURE__*/_react["default"].createElement("ul", {
|
|
81
56
|
className: "o-typography-list ncf__accept-terms-list"
|
|
@@ -168,7 +143,6 @@ AcceptTermsSubscription.propTypes = {
|
|
|
168
143
|
isTrial: _propTypes["default"].bool,
|
|
169
144
|
isPrintProduct: _propTypes["default"].bool,
|
|
170
145
|
isSingleTerm: _propTypes["default"].bool,
|
|
171
|
-
is7DayPassExperiment: _propTypes["default"].bool,
|
|
172
146
|
isTermedSubscriptionTermType: _propTypes["default"].bool,
|
|
173
147
|
isTransition: _propTypes["default"].bool,
|
|
174
148
|
transitionType: _propTypes["default"].string,
|
package/dist/index.js
CHANGED
|
@@ -339,12 +339,6 @@ Object.defineProperty(exports, "Section", {
|
|
|
339
339
|
return _section.Section;
|
|
340
340
|
}
|
|
341
341
|
});
|
|
342
|
-
Object.defineProperty(exports, "SevenDayPassExperimentConfirmation", {
|
|
343
|
-
enumerable: true,
|
|
344
|
-
get: function get() {
|
|
345
|
-
return _sevenDayPassExperimentConfirmation.SevenDayPassExperimentConfirmation;
|
|
346
|
-
}
|
|
347
|
-
});
|
|
348
342
|
Object.defineProperty(exports, "State", {
|
|
349
343
|
enumerable: true,
|
|
350
344
|
get: function get() {
|
|
@@ -420,7 +414,6 @@ var _province = require("./province");
|
|
|
420
414
|
var _registrationConfirmation = require("./registration-confirmation");
|
|
421
415
|
var _responsibility = require("./responsibility");
|
|
422
416
|
var _section = require("./section");
|
|
423
|
-
var _sevenDayPassExperimentConfirmation = require("./seven-day-pass-experiment-confirmation");
|
|
424
417
|
var _state = require("./state");
|
|
425
418
|
var _submit = require("./submit");
|
|
426
419
|
var _trialBanner = require("./trial-banner");
|
package/dist/package-change.jsx
CHANGED
|
@@ -10,8 +10,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
10
10
|
function PackageChange(_ref) {
|
|
11
11
|
var changePackageUrl = _ref.changePackageUrl,
|
|
12
12
|
currentPackage = _ref.currentPackage,
|
|
13
|
-
packageDescription = _ref.packageDescription
|
|
14
|
-
is7DayPassExperiment = _ref.is7DayPassExperiment;
|
|
13
|
+
packageDescription = _ref.packageDescription;
|
|
15
14
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
16
15
|
className: "ncf__package-change"
|
|
17
16
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
@@ -22,7 +21,7 @@ function PackageChange(_ref) {
|
|
|
22
21
|
className: "ncf__strong"
|
|
23
22
|
}, currentPackage)), packageDescription && /*#__PURE__*/_react["default"].createElement("p", {
|
|
24
23
|
className: "ncf__package-change__content__description"
|
|
25
|
-
}, packageDescription)),
|
|
24
|
+
}, packageDescription)), /*#__PURE__*/_react["default"].createElement("div", {
|
|
26
25
|
className: "ncf__package-change__actions"
|
|
27
26
|
}, /*#__PURE__*/_react["default"].createElement("a", {
|
|
28
27
|
href: changePackageUrl,
|
|
@@ -33,6 +32,5 @@ function PackageChange(_ref) {
|
|
|
33
32
|
PackageChange.propTypes = {
|
|
34
33
|
changePackageUrl: _propTypes["default"].string.isRequired,
|
|
35
34
|
currentPackage: _propTypes["default"].string.isRequired,
|
|
36
|
-
packageDescription: _propTypes["default"].string
|
|
37
|
-
is7DayPassExperiment: _propTypes["default"].bool
|
|
35
|
+
packageDescription: _propTypes["default"].string
|
|
38
36
|
};
|
package/dist/payment-term.jsx
CHANGED
|
@@ -34,8 +34,6 @@ function PaymentTerm(_ref) {
|
|
|
34
34
|
optionsInARow = _ref$optionsInARow === void 0 ? false : _ref$optionsInARow,
|
|
35
35
|
_ref$billingCountry = _ref.billingCountry,
|
|
36
36
|
billingCountry = _ref$billingCountry === void 0 ? '' : _ref$billingCountry,
|
|
37
|
-
_ref$is7DayPassExperi = _ref.is7DayPassExperiment,
|
|
38
|
-
is7DayPassExperiment = _ref$is7DayPassExperi === void 0 ? false : _ref$is7DayPassExperi,
|
|
39
37
|
_ref$isTermedSubscrip = _ref.isTermedSubscriptionTermType,
|
|
40
38
|
isTermedSubscriptionTermType = _ref$isTermedSubscrip === void 0 ? false : _ref$isTermedSubscrip,
|
|
41
39
|
_ref$isTrialOfferAsNo = _ref.isTrialOfferAsNonTrialOverride,
|
|
@@ -133,16 +131,10 @@ function PaymentTerm(_ref) {
|
|
|
133
131
|
},
|
|
134
132
|
monthly: {
|
|
135
133
|
title: 'Monthly',
|
|
136
|
-
price: function price(_price3
|
|
137
|
-
var paymentIntervalTextToDisplay = function () {
|
|
138
|
-
if (is7DayPassExperiment) {
|
|
139
|
-
return ' one-time payment';
|
|
140
|
-
}
|
|
141
|
-
return ' per month';
|
|
142
|
-
}();
|
|
134
|
+
price: function price(_price3) {
|
|
143
135
|
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("span", {
|
|
144
136
|
className: "ncf__payment-term__price"
|
|
145
|
-
}, _price3),
|
|
137
|
+
}, _price3), " per month");
|
|
146
138
|
},
|
|
147
139
|
trialPrice: function trialPrice(price) {
|
|
148
140
|
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, "Unless you cancel during your trial you will be billed", ' ', /*#__PURE__*/_react["default"].createElement("span", {
|
|
@@ -151,15 +143,7 @@ function PaymentTerm(_ref) {
|
|
|
151
143
|
},
|
|
152
144
|
monthlyPrice: function monthlyPrice() {},
|
|
153
145
|
renewsText: function renewsText(isFixedTermOffer) {
|
|
154
|
-
var textToDisplay =
|
|
155
|
-
if (is7DayPassExperiment) {
|
|
156
|
-
return 'This subscription is for 7 days, charged at the outset.';
|
|
157
|
-
}
|
|
158
|
-
if (isFixedTermOffer) {
|
|
159
|
-
return 'This subscription is for 3 months, charged monthly. You can cancel at anytime';
|
|
160
|
-
}
|
|
161
|
-
return 'Renews monthly unless cancelled';
|
|
162
|
-
}();
|
|
146
|
+
var textToDisplay = isFixedTermOffer ? 'This subscription is for 3 months, charged monthly. You can cancel at anytime' : 'Renews monthly unless cancelled';
|
|
163
147
|
return /*#__PURE__*/_react["default"].createElement("p", {
|
|
164
148
|
className: "ncf__payment-term__renews-text"
|
|
165
149
|
}, textToDisplay);
|
|
@@ -221,7 +205,7 @@ function PaymentTerm(_ref) {
|
|
|
221
205
|
className: "ncf__payment-term__trial-price"
|
|
222
206
|
}, option.trialPrice), /*#__PURE__*/_react["default"].createElement("br", null), nameMap[option.name] && nameMap[option.name].trialPrice(option.price)) : /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, nameMap[option.name] ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
223
207
|
className: "ncf__payment-term__description"
|
|
224
|
-
}, nameMap[option.name].price(option.price
|
|
208
|
+
}, nameMap[option.name].price(option.price), nameMap[option.name].monthlyPrice(option.monthlyPrice), nameMap[option.name].renewsText(isFixedTermOffer)) :
|
|
225
209
|
// this should cover the cases different than annual, quarterly and monthly
|
|
226
210
|
// for those containing period on option.value, render custom template, for the rest keep legacy render
|
|
227
211
|
isValidPeriod(option.value) ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
@@ -244,16 +228,8 @@ function PaymentTerm(_ref) {
|
|
|
244
228
|
if (isTrialOfferAsNonTrialOverride && labelOverride) {
|
|
245
229
|
return labelOverride;
|
|
246
230
|
}
|
|
247
|
-
var defaultTitle =
|
|
248
|
-
|
|
249
|
-
return '';
|
|
250
|
-
}
|
|
251
|
-
if (Boolean(option.name && nameMap[option.name])) {
|
|
252
|
-
return nameMap[option.name].title;
|
|
253
|
-
}
|
|
254
|
-
return '';
|
|
255
|
-
}();
|
|
256
|
-
var title = isFixedTermOffer ? [offerDisplayName, defaultTitle].filter(Boolean).join(' - ') : defaultTitle;
|
|
231
|
+
var defaultTitle = option.name && nameMap[option.name] ? nameMap[option.name].title : '';
|
|
232
|
+
var title = isFixedTermOffer ? "".concat(offerDisplayName, " - ").concat(defaultTitle) : defaultTitle;
|
|
257
233
|
var termDisplayName = '';
|
|
258
234
|
if (showTrialCopyInTitle) {
|
|
259
235
|
var termName = option.displayName ? option.displayName : 'Premium Digital';
|
|
@@ -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": "
|
|
3
|
+
"version": "33.0.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
|
});
|