@comicrelief/component-library 7.20.0 → 7.22.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/cypress/{integration/components/atoms/button.spec.js → e2e/components/atoms/button.cy.js} +4 -15
- package/cypress/{integration/components/atoms/buttonWithStates.spec.js → e2e/components/atoms/buttonWithStates.cy.js} +5 -11
- package/cypress/{integration/components/atoms/checkbox.spec.js → e2e/components/atoms/checkbox.cy.js} +2 -0
- package/cypress/{integration/components/atoms/confetti.spec.js → e2e/components/atoms/confetti.cy.js} +2 -8
- package/cypress/{integration/components/atoms/errorText.spec.js → e2e/components/atoms/errorText.cy.js} +1 -7
- package/cypress/{integration/components/atoms/input.spec.js → e2e/components/atoms/input.cy.js} +4 -14
- package/cypress/{integration/components/atoms/label.spec.js → e2e/components/atoms/label.cy.js} +3 -14
- package/cypress/{integration/components/atoms/link.spec.js → e2e/components/atoms/link.cy.js} +4 -21
- package/cypress/{integration/components/atoms/logo.spec.js → e2e/components/atoms/logo.cy.js} +4 -21
- package/cypress/{integration/components/atoms/pagination.spec.js → e2e/components/atoms/pagination.cy.js} +5 -28
- package/cypress/{integration/components/atoms/picture.spec.js → e2e/components/atoms/picture.cy.js} +4 -21
- package/cypress/{integration/components/atoms/radioButton.spec.js → e2e/components/atoms/radioButton.cy.js} +2 -7
- package/cypress/{integration/components/atoms/richText.spec.js → e2e/components/atoms/richText.cy.js} +2 -7
- package/cypress/{integration/components/atoms/select.spec.js → e2e/components/atoms/select.cy.js} +2 -7
- package/cypress/{integration/components/atoms/socialIcons.spec.js → e2e/components/atoms/socialIcons.cy.js} +4 -21
- package/cypress/{integration/components/atoms/text.spec.js → e2e/components/atoms/text.cy.js} +3 -14
- package/cypress/{integration/components/atoms/textArea.spec.js → e2e/components/atoms/textArea.cy.js} +2 -4
- package/cypress/{integration/components/atoms/textInputWithDrop.spec.js → e2e/components/atoms/textInputWithDrop.cy.js} +2 -4
- package/cypress/{integration/components/molecules/accordion.spec.js → e2e/components/molecules/accordion.cy.js} +2 -7
- package/cypress/{integration/components/molecules/articleTeaser.spec.js → e2e/components/molecules/articleTeaser.cy.js} +2 -7
- package/cypress/{integration/components/molecules/banner.spec.js → e2e/components/molecules/banner.cy.js} +2 -7
- package/cypress/{integration/components/molecules/box.spec.js → e2e/components/molecules/box.cy.js} +3 -11
- package/cypress/{integration/components/molecules/card.spec.js → e2e/components/molecules/card.cy.js} +3 -11
- package/cypress/{integration/components/molecules/cardDs.spec.js → e2e/components/molecules/cardDs.cy.js} +5 -30
- package/cypress/{integration/components/molecules/chip.spec.js → e2e/components/molecules/chip.cy.js} +2 -4
- package/cypress/{integration/components/molecules/countdown.spec.js → e2e/components/molecules/countdown.cy.js} +2 -4
- package/cypress/{integration/components/molecules/descriptor.spec.js → e2e/components/molecules/descriptor.cy.js} +3 -8
- package/cypress/{integration/components/molecules/doubleCopy.spec.js → e2e/components/molecules/doubleCopy.cy.js} +2 -4
- package/cypress/{integration/components/molecules/heroBanner.spec.js → e2e/components/molecules/heroBanner.cy.js} +2 -4
- package/cypress/{integration/components/molecules/infoBanner.spec.js → e2e/components/molecules/infoBanner.cy.js} +2 -4
- package/cypress/{integration/components/molecules/partnerLink.spec.js → e2e/components/molecules/partnerLink.cy.js} +2 -4
- package/cypress/{integration/components/molecules/promo.spec.js → e2e/components/molecules/promo.cy.js} +2 -4
- package/cypress/{integration/components/molecules/schoolLookup.spec.js → e2e/components/molecules/schoolLookup.cy.js} +3 -4
- package/cypress/{integration/components/molecules/searchInput.spec.js → e2e/components/molecules/searchInput.cy.js} +2 -4
- package/cypress/{integration/components/molecules/searchResult.spec.js → e2e/components/molecules/searchResult.cy.js} +5 -16
- package/cypress/{integration/components/molecules/shareButton.spec.js → e2e/components/molecules/shareButton.cy.js} +2 -4
- package/cypress/{integration/components/molecules/simpleSchoolLookup.spec.js → e2e/components/molecules/simpleSchoolLookup.cy.js} +3 -4
- package/cypress/{integration/components/molecules/singleMessage.spec.js → e2e/components/molecules/singleMessage.cy.js} +14 -49
- package/cypress/{integration/components/molecules/singleMessageDs.spec.js → e2e/components/molecules/singleMessageDs.cy.js} +6 -20
- package/cypress/{integration/components/molecules/typeahead.spec.js → e2e/components/molecules/typeahead.cy.js} +3 -4
- package/cypress/{integration/components/molecules/videoBanner.spec.js → e2e/components/molecules/videoBanner.cy.js} +4 -12
- package/cypress/{integration/components/organisms/cookieBanner.spec.js → e2e/components/organisms/cookieBanner.cy.js} +2 -4
- package/cypress/{integration/components/organisms/donate.spec.js → e2e/components/organisms/donate.cy.js} +5 -16
- package/cypress/{integration/components/organisms/emailSignUp.spec.js → e2e/components/organisms/emailSignUp.cy.js} +1 -4
- package/cypress/{integration/components/organisms/footer.spec.js → e2e/components/organisms/footer.cy.js} +2 -0
- package/cypress/{integration/components/organisms/header.spec.js → e2e/components/organisms/header.cy.js} +3 -8
- package/cypress/{integration/components/organisms/marketingPreferencesDSForm.spec.js → e2e/components/organisms/marketingPreferencesDSForm.cy.js} +44 -56
- package/cypress/{integration/components/organisms/membership.spec.js → e2e/components/organisms/membership.cy.js} +3 -8
- package/cypress.config.js +15 -0
- package/dist/components/Atoms/Link/Link.js +5 -5
- package/dist/components/Molecules/Promo/Promo.js +87 -12
- package/dist/components/Molecules/Promo/Promo.md +266 -4
- package/dist/components/Molecules/Promo/Promo.style.js +24 -6
- package/dist/components/Molecules/Promo/Promo.test.js +2 -2
- package/dist/components/Molecules/Promo/_ProgressRing.js +57 -0
- package/dist/components/Molecules/Promo/_PromoVideo.js +116 -0
- package/dist/components/Molecules/Promo/_PromoVideoButton.js +31 -0
- package/dist/components/Molecules/Promo/_PromoVideoButton.style.js +110 -0
- package/dist/components/Molecules/Promo/assets/Pause--black.svg +3 -0
- package/dist/components/Molecules/Promo/assets/Pause--white.svg +3 -0
- package/dist/components/Molecules/Promo/assets/Play--black.svg +3 -0
- package/dist/components/Molecules/Promo/assets/Play--white.svg +3 -0
- package/dist/components/Organisms/Footer/Footer.js +1 -1
- package/dist/components/Organisms/Footer/Footer.md +2 -2
- package/dist/components/Organisms/Footer/__snapshots__/Footer.test.js.snap +2 -2
- package/dist/components/Organisms/Footer/data/data.js +2 -2
- package/dist/components/Organisms/Header/Nav/Nav.js +2 -2
- package/dist/components/Organisms/Header/data/data.js +2 -2
- package/dist/index.js +3 -3
- package/dist/styleguide/assets/mobileVideoPosterImage.png +0 -0
- package/dist/utils/{whiteListed.js → allowListed.js} +4 -4
- package/dist/utils/allowListed.test.js +12 -0
- package/docs/utils.md +4 -4
- package/package.json +2 -2
- package/src/components/Atoms/Link/Link.js +5 -5
- package/src/components/Molecules/Promo/Promo.js +89 -13
- package/src/components/Molecules/Promo/Promo.md +266 -4
- package/src/components/Molecules/Promo/Promo.style.js +23 -2
- package/src/components/Molecules/Promo/Promo.test.js +2 -2
- package/src/components/Molecules/Promo/_ProgressRing.js +43 -0
- package/src/components/Molecules/Promo/_PromoVideo.js +105 -0
- package/src/components/Molecules/Promo/_PromoVideoButton.js +26 -0
- package/src/components/Molecules/Promo/_PromoVideoButton.style.js +121 -0
- package/src/components/Molecules/Promo/assets/Pause--black.svg +3 -0
- package/src/components/Molecules/Promo/assets/Pause--white.svg +3 -0
- package/src/components/Molecules/Promo/assets/Play--black.svg +3 -0
- package/src/components/Molecules/Promo/assets/Play--white.svg +3 -0
- package/src/components/Organisms/Footer/Footer.js +2 -2
- package/src/components/Organisms/Footer/Footer.md +2 -2
- package/src/components/Organisms/Footer/__snapshots__/Footer.test.js.snap +2 -2
- package/src/components/Organisms/Footer/data/data.js +2 -2
- package/src/components/Organisms/Header/Nav/Nav.js +2 -2
- package/src/components/Organisms/Header/data/data.js +2 -2
- package/src/index.js +1 -1
- package/src/styleguide/assets/mobileVideoPosterImage.png +0 -0
- package/src/utils/{whiteListed.js → allowListed.js} +6 -5
- package/src/utils/allowListed.test.js +9 -0
- package/cypress.json +0 -6
- package/dist/utils/whiteListed.test.js +0 -12
- package/src/utils/whiteListed.test.js +0 -9
- /package/cypress/support/{index.js → e2e.js} +0 -0
|
@@ -6,6 +6,7 @@ describe('Footer component', () => {
|
|
|
6
6
|
|
|
7
7
|
describe('props and methods section', () => {
|
|
8
8
|
beforeEach(() => {
|
|
9
|
+
cy.visit('/#footer');
|
|
9
10
|
cy.get('[data-testid="Footer-container"] button[name="rsg-usage"]')
|
|
10
11
|
.contains('Props & methods')
|
|
11
12
|
.as('propsBtn');
|
|
@@ -35,6 +36,7 @@ describe('Footer component', () => {
|
|
|
35
36
|
|
|
36
37
|
describe('Footer section', () => {
|
|
37
38
|
beforeEach(() => {
|
|
39
|
+
cy.visit('/#footer');
|
|
38
40
|
cy.get('[data-testid="Footer-example-1"]')
|
|
39
41
|
.as('container')
|
|
40
42
|
.find('[data-preview="Footer"]')
|
|
@@ -6,6 +6,7 @@ describe('Header component', () => {
|
|
|
6
6
|
|
|
7
7
|
describe('props and methods section', () => {
|
|
8
8
|
beforeEach(() => {
|
|
9
|
+
cy.visit('/#header');
|
|
9
10
|
cy.get('[data-testid="Header-container"] button[name="rsg-usage"]')
|
|
10
11
|
.contains('Props & methods')
|
|
11
12
|
.as('propsBtn');
|
|
@@ -35,6 +36,7 @@ describe('Header component', () => {
|
|
|
35
36
|
|
|
36
37
|
describe('CR Header section', () => {
|
|
37
38
|
beforeEach(() => {
|
|
39
|
+
cy.visit('/#header');
|
|
38
40
|
cy.get('[data-testid="Header-example-1"]')
|
|
39
41
|
.as('container')
|
|
40
42
|
.find('[data-preview="Header"]')
|
|
@@ -76,14 +78,11 @@ describe('Header component', () => {
|
|
|
76
78
|
.find('textarea')
|
|
77
79
|
.should('exist');
|
|
78
80
|
});
|
|
79
|
-
|
|
80
|
-
it('closes code on click', () => {
|
|
81
|
-
cy.get('@viewCodeBtn').click();
|
|
82
|
-
});
|
|
83
81
|
});
|
|
84
82
|
|
|
85
83
|
describe('CR Header with search and ESU section', () => {
|
|
86
84
|
beforeEach(() => {
|
|
85
|
+
cy.visit('/#header');
|
|
87
86
|
cy.get('[data-testid="Header-example-7"]')
|
|
88
87
|
.as('container')
|
|
89
88
|
.find('[data-preview="Header"]')
|
|
@@ -135,9 +134,5 @@ describe('Header component', () => {
|
|
|
135
134
|
.find('textarea')
|
|
136
135
|
.should('exist');
|
|
137
136
|
});
|
|
138
|
-
|
|
139
|
-
it('closes code on click', () => {
|
|
140
|
-
cy.get('@viewCodeBtn').click();
|
|
141
|
-
});
|
|
142
137
|
});
|
|
143
138
|
});
|
|
@@ -4,6 +4,7 @@ describe('MarketingPreferencesDSForm component', () => {
|
|
|
4
4
|
});
|
|
5
5
|
|
|
6
6
|
beforeEach(() => {
|
|
7
|
+
cy.visit('/#!/MarketingPreferencesDSForm/1');
|
|
7
8
|
cy.window().then(win => {
|
|
8
9
|
cy.spy(win.console, 'log').as('consoleLog');
|
|
9
10
|
});
|
|
@@ -95,21 +96,21 @@ describe('MarketingPreferencesDSForm component', () => {
|
|
|
95
96
|
cy.get('@default')
|
|
96
97
|
.find('#mp_permissionEmail-yes').click();
|
|
97
98
|
cy.get('@default')
|
|
98
|
-
.find('
|
|
99
|
+
.find('#mp_email')
|
|
99
100
|
.type('@an-invalid@email.com');
|
|
100
101
|
|
|
101
102
|
// Fill SMS field with an invalid value
|
|
102
103
|
cy.get('@default')
|
|
103
104
|
.find('#mp_permissionSMS-yes').click();
|
|
104
105
|
cy.get('@default')
|
|
105
|
-
.find('
|
|
106
|
+
.find('#mp_mobile')
|
|
106
107
|
.type('07777');
|
|
107
108
|
|
|
108
109
|
// Fill Phone field with an invalid value
|
|
109
110
|
cy.get('@default')
|
|
110
111
|
.find('#mp_permissionPhone-yes').click();
|
|
111
112
|
cy.get('@default')
|
|
112
|
-
.find('
|
|
113
|
+
.find('#mp_phone')
|
|
113
114
|
.type('0208');
|
|
114
115
|
|
|
115
116
|
// Fill Post fields with invalid values
|
|
@@ -117,11 +118,11 @@ describe('MarketingPreferencesDSForm component', () => {
|
|
|
117
118
|
.find('#mp_permissionPost-yes').click();
|
|
118
119
|
// Address 1
|
|
119
120
|
cy.get('@default')
|
|
120
|
-
.find('
|
|
121
|
+
.find('#mp_address1')
|
|
121
122
|
.type('@');
|
|
122
123
|
// Address 2
|
|
123
124
|
cy.get('@default')
|
|
124
|
-
.find('
|
|
125
|
+
.find('#mp_address2')
|
|
125
126
|
.type('@');
|
|
126
127
|
// Address 3
|
|
127
128
|
cy.get('@default')
|
|
@@ -188,50 +189,21 @@ describe('MarketingPreferencesDSForm component', () => {
|
|
|
188
189
|
});
|
|
189
190
|
|
|
190
191
|
it('check Default example with empty values', () => {
|
|
191
|
-
//
|
|
192
|
-
cy.get('@default')
|
|
193
|
-
.find('#mp_email')
|
|
194
|
-
.clear();
|
|
195
|
-
|
|
196
|
-
// Clear SMS field
|
|
197
|
-
cy.get('@default')
|
|
198
|
-
.find('#mp_mobile')
|
|
199
|
-
.clear();
|
|
200
|
-
|
|
201
|
-
// Clear Phone field
|
|
202
|
-
cy.get('@default')
|
|
203
|
-
.find(' #mp_phone')
|
|
204
|
-
.clear();
|
|
205
|
-
|
|
206
|
-
// Clear Post fields
|
|
207
|
-
// Address 1
|
|
208
|
-
cy.get('@default')
|
|
209
|
-
.find(' #mp_address1')
|
|
210
|
-
.clear();
|
|
211
|
-
// Address 2
|
|
192
|
+
// Show email field
|
|
212
193
|
cy.get('@default')
|
|
213
|
-
.find('
|
|
214
|
-
.clear();
|
|
215
|
-
|
|
216
|
-
// Address 3
|
|
217
|
-
cy.get('@default')
|
|
218
|
-
.find('#mp_address3')
|
|
219
|
-
.clear();
|
|
194
|
+
.find('#mp_permissionEmail-yes').click();
|
|
220
195
|
|
|
221
|
-
//
|
|
196
|
+
// Show SMS field
|
|
222
197
|
cy.get('@default')
|
|
223
|
-
.find('#
|
|
224
|
-
.clear();
|
|
198
|
+
.find('#mp_permissionSMS-yes').click();
|
|
225
199
|
|
|
226
|
-
//
|
|
200
|
+
// Show Phone field
|
|
227
201
|
cy.get('@default')
|
|
228
|
-
.find('#
|
|
229
|
-
.clear();
|
|
202
|
+
.find('#mp_permissionPhone-yes').click();
|
|
230
203
|
|
|
231
|
-
//
|
|
204
|
+
// Show Post fields
|
|
232
205
|
cy.get('@default')
|
|
233
|
-
.find('#
|
|
234
|
-
.clear();
|
|
206
|
+
.find('#mp_permissionPost-yes').click();
|
|
235
207
|
|
|
236
208
|
// Submit
|
|
237
209
|
cy.get('@default-submit').click();
|
|
@@ -293,27 +265,35 @@ describe('MarketingPreferencesDSForm component', () => {
|
|
|
293
265
|
it('Check Default example with valid values', () => {
|
|
294
266
|
// Fill email field with an valid value
|
|
295
267
|
cy.get('@default')
|
|
296
|
-
|
|
268
|
+
.find('#mp_permissionEmail-yes').click();
|
|
269
|
+
cy.get('@default')
|
|
270
|
+
.find('#mp_email')
|
|
297
271
|
.type('a-valid@email.com');
|
|
298
272
|
|
|
299
273
|
// Fill SMS field with a valid value
|
|
300
274
|
cy.get('@default')
|
|
301
|
-
|
|
275
|
+
.find('#mp_permissionSMS-yes').click();
|
|
276
|
+
cy.get('@default')
|
|
277
|
+
.find('#mp_mobile')
|
|
302
278
|
.type('07777 123123');
|
|
303
279
|
|
|
304
280
|
// Fill Phone field with a valid value
|
|
305
281
|
cy.get('@default')
|
|
306
|
-
|
|
282
|
+
.find('#mp_permissionPhone-yes').click();
|
|
283
|
+
cy.get('@default')
|
|
284
|
+
.find('#mp_phone')
|
|
307
285
|
.type('020 7820 2000');
|
|
308
286
|
|
|
309
287
|
// Fill Post fields with valid values
|
|
310
288
|
// Address 1
|
|
311
289
|
cy.get('@default')
|
|
312
|
-
.find('
|
|
290
|
+
.find('#mp_permissionPost-yes').click();
|
|
291
|
+
cy.get('@default')
|
|
292
|
+
.find('#mp_address1')
|
|
313
293
|
.type('10 King Road');
|
|
314
294
|
// Address 2
|
|
315
295
|
cy.get('@default')
|
|
316
|
-
.find('
|
|
296
|
+
.find('#mp_address2')
|
|
317
297
|
.type('Some Area');
|
|
318
298
|
// Address 3
|
|
319
299
|
cy.get('@default')
|
|
@@ -385,7 +365,7 @@ describe('MarketingPreferencesDSForm component', () => {
|
|
|
385
365
|
cy.get('@customised')
|
|
386
366
|
.find('#mp_permissionPhone-yes').click();
|
|
387
367
|
cy.get('@customised')
|
|
388
|
-
.find('
|
|
368
|
+
.find('#mp_phone')
|
|
389
369
|
.type('0208');
|
|
390
370
|
|
|
391
371
|
// Fill Post fields with invalid values
|
|
@@ -393,11 +373,11 @@ describe('MarketingPreferencesDSForm component', () => {
|
|
|
393
373
|
.find('#mp_permissionPost-yes').click();
|
|
394
374
|
// Address 1
|
|
395
375
|
cy.get('@customised')
|
|
396
|
-
.find('
|
|
376
|
+
.find('#mp_address1')
|
|
397
377
|
.type('@');
|
|
398
378
|
// Address 2
|
|
399
379
|
cy.get('@customised')
|
|
400
|
-
.find('
|
|
380
|
+
.find('#mp_address2')
|
|
401
381
|
.type('@');
|
|
402
382
|
// Address 3
|
|
403
383
|
cy.get('@customised')
|
|
@@ -454,17 +434,21 @@ describe('MarketingPreferencesDSForm component', () => {
|
|
|
454
434
|
it('check Customised example with empty values', () => {
|
|
455
435
|
// Clear Phone field
|
|
456
436
|
cy.get('@customised')
|
|
457
|
-
.find('
|
|
437
|
+
.find('#mp_permissionPhone-yes').click();
|
|
438
|
+
cy.get('@customised')
|
|
439
|
+
.find('#mp_phone')
|
|
458
440
|
.clear();
|
|
459
441
|
|
|
460
442
|
// Clear Post fields
|
|
461
443
|
// Address 1
|
|
462
444
|
cy.get('@customised')
|
|
463
|
-
.find('
|
|
445
|
+
.find('#mp_permissionPost-yes').click();
|
|
446
|
+
cy.get('@customised')
|
|
447
|
+
.find('#mp_address1')
|
|
464
448
|
.clear();
|
|
465
449
|
// Address 2
|
|
466
450
|
cy.get('@customised')
|
|
467
|
-
.find('
|
|
451
|
+
.find('#mp_address2')
|
|
468
452
|
.clear();
|
|
469
453
|
|
|
470
454
|
// Address 3
|
|
@@ -535,17 +519,21 @@ describe('MarketingPreferencesDSForm component', () => {
|
|
|
535
519
|
it('Check Customised example with valid values', () => {
|
|
536
520
|
// Fill Phone field with a valid value
|
|
537
521
|
cy.get('@customised')
|
|
538
|
-
.find('
|
|
522
|
+
.find('#mp_permissionPhone-yes').click();
|
|
523
|
+
cy.get('@customised')
|
|
524
|
+
.find('#mp_phone')
|
|
539
525
|
.type('020 7820 2000');
|
|
540
526
|
|
|
541
527
|
// Fill Post fields with valid values
|
|
542
528
|
// Address 1
|
|
543
529
|
cy.get('@customised')
|
|
544
|
-
.find('
|
|
530
|
+
.find('#mp_permissionPost-yes').click();
|
|
531
|
+
cy.get('@customised')
|
|
532
|
+
.find('#mp_address1')
|
|
545
533
|
.type('10 King Road');
|
|
546
534
|
// Address 2
|
|
547
535
|
cy.get('@customised')
|
|
548
|
-
.find('
|
|
536
|
+
.find('#mp_address2')
|
|
549
537
|
.type('Some Area');
|
|
550
538
|
// Address 3
|
|
551
539
|
cy.get('@customised')
|
|
@@ -6,6 +6,7 @@ describe('Membership component', () => {
|
|
|
6
6
|
|
|
7
7
|
describe('props and methods section', () => {
|
|
8
8
|
beforeEach(() => {
|
|
9
|
+
cy.visit('/#membership');
|
|
9
10
|
cy.get('[data-testid="Membership-container"] button[name="rsg-usage"]')
|
|
10
11
|
.contains('Props & methods')
|
|
11
12
|
.as('propsBtn');
|
|
@@ -35,6 +36,7 @@ describe('Membership component', () => {
|
|
|
35
36
|
|
|
36
37
|
describe('Membership form align right section', () => {
|
|
37
38
|
beforeEach(() => {
|
|
39
|
+
cy.visit('/#membership');
|
|
38
40
|
cy.get('[data-testid="Membership-example-1"]')
|
|
39
41
|
.as('container')
|
|
40
42
|
.find('[data-preview="Membership"]')
|
|
@@ -73,14 +75,11 @@ describe('Membership component', () => {
|
|
|
73
75
|
.find('textarea')
|
|
74
76
|
.should('exist');
|
|
75
77
|
});
|
|
76
|
-
|
|
77
|
-
it('closes code on click', () => {
|
|
78
|
-
cy.get('@viewCodeBtn').click();
|
|
79
|
-
});
|
|
80
78
|
});
|
|
81
79
|
|
|
82
80
|
describe('Membership form align left section', () => {
|
|
83
81
|
beforeEach(() => {
|
|
82
|
+
cy.visit('/#membership');
|
|
84
83
|
cy.get('[data-testid="Membership-example-3"]')
|
|
85
84
|
.as('container')
|
|
86
85
|
.find('[data-preview="Membership"]')
|
|
@@ -119,9 +118,5 @@ describe('Membership component', () => {
|
|
|
119
118
|
.find('textarea')
|
|
120
119
|
.should('exist');
|
|
121
120
|
});
|
|
122
|
-
|
|
123
|
-
it('closes code on click', () => {
|
|
124
|
-
cy.get('@viewCodeBtn').click();
|
|
125
|
-
});
|
|
126
121
|
});
|
|
127
122
|
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const { defineConfig } = require('cypress')
|
|
2
|
+
|
|
3
|
+
module.exports = defineConfig({
|
|
4
|
+
chromeWebSecurity: false,
|
|
5
|
+
viewportWidth: 1000,
|
|
6
|
+
viewportHeight: 1000,
|
|
7
|
+
e2e: {
|
|
8
|
+
// We've imported your old cypress plugins here.
|
|
9
|
+
// You may want to clean this up later by importing these.
|
|
10
|
+
setupNodeEvents(on, config) {
|
|
11
|
+
return require('./cypress/plugins/index.js')(on, config)
|
|
12
|
+
},
|
|
13
|
+
baseUrl: 'http://localhost:6060',
|
|
14
|
+
},
|
|
15
|
+
})
|
|
@@ -15,7 +15,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
15
15
|
|
|
16
16
|
var _Link = _interopRequireWildcard(require("./Link.style"));
|
|
17
17
|
|
|
18
|
-
var
|
|
18
|
+
var _allowListed = _interopRequireDefault(require("../../../utils/allowListed"));
|
|
19
19
|
|
|
20
20
|
var _internalLinkHelper = require("../../../utils/internalLinkHelper");
|
|
21
21
|
|
|
@@ -45,7 +45,7 @@ var Link = function Link(_ref) {
|
|
|
45
45
|
setDocumentHost = _useState2[1];
|
|
46
46
|
/**
|
|
47
47
|
* If we haven't specifically set the target via props, check if
|
|
48
|
-
* this is an internal link OR on our
|
|
48
|
+
* this is an internal link OR on our allowList before making it a '_self' link
|
|
49
49
|
*/
|
|
50
50
|
|
|
51
51
|
|
|
@@ -54,7 +54,7 @@ var Link = function Link(_ref) {
|
|
|
54
54
|
var currentDomain = (0, _internalLinkHelper.getDomain)(documentHost);
|
|
55
55
|
var linkDomain = (0, _internalLinkHelper.getDomain)(href); // Additional check for applications that need more control
|
|
56
56
|
|
|
57
|
-
var
|
|
57
|
+
var isallowListOverridden = rest.overrideallowList === true;
|
|
58
58
|
/**
|
|
59
59
|
* If the link has no domain supplied (likely '/' or '#')
|
|
60
60
|
* OR has the same domain as the current page, don't open
|
|
@@ -62,8 +62,8 @@ var Link = function Link(_ref) {
|
|
|
62
62
|
*/
|
|
63
63
|
|
|
64
64
|
var isExternalLink = linkDomain !== '' && currentDomain !== linkDomain;
|
|
65
|
-
var
|
|
66
|
-
window = isExternalLink && (
|
|
65
|
+
var isallowListed = (0, _allowListed.default)(href);
|
|
66
|
+
window = isExternalLink && (isallowListOverridden || !isallowListed) ? '_blank' : '_self';
|
|
67
67
|
} else {
|
|
68
68
|
window = target === 'blank' ? '_blank' : '_self';
|
|
69
69
|
}
|
|
@@ -7,28 +7,85 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
|
|
11
|
+
|
|
12
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
13
|
+
|
|
14
|
+
var _PromoVideo = _interopRequireDefault(require("./_PromoVideo"));
|
|
15
|
+
|
|
16
|
+
var _breakpoint = require("../../../theme/shared/breakpoint");
|
|
11
17
|
|
|
12
18
|
var _Picture = _interopRequireDefault(require("../../Atoms/Picture/Picture"));
|
|
13
19
|
|
|
14
20
|
var _Promo = require("./Promo.style");
|
|
15
21
|
|
|
22
|
+
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); }
|
|
23
|
+
|
|
24
|
+
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; }
|
|
25
|
+
|
|
16
26
|
var Promo = function Promo(_ref) {
|
|
17
|
-
var
|
|
27
|
+
var copyLeft = _ref.copyLeft,
|
|
18
28
|
backgroundColor = _ref.backgroundColor,
|
|
19
29
|
imageLow = _ref.imageLow,
|
|
20
30
|
imageSet = _ref.imageSet,
|
|
21
31
|
image = _ref.image,
|
|
22
32
|
imageAltText = _ref.imageAltText,
|
|
23
33
|
children = _ref.children,
|
|
24
|
-
position = _ref.position
|
|
25
|
-
|
|
34
|
+
position = _ref.position,
|
|
35
|
+
autoPlay = _ref.autoPlay,
|
|
36
|
+
loop = _ref.loop,
|
|
37
|
+
poster = _ref.poster,
|
|
38
|
+
mobilePoster = _ref.mobilePoster,
|
|
39
|
+
showPosterAfterPlaying = _ref.showPosterAfterPlaying,
|
|
40
|
+
videoSrc = _ref.videoSrc,
|
|
41
|
+
mobileVideoSrc = _ref.mobileVideoSrc,
|
|
42
|
+
lightColouredVideo = _ref.lightColouredVideo;
|
|
43
|
+
|
|
44
|
+
// Store the appropriate prop in state, dependent on the breakpoint
|
|
45
|
+
var _useState = (0, _react.useState)(null),
|
|
46
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
47
|
+
thisVideoSrc = _useState2[0],
|
|
48
|
+
setThisVideoSrc = _useState2[1];
|
|
49
|
+
|
|
50
|
+
var _useState3 = (0, _react.useState)(null),
|
|
51
|
+
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
52
|
+
thisPoster = _useState4[0],
|
|
53
|
+
setThisPoster = _useState4[1]; // Let either field define this, just in case
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
var hasVideo = Boolean(videoSrc || mobileVideoSrc); // A 'video-y' Promo will override and ignore any 'non-Video' images;
|
|
57
|
+
// none of these fields are required so we have to handle them accordingly:
|
|
58
|
+
|
|
59
|
+
var hasImage = Boolean(imageSet && !hasVideo); // Runs on initial load:
|
|
60
|
+
|
|
61
|
+
(0, _react.useEffect)(function () {
|
|
62
|
+
if (hasVideo) {
|
|
63
|
+
// Checks size on load ONLY; don't want to mess about with listeners:
|
|
64
|
+
var isDesktop = window.innerWidth >= _breakpoint.sizes.nav; // 1024+ px
|
|
65
|
+
|
|
66
|
+
var currentPoster;
|
|
67
|
+
var currentSrc; // If we've got both desktop AND mobile videos, let the
|
|
68
|
+
// *current* screen width define which video src to use:
|
|
69
|
+
|
|
70
|
+
if (videoSrc && mobileVideoSrc) {
|
|
71
|
+
currentSrc = isDesktop ? videoSrc : mobileVideoSrc;
|
|
72
|
+
currentPoster = isDesktop ? poster : mobilePoster;
|
|
73
|
+
} else {
|
|
74
|
+
// Else, pick whatever we DO actually have:
|
|
75
|
+
currentSrc = videoSrc || mobileVideoSrc;
|
|
76
|
+
currentPoster = poster || mobilePoster;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
setThisVideoSrc(currentSrc);
|
|
80
|
+
setThisPoster(currentPoster);
|
|
81
|
+
}
|
|
82
|
+
}, [hasVideo, videoSrc, mobileVideoSrc, mobilePoster, poster]);
|
|
26
83
|
return /*#__PURE__*/_react.default.createElement(_Promo.Container, {
|
|
27
84
|
backgroundColor: backgroundColor,
|
|
28
85
|
position: position
|
|
29
|
-
},
|
|
30
|
-
imageRight:
|
|
31
|
-
}, /*#__PURE__*/_react.default.createElement(_Picture.default, {
|
|
86
|
+
}, /*#__PURE__*/_react.default.createElement(_Promo.Media, {
|
|
87
|
+
imageRight: copyLeft
|
|
88
|
+
}, hasImage && !hasVideo && /*#__PURE__*/_react.default.createElement(_Picture.default, {
|
|
32
89
|
alt: imageAltText,
|
|
33
90
|
imageLow: imageLow,
|
|
34
91
|
images: imageSet,
|
|
@@ -36,22 +93,40 @@ var Promo = function Promo(_ref) {
|
|
|
36
93
|
objectFit: "cover",
|
|
37
94
|
width: "100%",
|
|
38
95
|
height: "100%"
|
|
39
|
-
})
|
|
40
|
-
|
|
96
|
+
}), hasVideo && thisVideoSrc && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_PromoVideo.default, {
|
|
97
|
+
copyLeft: copyLeft,
|
|
98
|
+
lightColouredVideo: lightColouredVideo,
|
|
99
|
+
thisVideoSrc: thisVideoSrc,
|
|
100
|
+
thisPoster: thisPoster,
|
|
101
|
+
showPosterAfterPlaying: showPosterAfterPlaying,
|
|
102
|
+
autoPlay: autoPlay,
|
|
103
|
+
loop: loop
|
|
104
|
+
}))), /*#__PURE__*/_react.default.createElement(_Promo.Wrapper, {
|
|
105
|
+
copyLeft: copyLeft
|
|
41
106
|
}, /*#__PURE__*/_react.default.createElement(_Promo.Copy, {
|
|
42
|
-
position: position
|
|
107
|
+
position: position,
|
|
108
|
+
hasVideo: hasVideo,
|
|
109
|
+
lightColouredVideo: lightColouredVideo
|
|
43
110
|
}, children)));
|
|
44
111
|
};
|
|
45
112
|
|
|
46
113
|
Promo.defaultProps = {
|
|
47
114
|
backgroundColor: 'white',
|
|
48
|
-
|
|
115
|
+
copyLeft: false,
|
|
49
116
|
imageSet: null,
|
|
50
117
|
imageLow: null,
|
|
51
118
|
image: null,
|
|
52
119
|
imageAltText: '',
|
|
53
120
|
children: null,
|
|
54
|
-
position: 'none'
|
|
121
|
+
position: 'none',
|
|
122
|
+
autoPlay: true,
|
|
123
|
+
loop: true,
|
|
124
|
+
poster: null,
|
|
125
|
+
mobilePoster: null,
|
|
126
|
+
videoSrc: null,
|
|
127
|
+
mobileVideoSrc: null,
|
|
128
|
+
showPosterAfterPlaying: true,
|
|
129
|
+
lightColouredVideo: false
|
|
55
130
|
};
|
|
56
131
|
var _default = Promo;
|
|
57
132
|
exports.default = _default;
|