@comicrelief/component-library 6.10.0 → 7.0.1

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.
Files changed (56) hide show
  1. package/cypress/integration/components/Organisms/Donate.spec.js +13 -13
  2. package/cypress/integration/components/Organisms/EmailSignUp.spec.js +47 -132
  3. package/dist/components/Organisms/Donate/Donate.md +9 -9
  4. package/dist/components/Organisms/Donate/Form/Form.js +2 -1
  5. package/dist/components/Organisms/Donate/GivingSelector/GivingSelector.js +17 -71
  6. package/dist/components/Organisms/Donate/GivingSelector/GivingSelector.style.js +71 -0
  7. package/dist/components/Organisms/Donate/__snapshots__/Donate.test.js.snap +11 -25
  8. package/dist/components/Organisms/EmailSignUp/EmailSignUp.md +8 -123
  9. package/dist/components/Organisms/EmailSignUp/EmailSignUp.style.js +46 -29
  10. package/dist/components/Organisms/EmailSignUp/EmailSignUp.test.js +24 -69
  11. package/dist/components/Organisms/EmailSignUp/EmailSignUpForm.js +92 -0
  12. package/dist/components/Organisms/EmailSignUp/_Confetti.js +116 -0
  13. package/dist/components/Organisms/EmailSignUp/_EmailSignUp.js +107 -0
  14. package/dist/components/Organisms/EmailSignUp/_EmailSignUpConfig.js +51 -0
  15. package/dist/components/Organisms/EmailSignUp/_TextInput.js +51 -0
  16. package/dist/components/Organisms/EmailSignUp/__snapshots__/EmailSignUp.test.js.snap +249 -406
  17. package/dist/components/Organisms/Header/Header.md +1 -13
  18. package/dist/components/Organisms/Membership/Membership.test.js +1 -1
  19. package/dist/index.js +14 -10
  20. package/package.json +2 -1
  21. package/src/components/Organisms/Donate/Donate.md +9 -9
  22. package/src/components/Organisms/Donate/Form/Form.js +1 -0
  23. package/src/components/Organisms/Donate/GivingSelector/GivingSelector.js +15 -85
  24. package/src/components/Organisms/Donate/GivingSelector/GivingSelector.style.js +78 -0
  25. package/src/components/Organisms/Donate/__snapshots__/Donate.test.js.snap +11 -25
  26. package/src/components/Organisms/EmailSignUp/EmailSignUp.md +8 -123
  27. package/src/components/Organisms/EmailSignUp/EmailSignUp.style.js +33 -13
  28. package/src/components/Organisms/EmailSignUp/EmailSignUp.test.js +35 -69
  29. package/src/components/Organisms/EmailSignUp/EmailSignUpForm.js +60 -0
  30. package/src/components/Organisms/EmailSignUp/_Confetti.js +106 -0
  31. package/src/components/Organisms/EmailSignUp/_EmailSignUp.js +138 -0
  32. package/src/components/Organisms/EmailSignUp/_EmailSignUpConfig.js +54 -0
  33. package/src/components/Organisms/EmailSignUp/_TextInput.js +45 -0
  34. package/src/components/Organisms/EmailSignUp/__snapshots__/EmailSignUp.test.js.snap +249 -406
  35. package/src/components/Organisms/Header/Header.md +1 -13
  36. package/src/components/Organisms/Membership/Membership.test.js +33 -33
  37. package/src/index.js +10 -4
  38. package/cypress/integration/components/Molecules/HeaderEsuWithIcon.spec.js +0 -69
  39. package/dist/components/Molecules/HeaderEsuWithIcon/HeaderEsuWithIcon.js +0 -136
  40. package/dist/components/Molecules/HeaderEsuWithIcon/HeaderEsuWithIcon.md +0 -47
  41. package/dist/components/Molecules/HeaderEsuWithIcon/HeaderEsuWithIcon.style.js +0 -52
  42. package/dist/components/Molecules/HeaderEsuWithIcon/HeaderEsuWithIcon.test.js +0 -99
  43. package/dist/components/Molecules/HeaderEsuWithIcon/__snapshots__/HeaderEsuWithIcon.test.js.snap +0 -1211
  44. package/dist/components/Molecules/HeaderEsuWithIcon/assets/HeaderIcons.js +0 -25
  45. package/dist/components/Molecules/HeaderEsuWithIcon/assets/icon--close.svg +0 -5
  46. package/dist/components/Molecules/HeaderEsuWithIcon/assets/icon--email.svg +0 -5
  47. package/dist/components/Organisms/EmailSignUp/EmailSignUp.js +0 -182
  48. package/src/components/Molecules/HeaderEsuWithIcon/HeaderEsuWithIcon.js +0 -135
  49. package/src/components/Molecules/HeaderEsuWithIcon/HeaderEsuWithIcon.md +0 -47
  50. package/src/components/Molecules/HeaderEsuWithIcon/HeaderEsuWithIcon.style.js +0 -60
  51. package/src/components/Molecules/HeaderEsuWithIcon/HeaderEsuWithIcon.test.js +0 -103
  52. package/src/components/Molecules/HeaderEsuWithIcon/__snapshots__/HeaderEsuWithIcon.test.js.snap +0 -1211
  53. package/src/components/Molecules/HeaderEsuWithIcon/assets/HeaderIcons.js +0 -15
  54. package/src/components/Molecules/HeaderEsuWithIcon/assets/icon--close.svg +0 -5
  55. package/src/components/Molecules/HeaderEsuWithIcon/assets/icon--email.svg +0 -5
  56. package/src/components/Organisms/EmailSignUp/EmailSignUp.js +0 -197
@@ -36,12 +36,11 @@ import Link from '../../Atoms/Link/Link';
36
36
  />;
37
37
  ```
38
38
 
39
- # Comic Relief header with Search and ESU
39
+ # Comic Relief header with Search
40
40
 
41
41
  ```js
42
42
  import data from './data/data';
43
43
  import Link from '../../Atoms/Link/Link';
44
- import HeaderEsuWithIcon from '../../Molecules/HeaderEsuWithIcon/HeaderEsuWithIcon';
45
44
  import searchIcon from './assets/icon--search.svg';
46
45
  import Icon from '../../Atoms/SocialIcons/Icon/Icon';
47
46
  import RichText from '../../Atoms/RichText/RichText';
@@ -86,17 +85,6 @@ const [success, setSuccess] = React.useState(false);
86
85
  tabIndex="0"
87
86
  />
88
87
  </div>
89
-
90
- <HeaderEsuWithIcon
91
- title={title}
92
- topCopy={topCopy}
93
- privacyCopy={privacyCopy}
94
- successCopy={successCopy}
95
- isSuccess={success}
96
- privacyCopy={privacyCopy}
97
- errorMsg=""
98
- subscribe={() => setSuccess(!success)}
99
- />
100
88
  </>
101
89
  }
102
90
  />;
@@ -126,6 +126,39 @@ it("renders correctly", () => {
126
126
  font-size: 1.25rem;
127
127
  }
128
128
 
129
+ .c15 {
130
+ display: block;
131
+ }
132
+
133
+ .c15 input {
134
+ border: 2px solid #E1E2E3;
135
+ font-size: 1.5rem;
136
+ font-weight: 800;
137
+ -webkit-letter-spacing: -2px;
138
+ -moz-letter-spacing: -2px;
139
+ -ms-letter-spacing: -2px;
140
+ letter-spacing: -2px;
141
+ height: auto;
142
+ }
143
+
144
+ .c20 {
145
+ display: block;
146
+ }
147
+
148
+ .c20 input {
149
+ border: 2px solid #E1E2E3;
150
+ font-size: 1.5rem;
151
+ font-weight: 800;
152
+ -webkit-letter-spacing: -2px;
153
+ -moz-letter-spacing: -2px;
154
+ -ms-letter-spacing: -2px;
155
+ letter-spacing: -2px;
156
+ height: auto;
157
+ border-color: #E52630;
158
+ background-color: #E52630;
159
+ color: #FFFFFF;
160
+ }
161
+
129
162
  .c0 {
130
163
  background-color: #FEE3CC;
131
164
  position: relative;
@@ -297,39 +330,6 @@ it("renders correctly", () => {
297
330
  background-color: #961D35;
298
331
  }
299
332
 
300
- .c15 {
301
- display: block;
302
- }
303
-
304
- .c15 input {
305
- border: 2px solid #E1E2E3;
306
- font-size: 1.5rem;
307
- font-weight: 800;
308
- -webkit-letter-spacing: -2px;
309
- -moz-letter-spacing: -2px;
310
- -ms-letter-spacing: -2px;
311
- letter-spacing: -2px;
312
- height: auto;
313
- }
314
-
315
- .c20 {
316
- display: block;
317
- }
318
-
319
- .c20 input {
320
- border: 2px solid #E1E2E3;
321
- font-size: 1.5rem;
322
- font-weight: 800;
323
- -webkit-letter-spacing: -2px;
324
- -moz-letter-spacing: -2px;
325
- -ms-letter-spacing: -2px;
326
- letter-spacing: -2px;
327
- height: auto;
328
- border-color: #E52630;
329
- background-color: #E52630;
330
- color: #FFFFFF;
331
- }
332
-
333
333
  @media (min-width:740px) {
334
334
  .c19 {
335
335
  max-width: 290px;
package/src/index.js CHANGED
@@ -1,4 +1,3 @@
1
- /* eslint-disable */
2
1
  /* Theme */
3
2
  export { default as crTheme } from './theme/crTheme/theme';
4
3
  export { default as srTheme } from './theme/srTheme/theme';
@@ -48,7 +47,6 @@ export { default as SearchResult } from './components/Molecules/SearchResult/Sea
48
47
  export { default as SearchInput } from './components/Molecules/SearchInput/SearchInput';
49
48
  export { default as ShareButton } from './components/Molecules/ShareButton/ShareButton';
50
49
  export { default as VideoBanner } from './components/Molecules/VideoBanner/VideoBanner';
51
- export { default as HeaderEsuWithIcon } from './components/Molecules/HeaderEsuWithIcon/HeaderEsuWithIcon';
52
50
  export { default as Icon } from './components/Atoms/SocialIcons/Icon/Icon';
53
51
  export { default as Typeahead } from './components/Molecules/Typeahead/Typeahead';
54
52
  export { default as SchoolLookup } from './components/Molecules/SchoolLookup/SchoolLookup';
@@ -63,7 +61,15 @@ export { default as Lookup } from './components/Molecules/Lookup/Lookup';
63
61
  export { default as SimpleSchoolLookup } from './components/Molecules/SimpleSchoolLookup/SimpleSchoolLookup';
64
62
 
65
63
  /* Organisms */
66
- export { default as EmailSignUp } from './components/Organisms/EmailSignUp/EmailSignUp';
64
+ export {
65
+ EmailSignUp,
66
+ buildEsuValidationSchema,
67
+ ESU_FIELDS
68
+ } from './components/Organisms/EmailSignUp/_EmailSignUp';
67
69
  export { default as CookieBanner } from './components/Organisms/CookieBanner/CookieBanner';
68
70
  export { default as Membership } from './components/Organisms/Membership/Membership';
69
- export { MarketingPreferencesDS, setInitialValues, buildValidationSchema } from './components/Organisms/MarketingPreferencesDS/_MarketingPreferencesDS';
71
+ export {
72
+ MarketingPreferencesDS,
73
+ setInitialValues,
74
+ buildValidationSchema
75
+ } from './components/Organisms/MarketingPreferencesDS/_MarketingPreferencesDS';
@@ -1,69 +0,0 @@
1
- describe('Header Email Sign Up component', () => {
2
- before(() => {
3
- // go to Header Email Sign Up component
4
- cy.visit('/#headeresuwithicon');
5
- });
6
-
7
- describe('props and methods section', () => {
8
- beforeEach(() => {
9
- cy.get('[data-testid="HeaderEsuWithIcon-container"] button[name="rsg-usage"]')
10
- .contains('Props & methods')
11
- .as('propsBtn');
12
-
13
- cy.get('@propsBtn')
14
- .closest('[class^=rsg--tabs]')
15
- .as('container');
16
- });
17
-
18
- it('is present', () => {
19
- cy.get('@propsBtn').should('exist');
20
- });
21
-
22
- it('does not show table initially', () => {
23
- cy.get('@container')
24
- .find('table')
25
- .should('not.exist');
26
- });
27
-
28
- it('shows the table on button click', () => {
29
- cy.get('@propsBtn').click();
30
- cy.get('@container')
31
- .find('table')
32
- .should('contain', 'Prop name');
33
- });
34
- });
35
-
36
- describe('Header Email Sign Up section', () => {
37
- beforeEach(() => {
38
- cy.get('[data-testid="HeaderEsuWithIcon-example-1"]')
39
- .as('container')
40
- .find('[data-preview="HeaderEsuWithIcon"]')
41
- .as('preview');
42
-
43
- cy.get('@container')
44
- .find('button')
45
- .contains('View Code')
46
- .as('viewCodeBtn');
47
- });
48
-
49
- it('renders Header Email Sign Up preview', () => {
50
- cy.get('@container')
51
- .should('exist')
52
- });
53
-
54
- it('has view code button', () => {
55
- cy.get('@viewCodeBtn').should('exist');
56
- });
57
-
58
- it('shows code on click', () => {
59
- cy.get('@viewCodeBtn').click();
60
- cy.get('@container')
61
- .find('textarea')
62
- .should('exist');
63
- });
64
-
65
- it('closes code on click', () => {
66
- cy.get('@viewCodeBtn').click();
67
- });
68
- });
69
- });
@@ -1,136 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.default = void 0;
9
-
10
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
11
-
12
- var _react = _interopRequireWildcard(require("react"));
13
-
14
- var _Icon = _interopRequireDefault(require("../../Atoms/SocialIcons/Icon/Icon"));
15
-
16
- var _HeaderIcons = _interopRequireDefault(require("./assets/HeaderIcons"));
17
-
18
- var _HeaderEsuWithIcon = require("./HeaderEsuWithIcon.style");
19
-
20
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
21
-
22
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
23
-
24
- /* HeaderEsuWithIcon component */
25
- var HeaderEsuWithIcon = function HeaderEsuWithIcon(_ref) {
26
- var title = _ref.title,
27
- topCopy = _ref.topCopy,
28
- successCopy = _ref.successCopy,
29
- privacyCopy = _ref.privacyCopy,
30
- buttonColor = _ref.buttonColor,
31
- subscribe = _ref.subscribe,
32
- validate = _ref.validate,
33
- isSuccess = _ref.isSuccess,
34
- errorMsg = _ref.errorMsg,
35
- isESUOpenInitial = _ref.isESUOpen;
36
-
37
- // Pre-interaction flag
38
- var _useState = (0, _react.useState)(false),
39
- _useState2 = (0, _slicedToArray2.default)(_useState, 2),
40
- isClicked = _useState2[0],
41
- setisClicked = _useState2[1];
42
-
43
- var _useState3 = (0, _react.useState)(isESUOpenInitial),
44
- _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
45
- isESUOpen = _useState4[0],
46
- setIsESUOpen = _useState4[1];
47
-
48
- var thisRef = (0, _react.useRef)(null);
49
- (0, _react.useEffect)(function () {
50
- if (isClicked) {
51
- if (isESUOpen && !isSuccess) {
52
- thisRef.current.querySelector('input').focus();
53
- } else {
54
- thisRef.current.querySelector('a').focus();
55
- }
56
- }
57
- }, [isClicked, isESUOpen, isSuccess]);
58
- /* Allow our ESU modal stuff to happen */
59
-
60
- var handleESUOpen = function handleESUOpen(e) {
61
- e.preventDefault(); // Update flag
62
-
63
- setisClicked(true); // Toggle our 'opened' state
64
-
65
- setIsESUOpen(!isESUOpen);
66
- };
67
-
68
- var handleEscClose = function handleEscClose(e) {
69
- // Close the modal if this is the ESC key
70
- if (e.keyCode === 27) {
71
- setIsESUOpen(false);
72
- }
73
- };
74
- /* Break out ESU render into own function */
75
-
76
-
77
- var renderESU = function renderESU() {
78
- return /*#__PURE__*/_react.default.createElement(_HeaderEsuWithIcon.HeaderESU, {
79
- title: title,
80
- topCopy: topCopy,
81
- successCopy: successCopy,
82
- privacyCopy: privacyCopy,
83
- isSuccess: isSuccess,
84
- subscribe: subscribe,
85
- validate: validate,
86
- errorMsg: errorMsg,
87
- buttonColor: buttonColor,
88
- "aria-modal": "true"
89
- });
90
- };
91
- /* Break out Close button render into own function */
92
-
93
-
94
- var renderCloseButton = function renderCloseButton() {
95
- return /*#__PURE__*/_react.default.createElement(_HeaderEsuWithIcon.CloseButton, {
96
- onClick: function onClick(e) {
97
- return handleESUOpen(e);
98
- },
99
- icon: _HeaderIcons.default.close.icon,
100
- title: _HeaderIcons.default.close.title,
101
- brand: _HeaderIcons.default.close.title,
102
- target: "self",
103
- role: "button",
104
- href: "#",
105
- tabIndex: "0"
106
- });
107
- };
108
- /* Main render */
109
-
110
-
111
- return /*#__PURE__*/_react.default.createElement(_HeaderEsuWithIcon.IconWrapper, {
112
- onKeyDown: function onKeyDown(e) {
113
- return handleEscClose(e);
114
- },
115
- ref: thisRef,
116
- "data-test": "header-esu"
117
- }, /*#__PURE__*/_react.default.createElement(_Icon.default, {
118
- onClick: function onClick(e) {
119
- return handleESUOpen(e);
120
- },
121
- icon: _HeaderIcons.default.email.icon,
122
- title: _HeaderIcons.default.email.title,
123
- brand: _HeaderIcons.default.email.title,
124
- target: "self",
125
- role: "button",
126
- href: "#",
127
- tabIndex: "0"
128
- }), isESUOpen ? /*#__PURE__*/_react.default.createElement(_HeaderEsuWithIcon.EsuWrapper, null, renderESU(), renderCloseButton()) : null);
129
- };
130
-
131
- HeaderEsuWithIcon.defaultProps = {
132
- isESUOpen: false,
133
- buttonColor: 'red'
134
- };
135
- var _default = HeaderEsuWithIcon;
136
- exports.default = _default;
@@ -1,47 +0,0 @@
1
- # Header Email Sign Up
2
-
3
- ```js
4
- import RichText from '../../Atoms/RichText/RichText';
5
-
6
- const title = 'Stay in the know';
7
- const topCopy = (
8
- <RichText
9
- markup={`<p>Get regular email updates and info on what we're up to!</p>`}
10
- />
11
- );
12
- const privacyCopy = (
13
- <RichText
14
- markup={`<p>Our Privacy Policy describes how we handle and protect your information.<br><br>If you are under 18, please make sure you have your parents’ permission before providing us with any personal details.</p>`}
15
- />
16
- );
17
- const successCopy = (
18
- <RichText
19
- markup={`<p>Thanks! Your first email will be with you shortly</p>`}
20
- />
21
- );
22
-
23
- const [success, setSuccess] = React.useState(false);
24
- const [error, setError] = React.useState('');
25
-
26
- const validate = ({ email }) => {
27
- let isValid = false;
28
- if (email.includes('@')) {
29
- isValid = true;
30
- setError('');
31
- } else {
32
- setError('invalid email!');
33
- }
34
- return isValid;
35
- };
36
-
37
- <HeaderEsuWithIcon
38
- title={title}
39
- topCopy={topCopy}
40
- successCopy={successCopy}
41
- isSuccess={success}
42
- privacyCopy={privacyCopy}
43
- errorMsg={error}
44
- subscribe={() => setSuccess(!success)}
45
- validate={validate}
46
- />;
47
- ```
@@ -1,52 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.HeaderESU = exports.CloseButton = exports.EsuWrapper = exports.IconWrapper = void 0;
9
-
10
- var _styledComponents = _interopRequireDefault(require("styled-components"));
11
-
12
- var _Icon = _interopRequireDefault(require("../../Atoms/SocialIcons/Icon/Icon"));
13
-
14
- var _spacing = _interopRequireDefault(require("../../../theme/shared/spacing"));
15
-
16
- var _EmailSignUp = _interopRequireDefault(require("../../Organisms/EmailSignUp/EmailSignUp"));
17
-
18
- var IconWrapper = _styledComponents.default.div.withConfig({
19
- displayName: "HeaderEsuWithIconstyle__IconWrapper",
20
- componentId: "sc-1a84kwt-0"
21
- })(["width:35px;height:35px;display:inline-block;"]);
22
-
23
- exports.IconWrapper = IconWrapper;
24
-
25
- var EsuWrapper = _styledComponents.default.div.withConfig({
26
- displayName: "HeaderEsuWithIconstyle__EsuWrapper",
27
- componentId: "sc-1a84kwt-1"
28
- })(["position:fixed;width:100%;height:100%;background-color:rgba(255,255,255,0.5);z-index:100;top:0;left:0;overflow-y:auto;display:flex;justify-content:center;align-items:flex-start;div[aria-modal='true']{padding:", ";}"], (0, _spacing.default)('l'));
29
-
30
- exports.EsuWrapper = EsuWrapper;
31
- var CloseButton = (0, _styledComponents.default)(_Icon.default).withConfig({
32
- displayName: "HeaderEsuWithIconstyle__CloseButton",
33
- componentId: "sc-1a84kwt-2"
34
- })(["position:absolute;top:0;right:0;width:40px;height:40px;margin-left:0;@media ", "{margin:", " 0 0;right:25%;}"], function (_ref) {
35
- var theme = _ref.theme;
36
- return theme.breakpoint('small');
37
- }, (0, _spacing.default)('xl'));
38
- exports.CloseButton = CloseButton;
39
- var HeaderESU = (0, _styledComponents.default)(_EmailSignUp.default).withConfig({
40
- displayName: "HeaderEsuWithIconstyle__HeaderESU",
41
- componentId: "sc-1a84kwt-3"
42
- })(["width:100%;input{font-size:", ";}@media ", "{margin-top:", ";width:50%;input{font-size:", ";}}"], function (_ref2) {
43
- var theme = _ref2.theme;
44
- return theme.fontSize('s');
45
- }, function (_ref3) {
46
- var theme = _ref3.theme;
47
- return theme.breakpoint('small');
48
- }, (0, _spacing.default)('xl'), function (_ref4) {
49
- var theme = _ref4.theme;
50
- return theme.fontSize('m');
51
- });
52
- exports.HeaderESU = HeaderESU;
@@ -1,99 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- var _react = _interopRequireDefault(require("react"));
6
-
7
- require("jest-styled-components");
8
-
9
- var _shallowWithTheme = _interopRequireDefault(require("../../../hoc/shallowWithTheme"));
10
-
11
- var _HeaderEsuWithIcon = _interopRequireDefault(require("./HeaderEsuWithIcon"));
12
-
13
- var _RichText = _interopRequireDefault(require("../../Atoms/RichText/RichText"));
14
-
15
- var title = 'Stay in the know!';
16
-
17
- var topCopy = /*#__PURE__*/_react.default.createElement(_RichText.default, {
18
- markup: "<p>Get regular email updates and info on what we're up to!</p>"
19
- });
20
-
21
- var privacyCopy = /*#__PURE__*/_react.default.createElement(_RichText.default, {
22
- markup: '<p>Our <a class="link link--white inline" href="/privacy-notice">Privacy Policy</a> describes how we handle and protect your information.<br><br>If you are under 18, please make sure you have your parents’ permission before providing us with any personal details.</p>'
23
- });
24
-
25
- var successCopy = /*#__PURE__*/_react.default.createElement(_RichText.default, {
26
- markup: "<p>Thanks! Your first email will be with you shortly</p>"
27
- });
28
-
29
- it('renders correctly with modal closed', function () {
30
- var tree = (0, _shallowWithTheme.default)( /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_HeaderEsuWithIcon.default, {
31
- title: title,
32
- topCopy: topCopy,
33
- privacyCopy: privacyCopy,
34
- successCopy: successCopy,
35
- isSuccess: false,
36
- errorMsg: "",
37
- subscribe: function subscribe() {
38
- return 'Done';
39
- },
40
- validate: function validate() {
41
- return true;
42
- }
43
- }))).toJSON();
44
- expect(tree).toMatchSnapshot();
45
- });
46
- it('renders correctly with modal open', function () {
47
- var tree = (0, _shallowWithTheme.default)( /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_HeaderEsuWithIcon.default, {
48
- title: title,
49
- topCopy: topCopy,
50
- privacyCopy: privacyCopy,
51
- successCopy: successCopy,
52
- isESUOpen: true,
53
- isSuccess: false,
54
- errorMsg: "",
55
- subscribe: function subscribe() {
56
- return 'Done';
57
- },
58
- validate: function validate() {
59
- return true;
60
- }
61
- }))).toJSON();
62
- expect(tree).toMatchSnapshot();
63
- });
64
- it('renders correctly with error message', function () {
65
- var tree = (0, _shallowWithTheme.default)( /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_HeaderEsuWithIcon.default, {
66
- title: title,
67
- topCopy: topCopy,
68
- privacyCopy: privacyCopy,
69
- successCopy: successCopy,
70
- isESUOpen: true,
71
- isSuccess: false,
72
- errorMsg: "invalid email",
73
- subscribe: function subscribe() {
74
- return 'Done';
75
- },
76
- validate: function validate() {
77
- return true;
78
- }
79
- }))).toJSON();
80
- expect(tree).toMatchSnapshot();
81
- });
82
- it('renders correctly with success message', function () {
83
- var tree = (0, _shallowWithTheme.default)( /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_HeaderEsuWithIcon.default, {
84
- title: title,
85
- topCopy: topCopy,
86
- privacyCopy: privacyCopy,
87
- successCopy: successCopy,
88
- isESUOpen: true,
89
- isSuccess: true,
90
- errorMsg: "",
91
- subscribe: function subscribe() {
92
- return 'Done';
93
- },
94
- validate: function validate() {
95
- return true;
96
- }
97
- }))).toJSON();
98
- expect(tree).toMatchSnapshot();
99
- });