@comicrelief/component-library 7.24.1 → 7.25.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/.github/workflows/main.yml +22 -24
- package/dist/components/Atoms/Button/Button.js +21 -15
- package/dist/components/Atoms/Button/Button.test.js +3 -3
- package/dist/components/Atoms/ButtonWithStates/ButtonWithStates.js +19 -22
- package/dist/components/Atoms/Checkbox/Checkbox.js +42 -26
- package/dist/components/Atoms/Checkbox/Checkbox.test.js +3 -3
- package/dist/components/Atoms/Confetti/Confetti.js +20 -23
- package/dist/components/Atoms/Confetti/_TriggerConfetti.js +4 -11
- package/dist/components/Atoms/ErrorText/ErrorText.js +15 -11
- package/dist/components/Atoms/ErrorText/ErrorText.test.js +3 -3
- package/dist/components/Atoms/Icons/Arrow.js +16 -15
- package/dist/components/Atoms/Icons/AtSign.js +9 -9
- package/dist/components/Atoms/Icons/Chevron.js +16 -15
- package/dist/components/Atoms/Icons/Curve.js +16 -18
- package/dist/components/Atoms/Icons/Download.js +8 -8
- package/dist/components/Atoms/Icons/External.js +8 -8
- package/dist/components/Atoms/Icons/Favourite.js +8 -8
- package/dist/components/Atoms/Icons/Internal.js +8 -8
- package/dist/components/Atoms/Icons/index.js +8 -8
- package/dist/components/Atoms/Input/Input.js +38 -33
- package/dist/components/Atoms/Input/input.test.js +3 -3
- package/dist/components/Atoms/Label/Label.js +28 -23
- package/dist/components/Atoms/Link/Link.js +24 -29
- package/dist/components/Atoms/Link/Link.style.js +51 -40
- package/dist/components/Atoms/Link/Link.test.js +9 -9
- package/dist/components/Atoms/Logo/Logo.js +16 -18
- package/dist/components/Atoms/Logo/Logo.test.js +3 -3
- package/dist/components/Atoms/Pagination/Item/Item.js +7 -7
- package/dist/components/Atoms/Pagination/Item/Item.style.js +35 -28
- package/dist/components/Atoms/Pagination/List/List.js +21 -19
- package/dist/components/Atoms/Pagination/Pagination.js +41 -49
- package/dist/components/Atoms/Pagination/Pagination.test.js +54 -108
- package/dist/components/Atoms/Pagination/Utils/PaginationCalculator.js +15 -15
- package/dist/components/Atoms/Picture/Picture.js +34 -44
- package/dist/components/Atoms/Picture/Picture.test.js +5 -5
- package/dist/components/Atoms/RadioButton/RadioButton.js +35 -23
- package/dist/components/Atoms/RadioButton/RadioButton.test.js +3 -3
- package/dist/components/Atoms/RichText/RichText.js +9 -11
- package/dist/components/Atoms/RichText/RichText.test.js +4 -4
- package/dist/components/Atoms/Select/Select.js +56 -49
- package/dist/components/Atoms/Select/Select.test.js +3 -3
- package/dist/components/Atoms/SocialIcons/Icon/Icon.js +13 -13
- package/dist/components/Atoms/SocialIcons/SocialIcons.js +25 -23
- package/dist/components/Atoms/SocialIcons/SocialIcons.test.js +7 -7
- package/dist/components/Atoms/SocialIcons/Utils/Icons.js +1 -1
- package/dist/components/Atoms/SocialIcons/Utils/Links.js +19 -20
- package/dist/components/Atoms/Text/Text.js +62 -41
- package/dist/components/Atoms/Text/Text.test.js +11 -11
- package/dist/components/Atoms/TextArea/TextArea.js +18 -17
- package/dist/components/Atoms/TextArea/TextArea.test.js +3 -3
- package/dist/components/Atoms/TextInputWithDropdown/TextInputWithDropdown.js +69 -86
- package/dist/components/Atoms/TextInputWithDropdown/TextInputWithDropdown.style.js +23 -15
- package/dist/components/Atoms/TextInputWithDropdown/TextInputWithDropdown.test.js +15 -19
- package/dist/components/Molecules/Accordion/Accordion.js +35 -32
- package/dist/components/Molecules/Accordion/Accordion.test.js +3 -3
- package/dist/components/Molecules/ArticleTeaser/ArticleTeaser.js +81 -52
- package/dist/components/Molecules/ArticleTeaser/ArticleTeaser.test.js +5 -5
- package/dist/components/Molecules/Banner/Banner.js +21 -13
- package/dist/components/Molecules/Banner/Banner.test.js +3 -3
- package/dist/components/Molecules/Box/Box.js +33 -27
- package/dist/components/Molecules/Box/Box.test.js +5 -5
- package/dist/components/Molecules/Card/Card.js +22 -22
- package/dist/components/Molecules/Card/Card.test.js +5 -5
- package/dist/components/Molecules/CardDs/CardDs.js +80 -55
- package/dist/components/Molecules/CardDs/CardDs.test.js +3 -3
- package/dist/components/Molecules/Chip/Chip.js +8 -6
- package/dist/components/Molecules/Chip/Chip.style.js +48 -28
- package/dist/components/Molecules/Chip/Chip.test.js +4 -6
- package/dist/components/Molecules/Countdown/Countdown.js +28 -36
- package/dist/components/Molecules/Countdown/Countdown.style.js +3 -3
- package/dist/components/Molecules/Descriptor/Descriptor.js +32 -26
- package/dist/components/Molecules/Descriptor/Descriptor.test.js +5 -5
- package/dist/components/Molecules/DoubleCopy/DoubleCopy.js +6 -4
- package/dist/components/Molecules/DoubleCopy/DoubleCopy.style.js +7 -5
- package/dist/components/Molecules/DoubleCopy/DoubleCopy.test.js +4 -4
- package/dist/components/Molecules/HeroBanner/HeroBanner.js +13 -17
- package/dist/components/Molecules/InfoBanner/InfoBanner.js +22 -18
- package/dist/components/Molecules/InfoBanner/InfoBanner.test.js +10 -10
- package/dist/components/Molecules/Logos/Logos.js +26 -14
- package/dist/components/Molecules/Logos/Logos.md +5 -0
- package/dist/components/Molecules/Lookup/Lookup.js +49 -84
- package/dist/components/Molecules/PartnerLink/PartnerLink.js +10 -11
- package/dist/components/Molecules/PartnerLink/PartnerLink.style.js +15 -9
- package/dist/components/Molecules/PartnerLink/PartnerLink.test.js +3 -3
- package/dist/components/Molecules/Promo/Promo.js +30 -36
- package/dist/components/Molecules/Promo/Promo.style.js +44 -31
- package/dist/components/Molecules/Promo/Promo.test.js +6 -6
- package/dist/components/Molecules/Promo/_ProgressRing.js +13 -19
- package/dist/components/Molecules/Promo/_PromoVideo.js +25 -34
- package/dist/components/Molecules/Promo/_PromoVideoButton.js +7 -7
- package/dist/components/Molecules/Promo/_PromoVideoButton.style.js +68 -41
- package/dist/components/Molecules/SchoolLookup/SchoolLookup.js +29 -52
- package/dist/components/Molecules/SchoolLookup/SchoolLookup.test.js +4 -4
- package/dist/components/Molecules/SearchInput/SearchInput.js +8 -8
- package/dist/components/Molecules/SearchInput/SearchInput.style.js +22 -14
- package/dist/components/Molecules/SearchInput/SearchInput.test.js +4 -4
- package/dist/components/Molecules/SearchResult/SearchResult.js +43 -29
- package/dist/components/Molecules/SearchResult/SearchResult.test.js +9 -9
- package/dist/components/Molecules/ShareButton/ShareButton.js +22 -26
- package/dist/components/Molecules/ShareButton/ShareButton.style.js +5 -5
- package/dist/components/Molecules/ShareButton/ShareButton.test.js +3 -3
- package/dist/components/Molecules/ShareButton/assets/ShareIcons.js +2 -2
- package/dist/components/Molecules/SimpleSchoolLookup/SimpleSchoolLookup.js +28 -55
- package/dist/components/Molecules/SingleMessage/SingleMessage.js +99 -123
- package/dist/components/Molecules/SingleMessage/SingleMessage.style.js +132 -81
- package/dist/components/Molecules/SingleMessage/SingleMessage.test.js +13 -13
- package/dist/components/Molecules/SingleMessageDS/SingleMessageDs.js +31 -40
- package/dist/components/Molecules/SingleMessageDS/SingleMessageDs.style.js +85 -49
- package/dist/components/Molecules/SingleMessageDS/SingleMessageDs.test.js +3 -3
- package/dist/components/Molecules/Typeahead/Typeahead.js +47 -84
- package/dist/components/Molecules/Typeahead/Typeahead.test.js +12 -35
- package/dist/components/Molecules/VideoBanner/VideoBanner.js +20 -25
- package/dist/components/Molecules/VideoBanner/VideoBanner.test.js +4 -4
- package/dist/components/Organisms/CookieBanner/CookieBanner.js +7 -5
- package/dist/components/Organisms/CookieBanner/CookieBanner.style.js +21 -13
- package/dist/components/Organisms/CookieBanner/CookieBanner.test.js +5 -5
- package/dist/components/Organisms/Donate/Donate.js +42 -39
- package/dist/components/Organisms/Donate/Donate.md +85 -0
- package/dist/components/Organisms/Donate/Donate.style.js +85 -53
- package/dist/components/Organisms/Donate/Donate.test.js +10 -10
- package/dist/components/Organisms/Donate/Form/Form.js +64 -80
- package/dist/components/Organisms/Donate/Form/PopUpComponent.js +25 -30
- package/dist/components/Organisms/Donate/GivingSelector/GivingSelector.js +11 -13
- package/dist/components/Organisms/Donate/GivingSelector/GivingSelector.style.js +38 -22
- package/dist/components/Organisms/Donate/MoneyBuy/MoneyBuy.js +47 -30
- package/dist/components/Organisms/EmailSignUp/EmailSignUp.style.js +63 -37
- package/dist/components/Organisms/EmailSignUp/EmailSignUp.test.js +12 -12
- package/dist/components/Organisms/EmailSignUp/EmailSignUpForm.js +23 -43
- package/dist/components/Organisms/EmailSignUp/_EmailSignUp.js +25 -21
- package/dist/components/Organisms/EmailSignUp/_EmailSignUpConfig.js +10 -9
- package/dist/components/Organisms/EmailSignUp/_TextInput.js +20 -18
- package/dist/components/Organisms/Footer/Footer.js +10 -10
- package/dist/components/Organisms/Footer/Footer.style.js +27 -21
- package/dist/components/Organisms/Footer/Footer.test.js +3 -3
- package/dist/components/Organisms/Footer/Nav/Nav.js +59 -70
- package/dist/components/Organisms/Footer/Nav/Nav.style.js +77 -43
- package/dist/components/Organisms/Header/Burger/BurgerMenu.js +6 -4
- package/dist/components/Organisms/Header/Burger/BurgerMenu.style.js +37 -21
- package/dist/components/Organisms/Header/Header.js +8 -8
- package/dist/components/Organisms/Header/Header.style.js +27 -19
- package/dist/components/Organisms/Header/Nav/Nav.js +39 -50
- package/dist/components/Organisms/Header/Nav/Nav.style.js +103 -57
- package/dist/components/Organisms/Header/header.test.js +1 -1
- package/dist/components/Organisms/ImpactSlider/ImpactMoneybuys.style.js +32 -29
- package/dist/components/Organisms/ImpactSlider/ImpactSlider.js +19 -22
- package/dist/components/Organisms/ImpactSlider/ImpactSlider.style.js +38 -24
- package/dist/components/Organisms/ImpactSlider/Slider.style.js +8 -14
- package/dist/components/Organisms/ImpactSlider/_ImpactMoneybuys.js +11 -11
- package/dist/components/Organisms/ImpactSlider/_Slider.js +9 -7
- package/dist/components/Organisms/ImpactSlider/_utils.js +11 -11
- package/dist/components/Organisms/MarketingPreferencesDS/MarketingPreferencesDS.style.js +61 -38
- package/dist/components/Organisms/MarketingPreferencesDS/MarketingPreferencesDSForm.js +24 -16
- package/dist/components/Organisms/MarketingPreferencesDS/_AssociatedFields.js +1 -1
- package/dist/components/Organisms/MarketingPreferencesDS/_CheckAnswer.js +20 -16
- package/dist/components/Organisms/MarketingPreferencesDS/_DefaultCopy.js +3 -3
- package/dist/components/Organisms/MarketingPreferencesDS/_MarketingPreferencesDS.js +46 -36
- package/dist/components/Organisms/MarketingPreferencesDS/_MarketingPrefsConfig.js +21 -34
- package/dist/components/Organisms/MarketingPreferencesDS/_TextInput.js +20 -18
- package/dist/components/Organisms/Membership/Form/Form.js +48 -81
- package/dist/components/Organisms/Membership/Membership.js +17 -15
- package/dist/components/Organisms/Membership/Membership.style.js +81 -51
- package/dist/components/Organisms/Membership/Membership.test.js +4 -4
- package/dist/components/Organisms/Membership/MoneyBox/MoneyBox.js +37 -26
- package/dist/hoc/shallowWithTheme.js +1 -1
- package/dist/index.js +67 -67
- package/dist/styleguide/CRLogo.js +2 -2
- package/dist/styleguide/StyleGuideRenderer.js +9 -7
- package/dist/styleguide/ThemeWrapper.js +5 -3
- package/dist/styleguide/data/data.js +3 -3
- package/dist/theme/crTheme/buttonColors.js +6 -5
- package/dist/theme/crTheme/colors.js +4 -3
- package/dist/theme/crTheme/fontSizes.js +4 -3
- package/dist/theme/crTheme/linkStyles.js +6 -5
- package/dist/theme/crTheme/theme.js +1 -1
- package/dist/theme/shared/breakpoint.js +4 -3
- package/dist/theme/shared/fontFamilies.js +5 -4
- package/dist/theme/shared/hideVisually.js +1 -1
- package/dist/theme/shared/size.js +4 -3
- package/dist/theme/shared/spacing.js +2 -2
- package/dist/theme/shared/zIndex.js +3 -3
- package/dist/theme/srTheme/buttonColors.js +6 -5
- package/dist/theme/srTheme/colors.js +4 -3
- package/dist/theme/srTheme/fontSizes.js +4 -3
- package/dist/theme/srTheme/linkStyles.js +6 -5
- package/dist/theme/srTheme/theme.js +1 -1
- package/dist/utils/Membership.js +30 -27
- package/dist/utils/ShareButton/sharePopUpHelper.js +8 -8
- package/dist/utils/ShareButton/shareTracking.js +1 -1
- package/dist/utils/ShareButton/shareUrlHelper.js +3 -3
- package/dist/utils/allowListed.js +3 -5
- package/dist/utils/allowListed.test.js +3 -3
- package/dist/utils/internalLinkHelper.js +8 -10
- package/dist/utils/navHelper.js +2 -2
- package/package.json +12 -9
- package/playwright/components/atoms/checkbox.spec.js +64 -0
- package/playwright/components/atoms/input.spec.js +158 -0
- package/playwright/components/atoms/label.spec.js +29 -0
- package/playwright/components/atoms/link.spec.js +48 -0
- package/playwright/components/atoms/radioButton.spec.js +30 -0
- package/playwright/components/atoms/select.spec.js +36 -0
- package/playwright/components/atoms/textArea.spec.js +39 -0
- package/playwright/components/atoms/textInputWithDropdown.spec.js +23 -0
- package/playwright/components/molecules/accordian.spec.js +20 -0
- package/playwright/components/molecules/schoolLookup.spec.js +26 -0
- package/playwright/components/molecules/searchInput.spec.js +24 -0
- package/playwright/components/molecules/shareButton.spec.js +32 -0
- package/playwright/components/molecules/simpleSchoolLookUp.spec.js +35 -0
- package/playwright/components/molecules/typeahead.spec.js +27 -0
- package/playwright/components/organisms/donate.spec.js +293 -0
- package/playwright/components/organisms/emailSignUpForm.spec.js +109 -0
- package/playwright/components/organisms/footer.spec.js +67 -0
- package/playwright/components/organisms/header.spec.js +82 -0
- package/playwright/components/organisms/impactSlider.spec.js +292 -0
- package/playwright/components/organisms/marketingPreferences.spec.js +220 -0
- package/playwright/components/organisms/membership.spec.js +47 -0
- package/playwright.config.js +49 -0
- package/src/components/Molecules/Logos/Logos.js +18 -6
- package/src/components/Molecules/Logos/Logos.md +5 -0
- package/src/components/Organisms/Donate/Donate.js +11 -3
- package/src/components/Organisms/Donate/Donate.md +85 -0
- package/src/components/Organisms/Donate/Form/Form.js +20 -2
- package/src/components/Organisms/ImpactSlider/_ImpactMoneybuys.js +3 -4
- package/src/components/Organisms/Membership/Membership.test.js +1 -1
- package/cypress/e2e/components/atoms/button.cy.js +0 -102
- package/cypress/e2e/components/atoms/buttonWithStates.cy.js +0 -47
- package/cypress/e2e/components/atoms/checkbox.cy.js +0 -70
- package/cypress/e2e/components/atoms/confetti.cy.js +0 -46
- package/cypress/e2e/components/atoms/errorText.cy.js +0 -45
- package/cypress/e2e/components/atoms/input.cy.js +0 -157
- package/cypress/e2e/components/atoms/label.cy.js +0 -93
- package/cypress/e2e/components/atoms/link.cy.js +0 -190
- package/cypress/e2e/components/atoms/logo.cy.js +0 -132
- package/cypress/e2e/components/atoms/pagination.cy.js +0 -191
- package/cypress/e2e/components/atoms/picture.cy.js +0 -130
- package/cypress/e2e/components/atoms/radioButton.cy.js +0 -76
- package/cypress/e2e/components/atoms/richText.cy.js +0 -70
- package/cypress/e2e/components/atoms/select.cy.js +0 -84
- package/cypress/e2e/components/atoms/socialIcons.cy.js +0 -162
- package/cypress/e2e/components/atoms/text.cy.js +0 -169
- package/cypress/e2e/components/atoms/textArea.cy.js +0 -89
- package/cypress/e2e/components/atoms/textInputWithDrop.cy.js +0 -76
- package/cypress/e2e/components/molecules/accordion.cy.js +0 -67
- package/cypress/e2e/components/molecules/articleTeaser.cy.js +0 -105
- package/cypress/e2e/components/molecules/banner.cy.js +0 -67
- package/cypress/e2e/components/molecules/box.cy.js +0 -104
- package/cypress/e2e/components/molecules/card.cy.js +0 -105
- package/cypress/e2e/components/molecules/cardDs.cy.js +0 -198
- package/cypress/e2e/components/molecules/chip.cy.js +0 -68
- package/cypress/e2e/components/molecules/countdown.cy.js +0 -71
- package/cypress/e2e/components/molecules/descriptor.cy.js +0 -142
- package/cypress/e2e/components/molecules/doubleCopy.cy.js +0 -79
- package/cypress/e2e/components/molecules/heroBanner.cy.js +0 -69
- package/cypress/e2e/components/molecules/infoBanner.cy.js +0 -69
- package/cypress/e2e/components/molecules/partnerLink.cy.js +0 -68
- package/cypress/e2e/components/molecules/promo.cy.js +0 -74
- package/cypress/e2e/components/molecules/schoolLookup.cy.js +0 -83
- package/cypress/e2e/components/molecules/searchInput.cy.js +0 -72
- package/cypress/e2e/components/molecules/searchResult.cy.js +0 -191
- package/cypress/e2e/components/molecules/shareButton.cy.js +0 -76
- package/cypress/e2e/components/molecules/simpleSchoolLookup.cy.js +0 -83
- package/cypress/e2e/components/molecules/singleMessage.cy.js +0 -502
- package/cypress/e2e/components/molecules/singleMessageDs.cy.js +0 -234
- package/cypress/e2e/components/molecules/typeahead.cy.js +0 -97
- package/cypress/e2e/components/molecules/videoBanner.cy.js +0 -132
- package/cypress/e2e/components/organisms/cookieBanner.cy.js +0 -80
- package/cypress/e2e/components/organisms/donate.cy.js +0 -284
- package/cypress/e2e/components/organisms/emailSignUp.cy.js +0 -54
- package/cypress/e2e/components/organisms/footer.cy.js +0 -168
- package/cypress/e2e/components/organisms/header.cy.js +0 -138
- package/cypress/e2e/components/organisms/impactSlider.cy.js +0 -72
- package/cypress/e2e/components/organisms/marketingPreferencesDSForm.cy.js +0 -589
- package/cypress/e2e/components/organisms/membership.cy.js +0 -122
- package/cypress/fixtures/example.json +0 -5
- package/cypress/plugins/index.js +0 -21
- package/cypress/support/commands.js +0 -25
- package/cypress/support/e2e.js +0 -36
- package/cypress.config.js +0 -15
|
@@ -1,17 +1,26 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
+
import styled from 'styled-components';
|
|
3
4
|
|
|
4
5
|
import Logo from '../../Atoms/Logo/Logo';
|
|
5
6
|
|
|
7
|
+
const TitleLabel = styled.span`
|
|
8
|
+
line-height: 0;
|
|
9
|
+
font-size: 0;
|
|
10
|
+
color: transparent;
|
|
11
|
+
`;
|
|
12
|
+
|
|
6
13
|
const Logos = ({ campaign }) => {
|
|
7
14
|
if (campaign === 'Sport Relief Gameon') {
|
|
8
15
|
return (
|
|
9
16
|
<>
|
|
10
17
|
<a href="/" title="Go to Comic Relief homepage">
|
|
11
|
-
<Logo rotate sizeSm="50px" sizeMd="60px" campaign="Comic Relief" />
|
|
18
|
+
<Logo rotate sizeSm="50px" sizeMd="60px" campaign="Comic Relief" title="Go to Comic Relief homepage" />
|
|
19
|
+
<TitleLabel>Go to Comic Relief homepage</TitleLabel>
|
|
12
20
|
</a>
|
|
13
21
|
<a href="/sportrelief/" title="Go to Sport Relief homepage">
|
|
14
|
-
<Logo sizeSm="100px" sizeMd="120px" campaign="Sport Relief Gameon" />
|
|
22
|
+
<Logo sizeSm="100px" sizeMd="120px" campaign="Sport Relief Gameon" title="Go to Sport Relief homepage" />
|
|
23
|
+
<TitleLabel>Go to Sport Relief homepage</TitleLabel>
|
|
15
24
|
</a>
|
|
16
25
|
</>
|
|
17
26
|
);
|
|
@@ -19,8 +28,9 @@ const Logos = ({ campaign }) => {
|
|
|
19
28
|
|
|
20
29
|
if (campaign === 'Sport Relief') {
|
|
21
30
|
return (
|
|
22
|
-
<a href="/sportrelief" title="Sport Relief
|
|
23
|
-
<Logo rotate={false} campaign="Sport Relief" />
|
|
31
|
+
<a href="/sportrelief" title="Go to Sport Relief homepage">
|
|
32
|
+
<Logo rotate={false} campaign="Sport Relief" title="Sport Relief in homepage" />
|
|
33
|
+
<TitleLabel>Go to Sport Relief homepage</TitleLabel>
|
|
24
34
|
</a>
|
|
25
35
|
);
|
|
26
36
|
}
|
|
@@ -28,14 +38,16 @@ const Logos = ({ campaign }) => {
|
|
|
28
38
|
if (campaign === 'Pride') {
|
|
29
39
|
return (
|
|
30
40
|
<a href="/" title="Go to Comic Relief homepage">
|
|
31
|
-
<Logo rotate={false} campaign="Pride" />
|
|
41
|
+
<Logo rotate={false} campaign="Pride" title="Go to Comic Relief homepage" />
|
|
42
|
+
<TitleLabel>Go to Comic Relief homepage</TitleLabel>
|
|
32
43
|
</a>
|
|
33
44
|
);
|
|
34
45
|
}
|
|
35
46
|
|
|
36
47
|
return (
|
|
37
48
|
<a href="/" title="Go to Comic Relief homepage">
|
|
38
|
-
<Logo rotate={false} campaign="Comic Relief" />
|
|
49
|
+
<Logo rotate={false} campaign="Comic Relief" title="Go to Comic Relief homepage" />
|
|
50
|
+
<TitleLabel>Go to Comic Relief homepage</TitleLabel>
|
|
39
51
|
</a>
|
|
40
52
|
);
|
|
41
53
|
};
|
|
@@ -40,7 +40,9 @@ const Donate = ({
|
|
|
40
40
|
PopUpText,
|
|
41
41
|
chooseAmountText,
|
|
42
42
|
isDesktopOverride,
|
|
43
|
-
otherAmountValue
|
|
43
|
+
otherAmountValue,
|
|
44
|
+
additionalSingleCopy,
|
|
45
|
+
additionalMonthlyCopy
|
|
44
46
|
}) => {
|
|
45
47
|
let isDesktop = useMediaQuery({ query: `(min-width: ${screen.medium})` });
|
|
46
48
|
|
|
@@ -127,6 +129,8 @@ const Donate = ({
|
|
|
127
129
|
chooseAmountText={chooseAmountText}
|
|
128
130
|
submitButtonColor={submitButtonColor}
|
|
129
131
|
otherAmountValue={otherAmountValue}
|
|
132
|
+
additionalSingleCopy={additionalSingleCopy}
|
|
133
|
+
additionalMonthlyCopy={additionalMonthlyCopy}
|
|
130
134
|
/>
|
|
131
135
|
</Wrapper>
|
|
132
136
|
</Container>
|
|
@@ -159,7 +163,9 @@ Donate.propTypes = {
|
|
|
159
163
|
PopUpText: PropTypes.string,
|
|
160
164
|
chooseAmountText: PropTypes.string,
|
|
161
165
|
isDesktopOverride: PropTypes.bool,
|
|
162
|
-
otherAmountValue: PropTypes.number
|
|
166
|
+
otherAmountValue: PropTypes.number,
|
|
167
|
+
additionalSingleCopy: PropTypes.string,
|
|
168
|
+
additionalMonthlyCopy: PropTypes.string
|
|
163
169
|
};
|
|
164
170
|
|
|
165
171
|
Donate.defaultProps = {
|
|
@@ -186,7 +192,9 @@ Donate.defaultProps = {
|
|
|
186
192
|
chooseAmountText: '',
|
|
187
193
|
isDesktopOverride: null,
|
|
188
194
|
otherAmountValue: null,
|
|
189
|
-
title: null
|
|
195
|
+
title: null,
|
|
196
|
+
additionalSingleCopy: null,
|
|
197
|
+
additionalMonthlyCopy: null
|
|
190
198
|
};
|
|
191
199
|
|
|
192
200
|
export default Donate;
|
|
@@ -354,3 +354,88 @@ const desktopPictures = require('../../../styleguide/data/data').defaultData;
|
|
|
354
354
|
isDesktopOverride={false}
|
|
355
355
|
/>;
|
|
356
356
|
```
|
|
357
|
+
|
|
358
|
+
## Additional copy for BOTH giving types
|
|
359
|
+
|
|
360
|
+
```js
|
|
361
|
+
import data from './dev-data/data';
|
|
362
|
+
const mobilePictures = require('../../../styleguide/data/data').mobileImages;
|
|
363
|
+
const desktopPictures = require('../../../styleguide/data/data').defaultData;
|
|
364
|
+
|
|
365
|
+
<Donate
|
|
366
|
+
alt="Background image"
|
|
367
|
+
mobileBackgroundColor="deep_violet_dark"
|
|
368
|
+
desktopOverlayColor="red"
|
|
369
|
+
submitButtonColor="blue_dark"
|
|
370
|
+
formAlignRight={true}
|
|
371
|
+
imageLow={desktopPictures.imageLow}
|
|
372
|
+
images={desktopPictures.images}
|
|
373
|
+
mobileImageLow={mobilePictures.imageLow}
|
|
374
|
+
mobileImages={mobilePictures.images}
|
|
375
|
+
data={data}
|
|
376
|
+
mbshipID="mship-11"
|
|
377
|
+
donateLink="https://donation.comicrelief.com/"
|
|
378
|
+
clientID="donate"
|
|
379
|
+
cartID="default-comicrelief"
|
|
380
|
+
title="Donate Now"
|
|
381
|
+
subtitle="Please help us fund life-changing projects in the UK and around the world."
|
|
382
|
+
additionalSingleCopy="Some additional single giving copy - Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam eaque ipsa."
|
|
383
|
+
additionalMonthlyCopy="Some additional regular giving copy! - Quasi architecto beatae vitae dicta sunt, explicabo. Nemo enim ipsam voluptatem, quia voluptas sit, aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos."
|
|
384
|
+
/>;
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
## Additional copy for monthly only
|
|
388
|
+
|
|
389
|
+
```js
|
|
390
|
+
import data from './dev-data/data';
|
|
391
|
+
const mobilePictures = require('../../../styleguide/data/data').mobileImages;
|
|
392
|
+
const desktopPictures = require('../../../styleguide/data/data').defaultData;
|
|
393
|
+
|
|
394
|
+
<Donate
|
|
395
|
+
alt="Background image"
|
|
396
|
+
mobileBackgroundColor="deep_violet_dark"
|
|
397
|
+
desktopOverlayColor="red"
|
|
398
|
+
submitButtonColor="blue_dark"
|
|
399
|
+
formAlignRight={true}
|
|
400
|
+
imageLow={desktopPictures.imageLow}
|
|
401
|
+
images={desktopPictures.images}
|
|
402
|
+
mobileImageLow={mobilePictures.imageLow}
|
|
403
|
+
mobileImages={mobilePictures.images}
|
|
404
|
+
data={data}
|
|
405
|
+
mbshipID="mship-12"
|
|
406
|
+
donateLink="https://donation.comicrelief.com/"
|
|
407
|
+
clientID="donate"
|
|
408
|
+
cartID="default-comicrelief"
|
|
409
|
+
title="Donate Now"
|
|
410
|
+
subtitle="Please help us fund life-changing projects in the UK and around the world."
|
|
411
|
+
additionalMonthlyCopy="Some additional regular giving copy! - Quasi architecto beatae vitae dicta sunt, explicabo. Nemo enim ipsam voluptatem, quia voluptas sit, aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos."
|
|
412
|
+
/>;
|
|
413
|
+
```
|
|
414
|
+
|
|
415
|
+
## Additional copy for single only
|
|
416
|
+
|
|
417
|
+
```js
|
|
418
|
+
import data from './dev-data/data';
|
|
419
|
+
const mobilePictures = require('../../../styleguide/data/data').mobileImages;
|
|
420
|
+
const desktopPictures = require('../../../styleguide/data/data').defaultData;
|
|
421
|
+
|
|
422
|
+
<Donate
|
|
423
|
+
alt="Background image"
|
|
424
|
+
mobileBackgroundColor="deep_violet_dark"
|
|
425
|
+
desktopOverlayColor="red"
|
|
426
|
+
submitButtonColor="blue_dark"
|
|
427
|
+
formAlignRight={true}
|
|
428
|
+
imageLow={desktopPictures.imageLow}
|
|
429
|
+
images={desktopPictures.images}
|
|
430
|
+
mobileImageLow={mobilePictures.imageLow}
|
|
431
|
+
mobileImages={mobilePictures.images}
|
|
432
|
+
data={data}
|
|
433
|
+
mbshipID="mship-13"
|
|
434
|
+
donateLink="https://donation.comicrelief.com/"
|
|
435
|
+
clientID="donate"
|
|
436
|
+
cartID="default-comicrelief"
|
|
437
|
+
title="Donate Now"
|
|
438
|
+
subtitle="Please help us fund life-changing projects in the UK and around the world."
|
|
439
|
+
additionalSingleCopy="Some additional single giving copy - Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam eaque ipsa."
|
|
440
|
+
/>;
|
|
441
|
+
```
|
|
@@ -38,6 +38,8 @@ const Signup = ({
|
|
|
38
38
|
chooseAmountText,
|
|
39
39
|
submitButtonColor,
|
|
40
40
|
otherAmountValue,
|
|
41
|
+
additionalSingleCopy,
|
|
42
|
+
additionalMonthlyCopy,
|
|
41
43
|
...rest
|
|
42
44
|
}) => {
|
|
43
45
|
const [givingType, setGivingType] = useState('single');
|
|
@@ -191,6 +193,10 @@ const Signup = ({
|
|
|
191
193
|
return `Donate £${amountDonate} monthly`;
|
|
192
194
|
};
|
|
193
195
|
|
|
196
|
+
const showAdditionalSingleCopy = givingType === 'single' && additionalSingleCopy;
|
|
197
|
+
const showAdditionalMonthlyCopy = givingType === 'monthly' && additionalMonthlyCopy;
|
|
198
|
+
const additionalCopy = showAdditionalSingleCopy || showAdditionalMonthlyCopy;
|
|
199
|
+
|
|
194
200
|
return (
|
|
195
201
|
<FormWrapper>
|
|
196
202
|
{showGivingSelector && (
|
|
@@ -276,6 +282,14 @@ const Signup = ({
|
|
|
276
282
|
</Error>
|
|
277
283
|
)}
|
|
278
284
|
|
|
285
|
+
{additionalCopy && (
|
|
286
|
+
<p className="additional-copy">
|
|
287
|
+
<strong>
|
|
288
|
+
{additionalCopy}
|
|
289
|
+
</strong>
|
|
290
|
+
</p>
|
|
291
|
+
)}
|
|
292
|
+
|
|
279
293
|
{noMoneyBuys ? (
|
|
280
294
|
<Button
|
|
281
295
|
type="submit"
|
|
@@ -313,13 +327,17 @@ Signup.propTypes = {
|
|
|
313
327
|
PopUpText: PropTypes.string.isRequired,
|
|
314
328
|
chooseAmountText: PropTypes.string.isRequired,
|
|
315
329
|
submitButtonColor: PropTypes.string.isRequired,
|
|
316
|
-
otherAmountValue: PropTypes.number
|
|
330
|
+
otherAmountValue: PropTypes.number,
|
|
331
|
+
additionalSingleCopy: PropTypes.string,
|
|
332
|
+
additionalMonthlyCopy: PropTypes.string
|
|
317
333
|
};
|
|
318
334
|
|
|
319
335
|
Signup.defaultProps = {
|
|
320
336
|
noMoneyBuys: false,
|
|
321
337
|
otherAmountValue: null,
|
|
322
|
-
data: {}
|
|
338
|
+
data: {},
|
|
339
|
+
additionalSingleCopy: null,
|
|
340
|
+
additionalMonthlyCopy: null
|
|
323
341
|
};
|
|
324
342
|
|
|
325
343
|
export default Signup;
|
|
@@ -8,12 +8,11 @@ import {
|
|
|
8
8
|
const Moneybuys = ({ items, currentAmount, opacityAnimation }) => (
|
|
9
9
|
<MoneybuyWrapper>
|
|
10
10
|
{items.map((item, index) => {
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const isInactive = !(!opacityAnimation || currentAmount >= roundedPerPound);
|
|
11
|
+
const thisAmount = Math.floor(currentAmount / item.poundsPerItem);
|
|
12
|
+
const isInactive = !(!opacityAnimation || currentAmount >= item.poundsPerItem);
|
|
14
13
|
|
|
15
14
|
return (
|
|
16
|
-
<Fragment key={
|
|
15
|
+
<Fragment key={item.poundsPerItem}>
|
|
17
16
|
<Moneybuy isInactive={isInactive} data-testid={`impact-slider--moneybuy-${index + 1}`}>
|
|
18
17
|
<MoneybuyImage imageURL={item.imageURL} />
|
|
19
18
|
<MoneybuyAmount tag="p" family="Anton" uppercase weight="normal" size="xl" data-testid="moneybuy-amount">{thisAmount}</MoneybuyAmount>
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
describe('Button component', () => {
|
|
2
|
-
before(() => {
|
|
3
|
-
// go to button component
|
|
4
|
-
cy.visit('/#button');
|
|
5
|
-
});
|
|
6
|
-
|
|
7
|
-
describe('props and methods section', () => {
|
|
8
|
-
beforeEach(() => {
|
|
9
|
-
cy.visit('/#button');
|
|
10
|
-
cy.get('[data-testid="Button-container"] button[name="rsg-usage"]')
|
|
11
|
-
.contains('Props & methods')
|
|
12
|
-
.as('propsBtn');
|
|
13
|
-
|
|
14
|
-
cy.get('@propsBtn')
|
|
15
|
-
.closest('[class^=rsg--tabs]')
|
|
16
|
-
.as('container');
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
it('is present', () => {
|
|
20
|
-
cy.get('@propsBtn').should('exist');
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
it('does not show table initially', () => {
|
|
24
|
-
cy.get('@container')
|
|
25
|
-
.find('table')
|
|
26
|
-
.should('not.exist');
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
it('shows the table on button click', () => {
|
|
30
|
-
cy.get('@propsBtn').click();
|
|
31
|
-
cy.get('@container')
|
|
32
|
-
.find('table')
|
|
33
|
-
.should('contain', 'Prop name');
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
describe('Plain Button: Button-example-0', () => {
|
|
38
|
-
beforeEach(() => {
|
|
39
|
-
cy.visit('/#button');
|
|
40
|
-
cy.get('[data-testid="Button-example-0"')
|
|
41
|
-
.as('container')
|
|
42
|
-
.find('[class^=rsg--preview]')
|
|
43
|
-
.as('preview');
|
|
44
|
-
|
|
45
|
-
cy.get('@container')
|
|
46
|
-
.find('button')
|
|
47
|
-
.contains('View Code')
|
|
48
|
-
.as('viewCodeBtn');
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
it('renders button as a span', () => {
|
|
52
|
-
//verify button as a span
|
|
53
|
-
cy.get('[data-testid="Button-example-0"]')
|
|
54
|
-
.contains('My button')
|
|
55
|
-
.should('exist');
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
it('has view code button', () => {
|
|
59
|
-
cy.get('@viewCodeBtn').should('exist');
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
it('shows code on click', () => {
|
|
63
|
-
cy.get('@viewCodeBtn').click();
|
|
64
|
-
cy.get('@container')
|
|
65
|
-
.find('textarea')
|
|
66
|
-
.should('exist');
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
describe('Button as a span: Button-example-1', () => {
|
|
71
|
-
beforeEach(() => {
|
|
72
|
-
cy.visit('/#button');
|
|
73
|
-
cy.get('[data-testid="Button-example-1"]')
|
|
74
|
-
.as('container')
|
|
75
|
-
.find('[class^=rsg--preview]')
|
|
76
|
-
.as('preview');
|
|
77
|
-
|
|
78
|
-
cy.get('@container')
|
|
79
|
-
.find('button')
|
|
80
|
-
.contains('View Code')
|
|
81
|
-
.as('viewCodeBtn');
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
it('renders button as a span', () => {
|
|
85
|
-
// verify button as a span
|
|
86
|
-
cy.get('[data-testid="Button-example-1"]')
|
|
87
|
-
.contains('My button as a span')
|
|
88
|
-
.should('exist');
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
it('has view code button', () => {
|
|
92
|
-
cy.get('@viewCodeBtn').should('exist');
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
it('shows code on click', () => {
|
|
96
|
-
cy.get('@viewCodeBtn').click();
|
|
97
|
-
cy.get('@container')
|
|
98
|
-
.find('textarea')
|
|
99
|
-
.should('exist');
|
|
100
|
-
});
|
|
101
|
-
});
|
|
102
|
-
});
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
describe('Button With States component', () => {
|
|
2
|
-
before(() => {
|
|
3
|
-
// go to Button With States component
|
|
4
|
-
cy.visit('/#button');
|
|
5
|
-
});
|
|
6
|
-
|
|
7
|
-
describe('props and methods section', () => {
|
|
8
|
-
beforeEach(() => {
|
|
9
|
-
cy.visit('/#button');
|
|
10
|
-
cy.get('[data-testid="ButtonWithStates-container"]')
|
|
11
|
-
.as('container')
|
|
12
|
-
.find('[class^=rsg--preview]')
|
|
13
|
-
.as('preview');
|
|
14
|
-
|
|
15
|
-
cy.get('@container')
|
|
16
|
-
.find('button')
|
|
17
|
-
.contains('View Code')
|
|
18
|
-
.as('viewCodeBtn');
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
// button with Disabled and loading
|
|
22
|
-
it('renders button with states', () => {
|
|
23
|
-
cy.get('[data-testid="ButtonWithStates-examples"]')
|
|
24
|
-
.find('h2')
|
|
25
|
-
.contains('Disabled and loading')
|
|
26
|
-
.should('exist');
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
it('renders button as disabled', () => {
|
|
30
|
-
// verify button as a span
|
|
31
|
-
cy.get('[data-testid="ButtonWithStates-example-1"]')
|
|
32
|
-
.contains('Loading')
|
|
33
|
-
.should('be.disabled');
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
it('has view code button', () => {
|
|
37
|
-
cy.get('@viewCodeBtn').should('exist');
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
it('shows code on click', () => {
|
|
41
|
-
cy.get('@viewCodeBtn').click();
|
|
42
|
-
cy.get('@container')
|
|
43
|
-
.find('textarea')
|
|
44
|
-
.should('exist');
|
|
45
|
-
});
|
|
46
|
-
});
|
|
47
|
-
});
|
|
@@ -1,70 +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.visit('/#checkbox');
|
|
10
|
-
cy.get('[data-testid="Checkbox-container"] button[name="rsg-usage"]')
|
|
11
|
-
.contains('Props & methods')
|
|
12
|
-
.as('propsBtn');
|
|
13
|
-
|
|
14
|
-
cy.get('@propsBtn')
|
|
15
|
-
.closest('[class^=rsg--tabs]')
|
|
16
|
-
.as('container');
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
it('is present', () => {
|
|
20
|
-
cy.get('@propsBtn').should('exist');
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
it('does not show table initially', () => {
|
|
24
|
-
cy.get('@container')
|
|
25
|
-
.find('table')
|
|
26
|
-
.should('not.exist');
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
it('shows the table on button click', () => {
|
|
30
|
-
cy.get('@propsBtn').click();
|
|
31
|
-
cy.get('@container')
|
|
32
|
-
.find('table')
|
|
33
|
-
.should('contain', 'Prop name');
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
describe('Checkbox section', () => {
|
|
38
|
-
beforeEach(() => {
|
|
39
|
-
cy.visit('/#checkbox');
|
|
40
|
-
cy.get('[data-preview="Checkbox"]')
|
|
41
|
-
.as('preview');
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
it('should click checkboxes', () => {
|
|
45
|
-
cy.get('[data-preview="Checkbox"] p').contains('List of checkboxes');
|
|
46
|
-
cy.get('[data-testid="Checkbox-example-1"] div > label:nth-child(2)')
|
|
47
|
-
.contains('Tennis')
|
|
48
|
-
.click();
|
|
49
|
-
cy.get('[data-testid="Checkbox-example-1"] div > label:nth-child(3)')
|
|
50
|
-
.contains('Basketball')
|
|
51
|
-
.click();
|
|
52
|
-
cy.get('[data-testid="Checkbox-example-1"] div > label:nth-child(4)')
|
|
53
|
-
.contains('Cycling')
|
|
54
|
-
.click();
|
|
55
|
-
cy.get('[data-testid="Checkbox-example-1"] div > label:nth-child(5)')
|
|
56
|
-
.contains('Football')
|
|
57
|
-
.click();
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
it('has view code button', () => {
|
|
61
|
-
cy.get('[data-testid="Checkbox-examples"] [name="rsg-code-editor"]').should('exist');
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
it('shows code on click', () => {
|
|
65
|
-
cy.get('[data-testid="Checkbox-examples"] [name="rsg-code-editor"]').contains('View Code')
|
|
66
|
-
.click();
|
|
67
|
-
cy.get('[data-testid="Checkbox-examples"] div > textarea').should('be.visible');
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
});
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
describe('Confetti component', () => {
|
|
2
|
-
before(() => {
|
|
3
|
-
// go to confetti component
|
|
4
|
-
cy.visit('/#confetti');
|
|
5
|
-
});
|
|
6
|
-
|
|
7
|
-
describe('props and methods section', () => {
|
|
8
|
-
beforeEach(() => {
|
|
9
|
-
cy.visit('/#confetti');
|
|
10
|
-
cy.get('[data-testid="Confetti-container"]')
|
|
11
|
-
.as('container')
|
|
12
|
-
.find('[class^=rsg--preview]')
|
|
13
|
-
.as('preview');
|
|
14
|
-
|
|
15
|
-
cy.get('@container')
|
|
16
|
-
.find('button')
|
|
17
|
-
.contains('View Code')
|
|
18
|
-
.as('viewCodeBtn');
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
it('renders button with states', () => {
|
|
22
|
-
cy.get('[data-testid="Confetti-examples"]')
|
|
23
|
-
.find('h1')
|
|
24
|
-
.contains('Confetti')
|
|
25
|
-
.should('exist');
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
it('renders confetti when "trigger confetti" is clicked', () => {
|
|
29
|
-
// verify button as a span
|
|
30
|
-
cy.get('[data-testid="Confetti-example-1"]')
|
|
31
|
-
.contains('trigger confetti')
|
|
32
|
-
.click()
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
it('has view code button', () => {
|
|
36
|
-
cy.get('@viewCodeBtn').should('exist');
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
it('shows code on click', () => {
|
|
40
|
-
cy.get('@viewCodeBtn').click();
|
|
41
|
-
cy.get('@container')
|
|
42
|
-
.find('textarea')
|
|
43
|
-
.should('exist');
|
|
44
|
-
});
|
|
45
|
-
});
|
|
46
|
-
});
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
describe('ErrorText component', () => {
|
|
2
|
-
before(() => {
|
|
3
|
-
// go to errortext component
|
|
4
|
-
cy.visit('/#errortext');
|
|
5
|
-
});
|
|
6
|
-
|
|
7
|
-
describe('props and methods section', () => {
|
|
8
|
-
beforeEach(() => {
|
|
9
|
-
cy.visit('/#errortext');
|
|
10
|
-
cy.get('[data-testid="ErrorText-container"]')
|
|
11
|
-
.as('container')
|
|
12
|
-
.find('[class^=rsg--preview]')
|
|
13
|
-
.as('preview');
|
|
14
|
-
|
|
15
|
-
cy.get('@container')
|
|
16
|
-
.find('button')
|
|
17
|
-
.contains('View Code')
|
|
18
|
-
.as('viewCodeBtn');
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
it('error message should exist', () => {
|
|
22
|
-
cy.get('[data-testid="ErrorText-examples"]')
|
|
23
|
-
.find('h1')
|
|
24
|
-
.contains('ErrorText')
|
|
25
|
-
.should('exist');
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
it('displays error message', () => {
|
|
29
|
-
cy.get('[data-testid="ErrorText-example-1"] span')
|
|
30
|
-
.contains('This is an error')
|
|
31
|
-
.should('exist');
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
it('has view code button', () => {
|
|
35
|
-
cy.get('@viewCodeBtn').should('exist');
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
it('shows code on click', () => {
|
|
39
|
-
cy.get('@viewCodeBtn').click();
|
|
40
|
-
cy.get('@container')
|
|
41
|
-
.find('textarea')
|
|
42
|
-
.should('exist');
|
|
43
|
-
});
|
|
44
|
-
});
|
|
45
|
-
});
|