@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
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
|
@@ -1,20 +1,5 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`PackageChange annual render when is7DayPassExperiment is true 1`] = `
|
|
4
|
-
<div class="ncf__package-change">
|
|
5
|
-
<div class="ncf__package-change__package">
|
|
6
|
-
<div class="ncf__package-change__content">
|
|
7
|
-
<p>
|
|
8
|
-
You have chosen
|
|
9
|
-
<span class="ncf__strong">
|
|
10
|
-
Trial
|
|
11
|
-
</span>
|
|
12
|
-
</p>
|
|
13
|
-
</div>
|
|
14
|
-
</div>
|
|
15
|
-
</div>
|
|
16
|
-
`;
|
|
17
|
-
|
|
18
3
|
exports[`PackageChange annual render with defaults 1`] = `
|
|
19
4
|
<div class="ncf__package-change">
|
|
20
5
|
<div class="ncf__package-change__package">
|
|
@@ -9,7 +9,6 @@ export function AcceptTermsSubscription({
|
|
|
9
9
|
isTrial = false,
|
|
10
10
|
isPrintProduct = false,
|
|
11
11
|
isSingleTerm = false,
|
|
12
|
-
is7DayPassExperiment = false,
|
|
13
12
|
isTermedSubscriptionTermType = false,
|
|
14
13
|
isTransition = false,
|
|
15
14
|
transitionType = null,
|
|
@@ -39,56 +38,6 @@ export function AcceptTermsSubscription({
|
|
|
39
38
|
required: true,
|
|
40
39
|
};
|
|
41
40
|
|
|
42
|
-
if (is7DayPassExperiment) {
|
|
43
|
-
return (
|
|
44
|
-
<div {...divProps}>
|
|
45
|
-
<ul className="o-typography-list ncf__accept-terms-list">
|
|
46
|
-
<li>
|
|
47
|
-
<span className="terms-transition terms-transition--immediate">
|
|
48
|
-
I give consent for my chosen payment method to be charged
|
|
49
|
-
automatically.
|
|
50
|
-
</span>
|
|
51
|
-
</li>
|
|
52
|
-
<li>
|
|
53
|
-
<span className="terms-transition terms-transition--immediate">
|
|
54
|
-
By placing your order subject to the Terms & Conditions (save for
|
|
55
|
-
section 2) referred to below, you agree that we may start your
|
|
56
|
-
7-day pass immediately upon our acceptance of your order and that
|
|
57
|
-
you are waiving your statutory right to cancel our contract within
|
|
58
|
-
14 days of confirmation. Your payment is a one-time payment
|
|
59
|
-
collected at the time of checkout, and cancelling at any point
|
|
60
|
-
(whether before or after the 14-day period) will not entitle you
|
|
61
|
-
to a refund.
|
|
62
|
-
</span>
|
|
63
|
-
</li>
|
|
64
|
-
<li>
|
|
65
|
-
<span className="terms-transition">
|
|
66
|
-
Please see here for the complete{' '}
|
|
67
|
-
<a
|
|
68
|
-
className="ncf__link--external"
|
|
69
|
-
href="http://help.ft.com/help/legal-privacy/terms-conditions/"
|
|
70
|
-
target="_blank"
|
|
71
|
-
rel="noopener noreferrer"
|
|
72
|
-
>
|
|
73
|
-
Terms & Conditions
|
|
74
|
-
</a>
|
|
75
|
-
.
|
|
76
|
-
</span>
|
|
77
|
-
</li>
|
|
78
|
-
</ul>
|
|
79
|
-
<label className={labelClassName} htmlFor="termsAcceptance">
|
|
80
|
-
<input {...inputProps} />
|
|
81
|
-
<span className="o-forms-input__label">
|
|
82
|
-
I agree to the above terms & conditions.
|
|
83
|
-
</span>
|
|
84
|
-
<p className="o-forms-input__error">
|
|
85
|
-
Please accept our terms & conditions
|
|
86
|
-
</p>
|
|
87
|
-
</label>
|
|
88
|
-
</div>
|
|
89
|
-
);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
41
|
if (isTermedSubscriptionTermType) {
|
|
93
42
|
return (
|
|
94
43
|
<div {...divProps}>
|
|
@@ -309,7 +258,6 @@ AcceptTermsSubscription.propTypes = {
|
|
|
309
258
|
isTrial: PropTypes.bool,
|
|
310
259
|
isPrintProduct: PropTypes.bool,
|
|
311
260
|
isSingleTerm: PropTypes.bool,
|
|
312
|
-
is7DayPassExperiment: PropTypes.bool,
|
|
313
261
|
isTermedSubscriptionTermType: PropTypes.bool,
|
|
314
262
|
isTransition: PropTypes.bool,
|
|
315
263
|
transitionType: PropTypes.string,
|
|
@@ -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
|
});
|
package/components/index.js
CHANGED
|
@@ -49,7 +49,6 @@ export { Province } from './province';
|
|
|
49
49
|
export { RegistrationConfirmation } from './registration-confirmation';
|
|
50
50
|
export { Responsibility } from './responsibility';
|
|
51
51
|
export { Section } from './section';
|
|
52
|
-
export { SevenDayPassExperimentConfirmation } from './seven-day-pass-experiment-confirmation';
|
|
53
52
|
export { State } from './state';
|
|
54
53
|
export { Submit } from './submit';
|
|
55
54
|
export { TrialBanner } from './trial-banner';
|
|
@@ -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
|
});
|
|
@@ -5,7 +5,6 @@ export function PackageChange({
|
|
|
5
5
|
changePackageUrl,
|
|
6
6
|
currentPackage,
|
|
7
7
|
packageDescription,
|
|
8
|
-
is7DayPassExperiment,
|
|
9
8
|
}) {
|
|
10
9
|
return (
|
|
11
10
|
<div className="ncf__package-change">
|
|
@@ -21,17 +20,15 @@ export function PackageChange({
|
|
|
21
20
|
</p>
|
|
22
21
|
)}
|
|
23
22
|
</div>
|
|
24
|
-
|
|
25
|
-
<
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
</div>
|
|
34
|
-
)}
|
|
23
|
+
<div className="ncf__package-change__actions">
|
|
24
|
+
<a
|
|
25
|
+
href={changePackageUrl}
|
|
26
|
+
className="ncf__button ncf__button--mono ncf__button--baseline"
|
|
27
|
+
data-trackable="change"
|
|
28
|
+
>
|
|
29
|
+
Change
|
|
30
|
+
</a>
|
|
31
|
+
</div>
|
|
35
32
|
</div>
|
|
36
33
|
</div>
|
|
37
34
|
);
|
|
@@ -41,5 +38,4 @@ PackageChange.propTypes = {
|
|
|
41
38
|
changePackageUrl: PropTypes.string.isRequired,
|
|
42
39
|
currentPackage: PropTypes.string.isRequired,
|
|
43
40
|
packageDescription: PropTypes.string,
|
|
44
|
-
is7DayPassExperiment: PropTypes.bool,
|
|
45
41
|
};
|
|
@@ -74,23 +74,6 @@ describe('PackageChange', () => {
|
|
|
74
74
|
|
|
75
75
|
expect(PackageChange).toRenderCorrectly(props);
|
|
76
76
|
});
|
|
77
|
-
|
|
78
|
-
it('render when is7DayPassExperiment is true', () => {
|
|
79
|
-
const props = {
|
|
80
|
-
changePackageUrl: 'https://www.ft.com',
|
|
81
|
-
currentPackage: 'Trial',
|
|
82
|
-
is7DayPassExperiment: true,
|
|
83
|
-
terms: [
|
|
84
|
-
{
|
|
85
|
-
name: term,
|
|
86
|
-
price: '£4.99',
|
|
87
|
-
weeklyPrice: '£4.99',
|
|
88
|
-
},
|
|
89
|
-
],
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
expect(PackageChange).toRenderCorrectly(props);
|
|
93
|
-
});
|
|
94
77
|
});
|
|
95
78
|
});
|
|
96
79
|
});
|
|
@@ -18,11 +18,3 @@ WithPackageDescription.args = {
|
|
|
18
18
|
changePackageUrl: 'https://ft.com/products',
|
|
19
19
|
packageDescription: 'Personalised email briefings and alerts',
|
|
20
20
|
};
|
|
21
|
-
|
|
22
|
-
export const SevenDayPassExperiment = (args) => <PackageChange {...args} />;
|
|
23
|
-
SevenDayPassExperiment.args = {
|
|
24
|
-
currentPackage: 'Premium Digital',
|
|
25
|
-
changePackageUrl: 'https://ft.com/products',
|
|
26
|
-
packageDescription: 'Personalised email briefings and alerts',
|
|
27
|
-
is7DayPassExperiment: true,
|
|
28
|
-
};
|
|
@@ -15,7 +15,6 @@ export function PaymentTerm({
|
|
|
15
15
|
largePrice = false,
|
|
16
16
|
optionsInARow = false,
|
|
17
17
|
billingCountry = '',
|
|
18
|
-
is7DayPassExperiment = false,
|
|
19
18
|
isTermedSubscriptionTermType = false,
|
|
20
19
|
isTrialOfferAsNonTrialOverride = false,
|
|
21
20
|
labelOverride = '', // this is a temporary hack for the February 2024 campaign
|
|
@@ -121,22 +120,11 @@ export function PaymentTerm({
|
|
|
121
120
|
},
|
|
122
121
|
monthly: {
|
|
123
122
|
title: 'Monthly',
|
|
124
|
-
price: (price
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
return ' per month';
|
|
131
|
-
})();
|
|
132
|
-
|
|
133
|
-
return (
|
|
134
|
-
<React.Fragment>
|
|
135
|
-
<span className="ncf__payment-term__price">{price}</span>
|
|
136
|
-
{paymentIntervalTextToDisplay}
|
|
137
|
-
</React.Fragment>
|
|
138
|
-
);
|
|
139
|
-
},
|
|
123
|
+
price: (price) => (
|
|
124
|
+
<React.Fragment>
|
|
125
|
+
<span className="ncf__payment-term__price">{price}</span> per month
|
|
126
|
+
</React.Fragment>
|
|
127
|
+
),
|
|
140
128
|
trialPrice: (price) => (
|
|
141
129
|
<React.Fragment>
|
|
142
130
|
Unless you cancel during your trial you will be billed{' '}
|
|
@@ -146,17 +134,9 @@ export function PaymentTerm({
|
|
|
146
134
|
),
|
|
147
135
|
monthlyPrice: () => {},
|
|
148
136
|
renewsText: (isFixedTermOffer) => {
|
|
149
|
-
const textToDisplay =
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
if (isFixedTermOffer) {
|
|
155
|
-
return 'This subscription is for 3 months, charged monthly. You can cancel at anytime';
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
return 'Renews monthly unless cancelled';
|
|
159
|
-
})();
|
|
137
|
+
const textToDisplay = isFixedTermOffer
|
|
138
|
+
? 'This subscription is for 3 months, charged monthly. You can cancel at anytime'
|
|
139
|
+
: 'Renews monthly unless cancelled';
|
|
160
140
|
|
|
161
141
|
return (
|
|
162
142
|
<p className="ncf__payment-term__renews-text">{textToDisplay}</p>
|
|
@@ -253,12 +233,9 @@ export function PaymentTerm({
|
|
|
253
233
|
<React.Fragment>
|
|
254
234
|
{nameMap[option.name] ? (
|
|
255
235
|
<div className="ncf__payment-term__description">
|
|
256
|
-
{nameMap[option.name].price(option.price
|
|
236
|
+
{nameMap[option.name].price(option.price)}
|
|
257
237
|
{nameMap[option.name].monthlyPrice(option.monthlyPrice)}
|
|
258
|
-
{nameMap[option.name].renewsText(
|
|
259
|
-
isFixedTermOffer,
|
|
260
|
-
is7DayPassExperiment
|
|
261
|
-
)}
|
|
238
|
+
{nameMap[option.name].renewsText(isFixedTermOffer)}
|
|
262
239
|
{/* Remove this discount text temporarily in favour of monthly price */}
|
|
263
240
|
{/* <br />Save up to 25% when you pay annually */}
|
|
264
241
|
</div>
|
|
@@ -310,20 +287,11 @@ export function PaymentTerm({
|
|
|
310
287
|
return labelOverride;
|
|
311
288
|
}
|
|
312
289
|
|
|
313
|
-
const defaultTitle =
|
|
314
|
-
|
|
315
|
-
return '';
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
if (Boolean(option.name && nameMap[option.name])) {
|
|
319
|
-
return nameMap[option.name].title;
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
return '';
|
|
323
|
-
})();
|
|
290
|
+
const defaultTitle =
|
|
291
|
+
option.name && nameMap[option.name] ? nameMap[option.name].title : '';
|
|
324
292
|
|
|
325
293
|
const title = isFixedTermOffer
|
|
326
|
-
?
|
|
294
|
+
? `${offerDisplayName} - ${defaultTitle}`
|
|
327
295
|
: defaultTitle;
|
|
328
296
|
|
|
329
297
|
let termDisplayName = '';
|
|
@@ -153,37 +153,6 @@ describe('PaymentTerm', () => {
|
|
|
153
153
|
});
|
|
154
154
|
});
|
|
155
155
|
|
|
156
|
-
describe('given is7DayPassExperiment is true', () => {
|
|
157
|
-
const options = [
|
|
158
|
-
{
|
|
159
|
-
name: 'monthly',
|
|
160
|
-
price: '$5.00',
|
|
161
|
-
value: 'monthly',
|
|
162
|
-
monthlyPrice: '$5.00',
|
|
163
|
-
},
|
|
164
|
-
];
|
|
165
|
-
const wrapper = shallow(
|
|
166
|
-
<PaymentTerm
|
|
167
|
-
isFixedTermOffer={true}
|
|
168
|
-
options={options}
|
|
169
|
-
offerDisplayName="7-day pass"
|
|
170
|
-
is7DayPassExperiment={true}
|
|
171
|
-
/>
|
|
172
|
-
);
|
|
173
|
-
|
|
174
|
-
it('renders renewal text that actually reflects how the 7-day pass is a fixed term subscription with a one-off payment made at the outset', () => {
|
|
175
|
-
expect(wrapper.find('.ncf__payment-term__renews-text').text()).toMatch(
|
|
176
|
-
/This subscription is for 7 days, charged at the outset./
|
|
177
|
-
);
|
|
178
|
-
});
|
|
179
|
-
|
|
180
|
-
it('renders offer name and omits payment term title', () => {
|
|
181
|
-
expect(wrapper.find('.ncf__payment-term__title').text()).toMatch(
|
|
182
|
-
'7-day pass'
|
|
183
|
-
);
|
|
184
|
-
});
|
|
185
|
-
});
|
|
186
|
-
|
|
187
156
|
describe('given isTermedSubscriptionTermType is true', () => {
|
|
188
157
|
describe('options include duration expressed in weeks', () => {
|
|
189
158
|
const options = [
|
|
@@ -299,22 +268,6 @@ describe('PaymentTerm', () => {
|
|
|
299
268
|
);
|
|
300
269
|
});
|
|
301
270
|
});
|
|
302
|
-
describe('7-day pass experiment', () => {
|
|
303
|
-
const options = [
|
|
304
|
-
{
|
|
305
|
-
...baseOptions,
|
|
306
|
-
isTrial: false,
|
|
307
|
-
},
|
|
308
|
-
];
|
|
309
|
-
it('renders with time period only if trial.option == false', () => {
|
|
310
|
-
const wrapper = shallow(
|
|
311
|
-
<PaymentTerm options={options} is7DayPassExperiment={true} />
|
|
312
|
-
);
|
|
313
|
-
expect(wrapper.find('.ncf__payment-term__label').text().trim()).toMatch(
|
|
314
|
-
'£20.00 one-time paymentThis subscription is for 7 days, charged at the outset.'
|
|
315
|
-
);
|
|
316
|
-
});
|
|
317
|
-
});
|
|
318
271
|
});
|
|
319
272
|
|
|
320
273
|
describe('[data-base-amount]', () => {
|
|
@@ -331,7 +284,7 @@ describe('PaymentTerm', () => {
|
|
|
331
284
|
},
|
|
332
285
|
];
|
|
333
286
|
const wrapper = shallow(<PaymentTerm options={options} />);
|
|
334
|
-
expect(wrapper.find('input').prop('data-base-amount')).
|
|
287
|
+
expect(wrapper.find('input').prop('data-base-amount')).toBe(100);
|
|
335
288
|
});
|
|
336
289
|
|
|
337
290
|
it('renders option.trialAmount as data-base-amount if isTrial is true', () => {
|
|
@@ -347,7 +300,7 @@ describe('PaymentTerm', () => {
|
|
|
347
300
|
},
|
|
348
301
|
];
|
|
349
302
|
const wrapper = shallow(<PaymentTerm options={options} />);
|
|
350
|
-
expect(wrapper.find('input').prop('data-base-amount')).
|
|
303
|
+
expect(wrapper.find('input').prop('data-base-amount')).toBe(1);
|
|
351
304
|
});
|
|
352
305
|
});
|
|
353
306
|
|
|
@@ -109,26 +109,6 @@ FixedTermOffer.args = {
|
|
|
109
109
|
offerDisplayName: 'Mix & Match',
|
|
110
110
|
};
|
|
111
111
|
|
|
112
|
-
export const SevenDayPassExperimentOffer = (args) => (
|
|
113
|
-
<div className="ncf">
|
|
114
|
-
<Fieldset>
|
|
115
|
-
<PaymentTerm {...args} />
|
|
116
|
-
</Fieldset>
|
|
117
|
-
</div>
|
|
118
|
-
);
|
|
119
|
-
SevenDayPassExperimentOffer.args = {
|
|
120
|
-
options: [
|
|
121
|
-
{
|
|
122
|
-
name: 'monthly',
|
|
123
|
-
price: '$5.00',
|
|
124
|
-
value: 5.0,
|
|
125
|
-
},
|
|
126
|
-
],
|
|
127
|
-
isFixedTermOffer: true,
|
|
128
|
-
is7DayPassExperiment: true,
|
|
129
|
-
offerDisplayName: '7-day pass',
|
|
130
|
-
};
|
|
131
|
-
|
|
132
112
|
export const TermedSubscriptionTermType = (args) => (
|
|
133
113
|
<div className="ncf">
|
|
134
114
|
<Fieldset>
|
|
@@ -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', () => {
|