@comicrelief/component-library 7.19.0 → 7.19.2

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 (82) 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/VideoBanner/VideoBanner.js +14 -2
  41. package/dist/components/Molecules/VideoBanner/VideoBanner.md +1 -1
  42. package/dist/components/Organisms/Footer/__snapshots__/Footer.test.js.snap +1 -1
  43. package/dist/components/Organisms/Footer/data/footerCopy.js +1 -1
  44. package/package.json +1 -1
  45. package/src/components/Molecules/VideoBanner/VideoBanner.js +9 -3
  46. package/src/components/Molecules/VideoBanner/VideoBanner.md +1 -1
  47. package/src/components/Organisms/Footer/__snapshots__/Footer.test.js.snap +1 -1
  48. package/src/components/Organisms/Footer/data/footerCopy.js +1 -1
  49. package/cypress/integration/components/Atoms/Checkbox.spec.js +0 -69
  50. package/cypress/integration/components/Atoms/Link.spec.js +0 -217
  51. package/cypress/integration/components/Atoms/Logo.spec.js +0 -155
  52. package/cypress/integration/components/Atoms/Pagination.spec.js +0 -217
  53. package/cypress/integration/components/Atoms/Picture.spec.js +0 -147
  54. package/cypress/integration/components/Atoms/RadioButton.spec.js +0 -81
  55. package/cypress/integration/components/Atoms/RichText.spec.js +0 -75
  56. package/cypress/integration/components/Atoms/Select.spec.js +0 -89
  57. package/cypress/integration/components/Atoms/Text.spec.js +0 -180
  58. package/cypress/integration/components/Atoms/TextArea.spec.js +0 -91
  59. package/cypress/integration/components/Molecules/ArticleTeaser.spec.js +0 -111
  60. package/cypress/integration/components/Molecules/Box.spec.js +0 -112
  61. package/cypress/integration/components/Molecules/Card.spec.js +0 -113
  62. package/cypress/integration/components/Molecules/DoubleCopy.spec.js +0 -81
  63. package/cypress/integration/components/Molecules/HeroBanner.spec.js +0 -71
  64. package/cypress/integration/components/Molecules/InfoBanner.spec.js +0 -71
  65. package/cypress/integration/components/Molecules/PartnerLink.spec.js +0 -70
  66. package/cypress/integration/components/Molecules/Promo.spec.js +0 -76
  67. package/cypress/integration/components/Molecules/SearchInput.spec.js +0 -74
  68. package/cypress/integration/components/Molecules/SearchResult.spec.js +0 -202
  69. package/cypress/integration/components/Molecules/ShareButton.spec.js +0 -78
  70. package/cypress/integration/components/Molecules/SingleMessage.spec.js +0 -537
  71. package/cypress/integration/components/Molecules/VideoBanner.spec.js +0 -70
  72. package/cypress/integration/components/Organisms/CookieBanner.spec.js +0 -82
  73. package/cypress/integration/components/Organisms/Footer.spec.js +0 -166
  74. /package/cypress/integration/components/{Atoms/Input.spec.js → atoms/input.spec.js} +0 -0
  75. /package/cypress/integration/components/{Atoms/SocialIcons.spec.js → atoms/socialIcons.spec.js} +0 -0
  76. /package/cypress/integration/components/{Molecules/CardDs.spec.js → molecules/cardDs.spec.js} +0 -0
  77. /package/cypress/integration/components/{Molecules/Typeahead.spec.js → molecules/typeahead.spec.js} +0 -0
  78. /package/cypress/integration/components/{Organisms/Donate.spec.js → organisms/donate.spec.js} +0 -0
  79. /package/cypress/integration/components/{Organisms/EmailSignUp.spec.js → organisms/emailSignUp.spec.js} +0 -0
  80. /package/cypress/integration/components/{Organisms/Header.spec.js → organisms/header.spec.js} +0 -0
  81. /package/cypress/integration/components/{Atoms/MarketingPreferencesDSForm.spec.js → organisms/marketingPreferencesDSForm.spec.js} +0 -0
  82. /package/cypress/integration/components/{Organisms/Membership.spec.js → organisms/membership.spec.js} +0 -0
@@ -0,0 +1,248 @@
1
+ describe('Single Message Ds component', () => {
2
+ before(() => {
3
+ // go to single message Ds component
4
+ cy.visit('/#singlemessageds');
5
+ });
6
+
7
+ describe('props and methods section', () => {
8
+ beforeEach(() => {
9
+ cy.get('[data-testid="SingleMessageDs-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('SingleMessageDs-example-1: Image align left and CTA are clickable', () => {
37
+ beforeEach(() => {
38
+ cy.get('[data-testid="SingleMessageDs-example-1"]')
39
+ .as('container')
40
+ .find('[data-preview="SingleMessageDs"]')
41
+ .as('preview');
42
+
43
+ cy.get('@container')
44
+ .find('button')
45
+ .contains('View Code')
46
+ .as('viewCodeBtn');
47
+ });
48
+
49
+ it('renders image align left and CTA are clickable', () => {
50
+ cy.get('@container')
51
+ .find('img')
52
+ .should('exist');
53
+ cy.get('@container')
54
+ .find('h4')
55
+ .contains('Heading Line 1 Heading Line 2');
56
+ cy.get('@container')
57
+ .find('p')
58
+ .should('exist');
59
+ cy.get('@container')
60
+ .find('a')
61
+ .contains('Check out')
62
+ .should('exist');
63
+ });
64
+
65
+ it('has view code button', () => {
66
+ cy.get('@viewCodeBtn').should('exist');
67
+ });
68
+
69
+ it('shows code on click', () => {
70
+ cy.get('@viewCodeBtn').click();
71
+ cy.get('@container')
72
+ .find('textarea')
73
+ .should('exist');
74
+ });
75
+
76
+ it('closes code on click', () => {
77
+ cy.get('@viewCodeBtn').click();
78
+ });
79
+ });
80
+
81
+ describe('SingleMessageDs-example-3: Image align right and CTA are clickable', () => {
82
+ beforeEach(() => {
83
+ cy.get('[data-testid="SingleMessageDs-example-3"]')
84
+ .as('container')
85
+ .find('[data-preview="SingleMessageDs"]')
86
+ .as('preview');
87
+
88
+ cy.get('@container')
89
+ .find('button')
90
+ .contains('View Code')
91
+ .as('viewCodeBtn');
92
+ });
93
+
94
+ it('renders image align right and CTA are clickable', () => {
95
+ cy.get('@container')
96
+ .find('img')
97
+ .should('exist');
98
+ cy.get('@container')
99
+ .find('h4')
100
+ .contains('Heading Line 1 Heading Line 2');
101
+ cy.get('@container')
102
+ .find('p')
103
+ .should('exist');
104
+ cy.get('@container')
105
+ .find('a')
106
+ .contains('Check out');
107
+ });
108
+
109
+ it('has view code button', () => {
110
+ cy.get('@viewCodeBtn').should('exist');
111
+ });
112
+
113
+ it('shows code on click', () => {
114
+ cy.get('@viewCodeBtn').click();
115
+ cy.get('@container')
116
+ .find('textarea')
117
+ .should('exist');
118
+ });
119
+
120
+ it('closes code on click', () => {
121
+ cy.get('@viewCodeBtn').click();
122
+ });
123
+ });
124
+
125
+ describe('SingleMessageDs-example-5: SingleMessageDs-example-5', () => {
126
+ beforeEach(() => {
127
+ cy.get('[data-testid="SingleMessageDs-example-5"]')
128
+ .as('container')
129
+ .find('[data-preview="SingleMessageDs"]')
130
+ .as('preview');
131
+
132
+ cy.get('@container')
133
+ .find('button')
134
+ .contains('View Code')
135
+ .as('viewCodeBtn');
136
+ });
137
+
138
+ it('renders SingleMessageDs-example-5', () => {
139
+ cy.get('@container')
140
+ .find('img')
141
+ .should('exist');
142
+ cy.get('@container')
143
+ .find('h4')
144
+ .contains('Heading Line 1 Heading Line 2')
145
+ .should('exist');
146
+ cy.get('@container')
147
+ .find('p')
148
+ .should('exist');
149
+ });
150
+
151
+ it('has view code button', () => {
152
+ cy.get('@viewCodeBtn').should('exist');
153
+ });
154
+
155
+ it('shows code on click', () => {
156
+ cy.get('@viewCodeBtn').click();
157
+ cy.get('@container')
158
+ .find('textarea')
159
+ .should('exist');
160
+ });
161
+
162
+ it('closes code on click', () => {
163
+ cy.get('@viewCodeBtn').click();
164
+ });
165
+ });
166
+
167
+ describe('SingleMessageDs-example-7: Using the linkIcon prop', () => {
168
+ beforeEach(() => {
169
+ cy.get('[data-testid="SingleMessageDs-example-7"]')
170
+ .as('container')
171
+ .find('[data-preview="SingleMessageDs"]')
172
+ .as('preview');
173
+
174
+ cy.get('@container')
175
+ .find('button')
176
+ .contains('View Code')
177
+ .as('viewCodeBtn');
178
+ });
179
+
180
+ it('renders Using the linkIcon prop', () => {
181
+ cy.get('@container')
182
+ .find('img')
183
+ .should('exist');
184
+ cy.get('@container')
185
+ .find('h1')
186
+ .should('not.exist');
187
+ cy.get('@container')
188
+ .find('p')
189
+ .should('exist');
190
+ });
191
+
192
+ it('has view code button', () => {
193
+ cy.get('@viewCodeBtn').should('exist');
194
+ });
195
+
196
+ it('shows code on click', () => {
197
+ cy.get('@viewCodeBtn').click();
198
+ cy.get('@container')
199
+ .find('textarea')
200
+ .should('exist');
201
+ });
202
+
203
+ it('closes code on click', () => {
204
+ cy.get('@viewCodeBtn').click();
205
+ });
206
+ });
207
+
208
+ describe('SingleMessageDs-example-9: Video with no CTA', () => {
209
+ beforeEach(() => {
210
+ cy.get('[data-testid="SingleMessageDs-example-9"]')
211
+ .as('container')
212
+ .find('[data-preview="SingleMessageDs"]')
213
+ .as('preview');
214
+
215
+ cy.get('@container')
216
+ .find('button')
217
+ .contains('View Code')
218
+ .as('viewCodeBtn');
219
+ });
220
+
221
+ it('renders single message vertical height preview', () => {
222
+ cy.get('@container')
223
+ .find('img')
224
+ .should('exist');
225
+ cy.get('@container')
226
+ .find('h1')
227
+ .should('not.exist');
228
+ cy.get('@container')
229
+ .find('p')
230
+ .should('exist');
231
+ });
232
+
233
+ it('has view code button', () => {
234
+ cy.get('@viewCodeBtn').should('exist');
235
+ });
236
+
237
+ it('shows code on click', () => {
238
+ cy.get('@viewCodeBtn').click();
239
+ cy.get('@container')
240
+ .find('textarea')
241
+ .should('exist');
242
+ });
243
+
244
+ it('closes code on click', () => {
245
+ cy.get('@viewCodeBtn').click();
246
+ });
247
+ });
248
+ });
@@ -0,0 +1,140 @@
1
+ describe('Video Banner component', () => {
2
+ before(() => {
3
+ // go to video banner component
4
+ cy.visit('/#videobanner');
5
+ });
6
+
7
+ describe('props and methods section', () => {
8
+ beforeEach(() => {
9
+ cy.get('[data-testid="VideoBanner-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('VideoBanner-example-1: Default Video Banner', () => {
37
+ beforeEach(() => {
38
+ cy.get('[data-testid="VideoBanner-example-1"]')
39
+ .as('container')
40
+ .find('[data-preview="VideoBanner"]')
41
+ .as('preview');
42
+
43
+ cy.get('@container')
44
+ .find('button')
45
+ .contains('View Code')
46
+ .as('viewCodeBtn');
47
+ });
48
+
49
+ it('renders video banner preview', () => {
50
+ cy.get('@container')
51
+ .find('video')
52
+ .should('exist');
53
+ });
54
+
55
+ it('has view code button', () => {
56
+ cy.get('@viewCodeBtn').should('exist');
57
+ });
58
+
59
+ it('shows code on click', () => {
60
+ cy.get('@viewCodeBtn').click();
61
+ cy.get('@container')
62
+ .find('textarea')
63
+ .should('exist');
64
+ });
65
+
66
+ it('closes code on click', () => {
67
+ cy.get('@viewCodeBtn').click();
68
+ });
69
+ });
70
+
71
+ describe('VideoBanner-example-3: Looping Video Banner With Controls', () => {
72
+ beforeEach(() => {
73
+ cy.get('[data-testid="VideoBanner-example-3"]')
74
+ .as('container')
75
+ .find('[data-preview="VideoBanner"]')
76
+ .as('preview');
77
+
78
+ cy.get('@container')
79
+ .find('button')
80
+ .contains('View Code')
81
+ .as('viewCodeBtn');
82
+ });
83
+
84
+ it('renders looping Video Banner With Controls preview', () => {
85
+ cy.get('@container')
86
+ .find('video')
87
+ .should('exist');
88
+ });
89
+
90
+ it('has view code button', () => {
91
+ cy.get('@viewCodeBtn').should('exist');
92
+ });
93
+
94
+ it('shows code on click', () => {
95
+ cy.get('@viewCodeBtn').click();
96
+ cy.get('@container')
97
+ .find('textarea')
98
+ .should('exist');
99
+ });
100
+
101
+ it('closes code on click', () => {
102
+ cy.get('@viewCodeBtn').click();
103
+ });
104
+ });
105
+
106
+ describe('VideoBanner-example-5: Non-autoplay Video Banner', () => {
107
+ beforeEach(() => {
108
+ cy.get('[data-testid="VideoBanner-example-5"]')
109
+ .as('container')
110
+ .find('[data-preview="VideoBanner"]')
111
+ .as('preview');
112
+
113
+ cy.get('@container')
114
+ .find('button')
115
+ .contains('View Code')
116
+ .as('viewCodeBtn');
117
+ });
118
+
119
+ it('renders Non-autoplay Video Banner preview', () => {
120
+ cy.get('@container')
121
+ .find('video')
122
+ .should('exist');
123
+ });
124
+
125
+ it('has view code button', () => {
126
+ cy.get('@viewCodeBtn').should('exist');
127
+ });
128
+
129
+ it('shows code on click', () => {
130
+ cy.get('@viewCodeBtn').click();
131
+ cy.get('@container')
132
+ .find('textarea')
133
+ .should('exist');
134
+ });
135
+
136
+ it('closes code on click', () => {
137
+ cy.get('@viewCodeBtn').click();
138
+ });
139
+ });
140
+ });
@@ -0,0 +1,82 @@
1
+ describe('Cookie Banner component', () => {
2
+ before(() => {
3
+ // go to cookie banner component
4
+ cy.visit('/#cookiebanner');
5
+ });
6
+
7
+ describe('props and methods section', () => {
8
+ beforeEach(() => {
9
+ cy.get('[data-testid="CookieBanner-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('Cookie Banner section', () => {
37
+ beforeEach(() => {
38
+ cy.get('[data-testid="CookieBanner-example-1"]')
39
+ .as('container')
40
+ .find('[data-preview="CookieBanner"]')
41
+ .as('preview');
42
+
43
+ cy.get('@container')
44
+ .find('button')
45
+ .contains('View Code')
46
+ .as('viewCodeBtn');
47
+ });
48
+
49
+ it('renders cookie banner preview', () => {
50
+ cy.get('@container')
51
+ .find('p')
52
+ .contains('Hello! Comic Relief uses cookies to help make this website better and improve our services. You can learn more about');
53
+ cy.get('@container')
54
+ .find('a')
55
+ .should('have.attr', 'href', 'https://www.comicrelief.com/cookies-policy')
56
+ .contains('our use of cookies');
57
+ cy.get('@container')
58
+ .find('p:nth-child(2) > a:nth-child(1)')
59
+ .contains('Accept')
60
+ .click();
61
+ cy.get('@container')
62
+ .find('p:nth-child(2) > a:nth-child(2)')
63
+ .should('exist')
64
+ .contains('here');
65
+ });
66
+
67
+ it('has view code button', () => {
68
+ cy.get('@viewCodeBtn').should('exist');
69
+ });
70
+
71
+ it('shows code on click', () => {
72
+ cy.get('@viewCodeBtn').click();
73
+ cy.get('@container')
74
+ .find('textarea')
75
+ .should('exist');
76
+ });
77
+
78
+ it('closes code on click', () => {
79
+ cy.get('@viewCodeBtn').click();
80
+ });
81
+ });
82
+ });
@@ -0,0 +1,166 @@
1
+ describe('Footer component', () => {
2
+ before(() => {
3
+ // go to footer component
4
+ cy.visit('/#footer');
5
+ });
6
+
7
+ describe('props and methods section', () => {
8
+ beforeEach(() => {
9
+ cy.get('[data-testid="Footer-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('Footer section', () => {
37
+ beforeEach(() => {
38
+ cy.get('[data-testid="Footer-example-1"]')
39
+ .as('container')
40
+ .find('[data-preview="Footer"]')
41
+ .as('preview');
42
+
43
+ cy.get('@container')
44
+ .find('button')
45
+ .contains('View Code')
46
+ .as('viewCodeBtn');
47
+ });
48
+
49
+ it('renders footer preview', () => {
50
+ //Hear from us
51
+ cy.get('@container')
52
+ .find('ul > li:nth-child(1) > span')
53
+ .contains('Hear from us');
54
+ cy.get('@container')
55
+ .find('ul > li:nth-child(1) > ul > li:nth-child(1) > a')
56
+ .should('have.attr', 'href', 'https://www.comicrelief.com/#')
57
+ .contains('Get the newsletter');
58
+ cy.get('@container')
59
+ .find('ul > li:nth-child(1) > ul > li:nth-child(2) > a')
60
+ .should('have.attr', 'href', 'https://www.comicrelief.com/update-your-preferences')
61
+ .contains('How we contact you');
62
+
63
+ //Get in touch
64
+ cy.get('@container')
65
+ .find('ul > li:nth-child(2) > span')
66
+ .contains('Get in touch');
67
+ cy.get('@container')
68
+ .find('ul > li:nth-child(2) > ul > li:nth-child(1) > a')
69
+ .should('have.attr', 'href', '/contact-us')
70
+ .contains('Contact us');
71
+ cy.get('@container')
72
+ .find('ul > li:nth-child(2) > ul > li:nth-child(2) > a')
73
+ .should('have.attr', 'href', 'https://giftaid.comicrelief.com/update')
74
+ .contains('Your Gift Aid');
75
+ cy.get('@container')
76
+ .find('ul > li:nth-child(2) > ul > li:nth-child(3) > a')
77
+ .should('have.attr', 'href', 'https://www.comicrelief.com/frequently-asked-questions')
78
+ .contains('FAQs');
79
+ cy.get('@container')
80
+ .find('ul > li:nth-child(2) > ul > li:nth-child(4) > a')
81
+ .should('have.attr', 'href', 'https://www.comicrelief.com/red-nose-days-frequently-asked-questions')
82
+ .contains('Red Nose Day 2019 FAQs');
83
+
84
+ //About us
85
+ cy.get('@container')
86
+ .find('ul > li:nth-child(3) > span')
87
+ .contains('About us');
88
+ cy.get('@container')
89
+ .find('ul > li:nth-child(3) > ul > li:nth-child(1) > a')
90
+ .should('have.attr', 'href', 'https://www.comicrelief.com/about-comic-relief')
91
+ .contains('Mission');
92
+ cy.get('@container')
93
+ .find('ul > li:nth-child(3) > ul > li:nth-child(2) > a')
94
+ .should('have.attr', 'href', 'https://www.comicrelief.com/about-comic-relief/history')
95
+ .contains('Our history');
96
+ cy.get('@container')
97
+ .find('ul > li:nth-child(3) > ul > li:nth-child(3) > a')
98
+ .should('have.attr', 'href', 'https://www.comicrelief.com/about-comic-relief/finances')
99
+ .contains('Finances');
100
+ cy.get('@container')
101
+ .find('ul > li:nth-child(3) > ul > li:nth-child(4) > a')
102
+ .should('have.attr', 'href', 'https://www.comicrelief.com/working-with-us')
103
+ .contains('Partners');
104
+ cy.get('@container')
105
+ .find('ul > li:nth-child(3) > ul > li:nth-child(5) > a')
106
+ .should('have.attr', 'href', 'https://www.comicrelief.com/about-comic-relief/meet-the-team')
107
+ .contains('Meet the team');
108
+ cy.get('@container')
109
+ .find('ul > li:nth-child(3) > ul > li:nth-child(6) > a')
110
+ .should('have.attr', 'href', 'https://www.sportrelief.com/')
111
+ .contains('Sport Relief');
112
+
113
+ //Careers
114
+ cy.get('@container')
115
+ .find('ul > li:nth-child(4) > span')
116
+ .contains('Careers');
117
+ cy.get('@container')
118
+ .find('ul > li:nth-child(4) > ul > li:nth-child(1) > a')
119
+ .should('have.attr', 'href', 'https://www.comicrelief.com/careers')
120
+ .contains('Working at Comic Relief');
121
+ cy.get('@container')
122
+ .find('ul > li:nth-child(4) > ul > li:nth-child(2) > a')
123
+ .should('have.attr', 'href', 'https://app.beapplied.com/org/comic-relief')
124
+ .contains('Open roles');
125
+
126
+ //News
127
+ cy.get('@container')
128
+ .find('ul > li:nth-child(5) > span')
129
+ .contains('News');
130
+ cy.get('@container')
131
+ .find('ul > li:nth-child(5) > ul > li:nth-child(1) > a')
132
+ .should('have.attr', 'href', 'https://www.comicrelief.com/news')
133
+ .contains('News');
134
+ cy.get('@container')
135
+ .find('ul > li:nth-child(5) > ul > li:nth-child(2) > a')
136
+ .should('have.attr', 'href', 'https://www.comicrelief.com/press-releases')
137
+ .contains('Press area');
138
+
139
+ //Legal
140
+ cy.get('@container')
141
+ .find('ul > li:nth-child(6) > span')
142
+ .contains('Legal');
143
+
144
+ //copyright
145
+ cy.get('@container')
146
+ .find('p')
147
+ .should('exist');
148
+
149
+ //logo
150
+ cy.get('@container')
151
+ .find('a[title="Go to Comic Relief homepage"]')
152
+ .should('exist');
153
+ });
154
+
155
+ it('has view code button', () => {
156
+ cy.get('@viewCodeBtn').should('exist');
157
+ });
158
+
159
+ it('shows code on click', () => {
160
+ cy.get('@viewCodeBtn').click();
161
+ cy.get('@container')
162
+ .find('textarea')
163
+ .should('exist');
164
+ });
165
+ });
166
+ });
@@ -7,6 +7,8 @@ Object.defineProperty(exports, "__esModule", {
7
7
  });
8
8
  exports.default = void 0;
9
9
 
10
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
11
+
10
12
  var _react = _interopRequireWildcard(require("react"));
11
13
 
12
14
  var _styledComponents = _interopRequireDefault(require("styled-components"));
@@ -32,6 +34,13 @@ var VideoBanner = function VideoBanner(_ref) {
32
34
  loop = _ref.loop,
33
35
  muted = _ref.muted,
34
36
  showPosterAfterPlaying = _ref.showPosterAfterPlaying;
37
+
38
+ // Use the prop as our default
39
+ var _useState = (0, _react.useState)(muted),
40
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
41
+ isMuted = _useState2[0],
42
+ setIsMuted = _useState2[1];
43
+
35
44
  var videoEl = (0, _react.useRef)(null);
36
45
 
37
46
  var triggerPlay = function triggerPlay() {
@@ -41,6 +50,9 @@ var VideoBanner = function VideoBanner(_ref) {
41
50
  (0, _react.useEffect)(function () {
42
51
  // Trigger onload autoplay based on prop:
43
52
  if (autoPlay) {
53
+ // As it's a Chrome requirement to mute any autoplay videos,
54
+ // update accordingly; see https://developer.chrome.com/blog/autoplay/
55
+ setIsMuted(true);
44
56
  triggerPlay();
45
57
  } // And attach event listener based on prop:
46
58
 
@@ -51,14 +63,14 @@ var VideoBanner = function VideoBanner(_ref) {
51
63
  videoEl.current.load();
52
64
  });
53
65
  }
54
- });
66
+ }, [autoPlay, loop, showPosterAfterPlaying]);
55
67
  return /*#__PURE__*/_react.default.createElement(Video, {
56
68
  poster: poster,
57
69
  src: video,
58
70
  ref: videoEl,
59
71
  controls: controls,
60
72
  loop: loop,
61
- muted: muted
73
+ muted: isMuted
62
74
  }, "Your browser does not support video.");
63
75
  };
64
76
 
@@ -12,7 +12,7 @@ import poster from '../../../styleguide/assets/VideoBannerPosterImage.png';
12
12
  const src =
13
13
  'https://www.comicrelief.com/sites/default/files/downloads/Creativists_Logo_Web_small_V2_0.mp4';
14
14
 
15
- <VideoBanner poster={poster} video={src} loop={true} controls={true} autoPlay={true}
15
+ <VideoBanner poster={poster} video={src} loop={true} controls={true} autoPlay={true} muted={false}
16
16
  />;
17
17
  ```
18
18