@comicrelief/component-library 7.19.1 → 7.20.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.
Files changed (80) hide show
  1. package/cypress/integration/components/atoms/button.spec.js +113 -0
  2. package/cypress/integration/components/atoms/buttonWithStates.spec.js +53 -0
  3. package/cypress/integration/components/atoms/checkbox.spec.js +68 -0
  4. package/cypress/integration/components/atoms/confetti.spec.js +52 -0
  5. package/cypress/integration/components/atoms/errorText.spec.js +51 -0
  6. package/cypress/integration/components/atoms/label.spec.js +104 -0
  7. package/cypress/integration/components/atoms/link.spec.js +207 -0
  8. package/cypress/integration/components/atoms/logo.spec.js +149 -0
  9. package/cypress/integration/components/atoms/pagination.spec.js +214 -0
  10. package/cypress/integration/components/atoms/picture.spec.js +147 -0
  11. package/cypress/integration/components/atoms/radioButton.spec.js +81 -0
  12. package/cypress/integration/components/atoms/richText.spec.js +75 -0
  13. package/cypress/integration/components/atoms/select.spec.js +89 -0
  14. package/cypress/integration/components/atoms/text.spec.js +180 -0
  15. package/cypress/integration/components/atoms/textArea.spec.js +91 -0
  16. package/cypress/integration/components/atoms/textInputWithDrop.spec.js +78 -0
  17. package/cypress/integration/components/molecules/accordion.spec.js +72 -0
  18. package/cypress/integration/components/molecules/articleTeaser.spec.js +110 -0
  19. package/cypress/integration/components/molecules/banner.spec.js +72 -0
  20. package/cypress/integration/components/molecules/box.spec.js +112 -0
  21. package/cypress/integration/components/molecules/card.spec.js +113 -0
  22. package/cypress/integration/components/molecules/chip.spec.js +70 -0
  23. package/cypress/integration/components/molecules/countdown.spec.js +73 -0
  24. package/cypress/integration/components/molecules/descriptor.spec.js +147 -0
  25. package/cypress/integration/components/molecules/doubleCopy.spec.js +81 -0
  26. package/cypress/integration/components/molecules/heroBanner.spec.js +71 -0
  27. package/cypress/integration/components/molecules/infoBanner.spec.js +71 -0
  28. package/cypress/integration/components/molecules/partnerLink.spec.js +70 -0
  29. package/cypress/integration/components/molecules/promo.spec.js +76 -0
  30. package/cypress/integration/components/{Molecules/SchoolLookup.spec.js → molecules/schoolLookup.spec.js} +6 -0
  31. package/cypress/integration/components/molecules/searchInput.spec.js +74 -0
  32. package/cypress/integration/components/molecules/searchResult.spec.js +202 -0
  33. package/cypress/integration/components/molecules/shareButton.spec.js +78 -0
  34. package/cypress/integration/components/molecules/simpleSchoolLookup.spec.js +84 -0
  35. package/cypress/integration/components/molecules/singleMessage.spec.js +537 -0
  36. package/cypress/integration/components/molecules/singleMessageDs.spec.js +248 -0
  37. package/cypress/integration/components/molecules/videoBanner.spec.js +140 -0
  38. package/cypress/integration/components/organisms/cookieBanner.spec.js +82 -0
  39. package/cypress/integration/components/organisms/footer.spec.js +166 -0
  40. package/dist/components/Molecules/SimpleSchoolLookup/SimpleSchoolLookup.js +6 -2
  41. package/dist/components/Organisms/Footer/__snapshots__/Footer.test.js.snap +1 -1
  42. package/dist/components/Organisms/Footer/data/footerCopy.js +1 -1
  43. package/package.json +1 -1
  44. package/src/components/Molecules/SimpleSchoolLookup/SimpleSchoolLookup.js +8 -3
  45. package/src/components/Organisms/Footer/__snapshots__/Footer.test.js.snap +1 -1
  46. package/src/components/Organisms/Footer/data/footerCopy.js +1 -1
  47. package/cypress/integration/components/Atoms/Checkbox.spec.js +0 -69
  48. package/cypress/integration/components/Atoms/Link.spec.js +0 -217
  49. package/cypress/integration/components/Atoms/Logo.spec.js +0 -155
  50. package/cypress/integration/components/Atoms/Pagination.spec.js +0 -217
  51. package/cypress/integration/components/Atoms/Picture.spec.js +0 -147
  52. package/cypress/integration/components/Atoms/RadioButton.spec.js +0 -81
  53. package/cypress/integration/components/Atoms/RichText.spec.js +0 -75
  54. package/cypress/integration/components/Atoms/Select.spec.js +0 -89
  55. package/cypress/integration/components/Atoms/Text.spec.js +0 -180
  56. package/cypress/integration/components/Atoms/TextArea.spec.js +0 -91
  57. package/cypress/integration/components/Molecules/ArticleTeaser.spec.js +0 -111
  58. package/cypress/integration/components/Molecules/Box.spec.js +0 -112
  59. package/cypress/integration/components/Molecules/Card.spec.js +0 -113
  60. package/cypress/integration/components/Molecules/DoubleCopy.spec.js +0 -81
  61. package/cypress/integration/components/Molecules/HeroBanner.spec.js +0 -71
  62. package/cypress/integration/components/Molecules/InfoBanner.spec.js +0 -71
  63. package/cypress/integration/components/Molecules/PartnerLink.spec.js +0 -70
  64. package/cypress/integration/components/Molecules/Promo.spec.js +0 -76
  65. package/cypress/integration/components/Molecules/SearchInput.spec.js +0 -74
  66. package/cypress/integration/components/Molecules/SearchResult.spec.js +0 -202
  67. package/cypress/integration/components/Molecules/ShareButton.spec.js +0 -78
  68. package/cypress/integration/components/Molecules/SingleMessage.spec.js +0 -537
  69. package/cypress/integration/components/Molecules/VideoBanner.spec.js +0 -70
  70. package/cypress/integration/components/Organisms/CookieBanner.spec.js +0 -82
  71. package/cypress/integration/components/Organisms/Footer.spec.js +0 -166
  72. /package/cypress/integration/components/{Atoms/Input.spec.js → atoms/input.spec.js} +0 -0
  73. /package/cypress/integration/components/{Atoms/SocialIcons.spec.js → atoms/socialIcons.spec.js} +0 -0
  74. /package/cypress/integration/components/{Molecules/CardDs.spec.js → molecules/cardDs.spec.js} +0 -0
  75. /package/cypress/integration/components/{Molecules/Typeahead.spec.js → molecules/typeahead.spec.js} +0 -0
  76. /package/cypress/integration/components/{Organisms/Donate.spec.js → organisms/donate.spec.js} +0 -0
  77. /package/cypress/integration/components/{Organisms/EmailSignUp.spec.js → organisms/emailSignUp.spec.js} +0 -0
  78. /package/cypress/integration/components/{Organisms/Header.spec.js → organisms/header.spec.js} +0 -0
  79. /package/cypress/integration/components/{Atoms/MarketingPreferencesDSForm.spec.js → organisms/marketingPreferencesDSForm.spec.js} +0 -0
  80. /package/cypress/integration/components/{Organisms/Membership.spec.js → organisms/membership.spec.js} +0 -0
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@comicrelief/component-library",
3
3
  "author": "Comic Relief Engineering Team",
4
- "version": "7.19.1",
4
+ "version": "7.20.0",
5
5
  "main": "dist/index.js",
6
6
  "license": "ISC",
7
7
  "jest": {
@@ -41,14 +41,14 @@ const schoolToString = school => `${school.name}, ${school.post_code}`;
41
41
  * @returns {JSX.Element}
42
42
  * @constructor
43
43
  */
44
- const SimpleSchoolLookup = ({ onSelect, ...rest }) => (
44
+ const SimpleSchoolLookup = ({ onSelect, noResultsMessage, ...rest }) => (
45
45
  <Lookup
46
46
  name="school_lookup"
47
47
  label="Enter the name or postcode of your organisation"
48
48
  placeholder="Enter name or postcode..."
49
49
  buttonText="Find school"
50
50
  dropdownInstruction="Please select an organisation from the list below"
51
- noResultsMessage="Sorry, could not find anything matching your search"
51
+ noResultsMessage={noResultsMessage}
52
52
  lookupHandler={schoolFetcher}
53
53
  mapOptionToString={schoolToString}
54
54
  onSelect={onSelect}
@@ -56,8 +56,13 @@ const SimpleSchoolLookup = ({ onSelect, ...rest }) => (
56
56
  />
57
57
  );
58
58
 
59
+ SimpleSchoolLookup.defaultProps = {
60
+ noResultsMessage: 'Sorry, we could not find anything matching your search; please use the manual entry option.'
61
+ };
62
+
59
63
  SimpleSchoolLookup.propTypes = {
60
- onSelect: PropTypes.func.isRequired
64
+ onSelect: PropTypes.func.isRequired,
65
+ noResultsMessage: PropTypes.string
61
66
  };
62
67
 
63
68
  export default SimpleSchoolLookup;
@@ -1247,7 +1247,7 @@ exports[`renders correctly 1`] = `
1247
1247
  color="grey"
1248
1248
  size="s"
1249
1249
  >
1250
- Comic Relief is the trading name of Charity Projects, a registered charity in England and Wales (326568) and Scotland (SC039730), which is a company limited by guarantee registered in England and Wales (01806414). Registered address: 1st Floor, 89 Albert Embankment, London, SE1 7TP.
1250
+ Comic Relief is the trading name of Charity Projects, a registered charity in England and Wales (326568) and Scotland (SC039730), which is a company limited by guarantee registered in England and Wales (01806414). Registered address: 6th Floor, The White Chapel Building, 10 Whitechapel High Street, London, E1 8QS.
1251
1251
  </p>
1252
1252
  </div>
1253
1253
  </div>
@@ -1,4 +1,4 @@
1
1
  export default {
2
2
  copy:
3
- 'Comic Relief is the trading name of Charity Projects, a registered charity in England and Wales (326568) and Scotland (SC039730), which is a company limited by guarantee registered in England and Wales (01806414). Registered address: 1st Floor, 89 Albert Embankment, London, SE1 7TP.'
3
+ 'Comic Relief is the trading name of Charity Projects, a registered charity in England and Wales (326568) and Scotland (SC039730), which is a company limited by guarantee registered in England and Wales (01806414). Registered address: 6th Floor, The White Chapel Building, 10 Whitechapel High Street, London, E1 8QS.'
4
4
  };
@@ -1,69 +0,0 @@
1
- describe('Checkbox component', () => {
2
- before(() => {
3
- // go to checkbox component
4
- cy.visit('/#checkbox');
5
- });
6
-
7
- describe('props and methods section', () => {
8
- beforeEach(() => {
9
- cy.get('[data-testid="Checkbox-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
-
37
- describe('Checkbox section', () => {
38
- beforeEach(() => {
39
- cy.get('[data-preview="Checkbox"]')
40
- .as('preview');
41
- });
42
-
43
- it('should click checkboxes', () => {
44
- cy.get('[data-preview="Checkbox"] p').contains('List of checkboxes');
45
- cy.get('[data-testid="Checkbox-example-1"] div > label:nth-child(2)')
46
- .contains('Tennis')
47
- .click();
48
- cy.get('[data-testid="Checkbox-example-1"] div > label:nth-child(3)')
49
- .contains('Basketball')
50
- .click();
51
- cy.get('[data-testid="Checkbox-example-1"] div > label:nth-child(4)')
52
- .contains('Cycling')
53
- .click();
54
- cy.get('[data-testid="Checkbox-example-1"] div > label:nth-child(5)')
55
- .contains('Football')
56
- .click();
57
- });
58
-
59
- it('has view code button', () => {
60
- cy.get('[data-testid="Checkbox-examples"] [name="rsg-code-editor"]').should('exist');
61
- });
62
-
63
- it('shows code on click', () => {
64
- cy.get('[data-testid="Checkbox-examples"] [name="rsg-code-editor"]').contains('View Code')
65
- .click();
66
- cy.get('[data-testid="Checkbox-examples"] div > textarea').should('be.visible');
67
- });
68
- });
69
- });
@@ -1,217 +0,0 @@
1
- describe('Link component', () => {
2
- before(() => {
3
- // go to link component
4
- cy.visit('/#link');
5
- });
6
-
7
- describe('props and methods section', () => {
8
- beforeEach(() => {
9
- cy.get('[data-testid="Link-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
-
37
- describe('Link standard preview section', () => {
38
-
39
- beforeEach(() => {
40
- cy.get('[data-testid="Link-example-0"]')
41
- .as('container')
42
- .find('[data-preview="Link"]')
43
- .as('preview');
44
-
45
- cy.get('@container')
46
- .find('button')
47
- .contains('View Code')
48
- .as('viewCodeBtn');
49
- });
50
-
51
- it('renders link standard section', () => {
52
- cy.get('[data-testid="Link-example-0"]')
53
- .should('exist');
54
-
55
- cy.get('[data-testid="Link-example-0"]')
56
- .first()
57
- .contains('Link standard')
58
- .should('exist');
59
- cy.get('[data-testid="Link-example-0"] div > div:nth-child(2) > a')
60
- .contains('Link standard icon')
61
- .should('exist');
62
- cy.get('[data-testid="Link-example-0"] div > div:nth-child(2) > a > span > svg')
63
- .should('exist');
64
- cy.get('[data-testid="Link-example-0"] div > div:nth-child(3) > a')
65
- .contains('Link standard white')
66
- .should('exist')
67
-
68
- });
69
-
70
- it('has view code button', () => {
71
- cy.get('@viewCodeBtn').should('exist');
72
- });
73
-
74
-
75
- it('shows code on click', () => {
76
- cy.get('@viewCodeBtn').click();
77
- cy.get('@container')
78
- .find('textarea')
79
- .should('exist');
80
- });
81
-
82
- it('closes code on click', () => {
83
- cy.get('@viewCodeBtn').click();
84
- cy.get('@container')
85
- .find('textarea')
86
- .should('not.exist');
87
- });
88
-
89
- });
90
-
91
- describe('Iconography section', () => {
92
-
93
- beforeEach(() => {
94
- cy.get('[data-testid="Link-example-2"]')
95
- .as('container')
96
- .find('[data-preview="Link"]')
97
- .as('preview');
98
-
99
- cy.get('@container')
100
- .find('button')
101
- .contains('View Code')
102
- .as('viewCodeBtn');
103
- });
104
-
105
- it('renders link Iconography section', () => {
106
- cy.get('[data-testid="Link-example-2"]')
107
- .should('exist');
108
-
109
- cy.get('[data-testid="Link-example-2"]')
110
- .first()
111
- .contains('Internal link')
112
- .should('exist');
113
- cy.get('[data-testid="Link-example-2"] div > div:nth-child(2) > a')
114
- .contains('External link')
115
- .should('exist');
116
- //check icon exist
117
- cy.get('[data-testid="Link-example-2"] div > div:nth-child(2) > a > span > svg')
118
- .should('exist');
119
- cy.get('[data-testid="Link-example-2"] div > div:nth-child(3) > a')
120
- .contains('Download link')
121
- .should('exist');
122
- //check icon exist
123
- cy.get('[data-testid="Link-example-2"] div > div:nth-child(3) > a > span > svg')
124
- .should('exist');
125
- cy.get('[data-testid="Link-example-2"] div > div:nth-child(4) > a')
126
- .contains('Favourite link')
127
- .should('exist');
128
- //check icon exist
129
- cy.get('[data-testid="Link-example-2"] div > div:nth-child(4) > a > span > svg')
130
- .should('exist');
131
-
132
- });
133
-
134
- it('has view code button', () => {
135
- cy.get('@viewCodeBtn').should('exist');
136
- });
137
-
138
-
139
- it('shows code on click', () => {
140
- cy.get('@viewCodeBtn').click();
141
- cy.get('@container')
142
- .find('textarea')
143
- .should('exist');
144
- });
145
-
146
- it('closes code on click', () => {
147
- cy.get('@viewCodeBtn').click();
148
- cy.get('@container')
149
- .find('textarea')
150
- .should('not.exist');
151
- });
152
-
153
- });
154
-
155
- describe('Link as button section', () => {
156
-
157
- beforeEach(() => {
158
- cy.get('[data-testid="Link-example-3"]')
159
- .as('container')
160
- .find('[data-preview="Link"]')
161
- .as('preview');
162
-
163
- cy.get('@container')
164
- .find('button')
165
- .contains('View Code')
166
- .as('viewCodeBtn');
167
- });
168
-
169
- it('renders link as buttons section', () => {
170
- cy.get('[data-testid="Link-example-3"]')
171
- .should('exist');
172
-
173
- //verify all button colors
174
- cy.get('[data-testid="Link-example-3"] div > div:nth-child(1) > a[color="black"]')
175
- .contains('Link as button')
176
- .should('exist');
177
- cy.get('[data-testid="Link-example-3"] div > div:nth-child(2) > a[color="red"]')
178
- .contains('Link as button')
179
- .and('exist');
180
- cy.get('[data-testid="Link-example-3"] div > div:nth-child(3) > a[color="yellow"]')
181
- .should('exist');
182
- cy.get('[data-testid="Link-example-3"] div > div:nth-child(4) > a[color="yellow_light"]')
183
- .contains('Link as button')
184
- .should('exist');
185
- cy.get('[data-testid="Link-example-3"] div > div:nth-child(5) > a[color="yellow_dark"]')
186
- .contains('Link as button')
187
- .should('exist');
188
- cy.get('[data-testid="Link-example-3"] div:nth-child(6) > div:nth-child(1) > a[color="grey"] ')
189
- .contains('Link as button')
190
- .should('exist');
191
- cy.get('[data-testid="Link-example-3"] div > div > div:nth-child(6) > a[color="transparent"]')
192
- .contains('Link as transparent button')
193
- .should('exist');
194
- cy.get('[data-testid="Link-example-3"] div:nth-child(3) > a[color="white"]')
195
- .contains('White button')
196
- .should('exist');
197
- });
198
-
199
- it('has view code button', () => {
200
- cy.get('@viewCodeBtn').should('exist');
201
- });
202
-
203
- it('shows code on click', () => {
204
- cy.get('@viewCodeBtn').click();
205
- cy.get('@container')
206
- .find('textarea')
207
- .should('exist');
208
- });
209
-
210
- it('closes code on click', () => {
211
- cy.get('@viewCodeBtn').click();
212
- cy.get('@container')
213
- .find('textarea')
214
- .should('not.exist');
215
- });
216
- });
217
- });
@@ -1,155 +0,0 @@
1
- describe('Logo component', () => {
2
- before(() => {
3
- // go to logo component
4
- cy.visit('/#logo');
5
- });
6
-
7
- describe('props and methods section', () => {
8
- beforeEach(() => {
9
- cy.get('[data-testid="Logo-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('CR logo section', () => {
37
- beforeEach(() => {
38
- cy.get('[data-testid="Logo-example-1"]')
39
- .as('container')
40
- .find('[data-preview="Logo"]')
41
- .as('preview');
42
-
43
- cy.get('@container')
44
- .find('button')
45
- .contains('View Code')
46
- .as('viewCodeBtn');
47
- });
48
-
49
- it('should check CR logo', () => {
50
- cy.get('[data-testid="Logo-examples"] h1[id="comic-relief-logo"]')
51
- .should('exist')
52
- .contains('Comic Relief Logo')
53
-
54
- });
55
-
56
- it('has view code button', () => {
57
- cy.get('@viewCodeBtn').should('exist');
58
- });
59
-
60
- it('shows code on click', () => {
61
- cy.get('@viewCodeBtn').click();
62
- cy.get('@container')
63
- .find('textarea')
64
- .should('exist');
65
- });
66
-
67
- it('closes code on click', () => {
68
- cy.get('@viewCodeBtn').click();
69
- cy.get('@container')
70
- .find('textarea')
71
- .should('not.exist');
72
- });
73
-
74
- });
75
-
76
- describe('SR logo section', () => {
77
- beforeEach(() => {
78
- cy.get('[data-testid="Logo-example-3"]')
79
- .as('container')
80
- .find('[data-preview="Logo"]')
81
- .as('preview');
82
-
83
- cy.get('@container')
84
- .find('button')
85
- .contains('View Code')
86
- .as('viewCodeBtn');
87
- });
88
-
89
- it('should check SR logo', () => {
90
- cy.get('[data-testid="Logo-examples"] h1[id="sport-relief-logo"]')
91
- .should('exist')
92
- .contains('Sport Relief Logo')
93
-
94
- });
95
-
96
- it('has view code button', () => {
97
- cy.get('@viewCodeBtn').should('exist');
98
- });
99
-
100
- it('shows code on click', () => {
101
- cy.get('@viewCodeBtn').click();
102
- cy.get('@container')
103
- .find('textarea')
104
- .should('exist');
105
- });
106
-
107
- it('closes code on click', () => {
108
- cy.get('@viewCodeBtn').click();
109
- cy.get('@container')
110
- .find('textarea')
111
- .should('not.exist');
112
- });
113
-
114
- });
115
-
116
- describe('SR game on logo section', () => {
117
- beforeEach(() => {
118
- cy.get('[data-testid="Logo-example-5"]')
119
- .as('container')
120
- .find('[data-preview="Logo"]')
121
- .as('preview');
122
-
123
- cy.get('@container')
124
- .find('button')
125
- .contains('View Code')
126
- .as('viewCodeBtn');
127
- });
128
-
129
- it('should check SR game on logo', () => {
130
- cy.get('[data-testid="Logo-examples"] h1[id="sport-relief-game-on-logo"]')
131
- .should('exist')
132
- .contains('Sport Relief Game On Logo');
133
- });
134
-
135
- it('has view code button', () => {
136
- cy.get('@viewCodeBtn').should('exist');
137
- });
138
-
139
- it('shows code on click', () => {
140
- cy.get('@viewCodeBtn').click();
141
- cy.get('@container')
142
- .find('textarea')
143
- .should('exist');
144
- });
145
-
146
- it('closes code on click', () => {
147
- cy.get('@viewCodeBtn').click();
148
- cy.get('@container')
149
- .find('textarea')
150
- .should('not.exist');
151
- });
152
-
153
- });
154
-
155
- });