@nypl/design-system-react-components 0.23.4 → 0.25.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +98 -1
- package/README.md +46 -11
- package/dist/components/Accordion/Accordion.d.ts +14 -14
- package/dist/components/Autosuggest/Autosuggest.stories.d.ts +1 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +11 -14
- package/dist/components/Breadcrumbs/BreadcrumbsTypes.d.ts +6 -0
- package/dist/components/Button/Button.d.ts +6 -13
- package/dist/components/Button/ButtonTypes.d.ts +5 -3
- package/dist/components/Card/Card.d.ts +59 -10
- package/dist/components/Card/CardTypes.d.ts +19 -0
- package/dist/components/CardEdition/CardEdition.d.ts +21 -0
- package/dist/components/{StyleGuide/Colors.stories.d.ts → CardEdition/CardEdition.stories.d.ts} +5 -2
- package/dist/components/Checkbox/Checkbox.d.ts +21 -16
- package/dist/components/CheckboxGroup/CheckboxGroup.d.ts +43 -0
- package/dist/components/CheckboxGroup/CheckboxGroupLayoutTypes.d.ts +4 -0
- package/dist/components/DatePicker/DatePicker.d.ts +79 -0
- package/dist/components/DatePicker/DatePickerTypes.d.ts +5 -0
- package/dist/components/Form/Form.d.ts +16 -8
- package/dist/components/Form/FormTypes.d.ts +2 -0
- package/dist/components/Grid/GridTypes.d.ts +9 -0
- package/dist/components/Grid/SimpleGrid.d.ts +14 -0
- package/dist/components/Heading/Heading.d.ts +9 -11
- package/dist/components/Heading/{HeadingDisplaySizes.d.ts → HeadingTypes.d.ts} +8 -0
- package/dist/components/HelperErrorText/HelperErrorText.stories.d.ts +2 -1
- package/dist/components/Hero/Hero.d.ts +19 -14
- package/dist/components/Hero/HeroTypes.d.ts +10 -5
- package/dist/components/Icons/Icon.d.ts +13 -16
- package/dist/components/Icons/IconSvgs.d.ts +4 -0
- package/dist/components/Icons/IconTypes.d.ts +78 -60
- package/dist/components/Image/Image.stories.d.ts +2 -1
- package/dist/components/Label/Label.d.ts +10 -26
- package/dist/components/Link/Link.d.ts +8 -12
- package/dist/components/List/List.stories.d.ts +1 -0
- package/dist/components/Radio/Radio.d.ts +30 -24
- package/dist/components/RadioGroup/RadioGroup.d.ts +40 -0
- package/dist/components/RadioGroup/RadioGroupLayoutTypes.d.ts +4 -0
- package/dist/components/SearchBar/SearchBar.d.ts +45 -27
- package/dist/components/Select/Select.d.ts +34 -35
- package/dist/components/Select/SelectTypes.d.ts +4 -0
- package/dist/components/SkeletonLoader/SkeletonLoader.d.ts +1 -1
- package/dist/components/SkeletonLoader/SkeletonLoaderTypes.d.ts +2 -2
- package/dist/components/StatusBadge/StatusBadge.d.ts +8 -6
- package/dist/components/StatusBadge/StatusBadgeTypes.d.ts +5 -0
- package/dist/components/Tabs/Tabs.d.ts +25 -0
- package/dist/components/Template/Template.d.ts +91 -0
- package/dist/components/Text/Text.d.ts +16 -0
- package/dist/components/Text/TextTypes.d.ts +6 -0
- package/dist/components/TextInput/TextInput.d.ts +37 -30
- package/dist/components/TextInput/TextInputTypes.d.ts +5 -0
- package/dist/design-system-react-components.cjs.development.js +4102 -917
- package/dist/design-system-react-components.cjs.development.js.map +1 -1
- package/dist/design-system-react-components.cjs.production.min.js +1 -1
- package/dist/design-system-react-components.cjs.production.min.js.map +1 -1
- package/dist/design-system-react-components.esm.js +4023 -920
- package/dist/design-system-react-components.esm.js.map +1 -1
- package/dist/index.d.ts +23 -5
- package/dist/resources.scss +133 -24
- package/dist/styles.css +1 -1
- package/dist/theme/components/accordion.d.ts +25 -0
- package/dist/theme/components/breadcrumb.d.ts +90 -0
- package/dist/theme/components/button.d.ts +109 -0
- package/dist/theme/components/checkbox.d.ts +91 -0
- package/dist/theme/components/customCheckboxGroup.d.ts +18 -0
- package/dist/theme/components/customRadioGroup.d.ts +18 -0
- package/dist/theme/components/global.d.ts +55 -0
- package/dist/theme/components/globalMixins.d.ts +15 -0
- package/dist/theme/components/heading.d.ts +110 -0
- package/dist/theme/components/hero.d.ts +492 -0
- package/dist/theme/components/icon.d.ts +13 -0
- package/dist/theme/components/label.d.ts +16 -0
- package/dist/theme/components/link.d.ts +45 -0
- package/dist/theme/components/radio.d.ts +95 -0
- package/dist/theme/components/searchBar.d.ts +20 -0
- package/dist/theme/components/select.d.ts +58 -0
- package/dist/theme/components/statusBadge.d.ts +25 -0
- package/dist/theme/components/tabs.d.ts +85 -0
- package/dist/theme/components/template.d.ts +105 -0
- package/dist/theme/components/text.d.ts +20 -0
- package/dist/theme/components/textInput.d.ts +105 -0
- package/dist/theme/foundations/breakpoints.d.ts +23 -0
- package/dist/theme/foundations/colors.d.ts +3 -0
- package/dist/theme/foundations/global.d.ts +23 -0
- package/dist/theme/foundations/shadows.d.ts +4 -0
- package/dist/theme/foundations/spacing.d.ts +77 -0
- package/dist/theme/foundations/typography.d.ts +8 -0
- package/dist/theme/index.d.ts +20 -0
- package/dist/theme/provider.d.ts +5 -0
- package/dist/theme/types.d.ts +1 -0
- package/dist/utils/utils.d.ts +6 -0
- package/package.json +9 -2
- package/src/components/Accordion/Accordion.stories.mdx +233 -33
- package/src/components/Accordion/Accordion.test.tsx +135 -19
- package/src/components/Accordion/Accordion.tsx +81 -56
- package/src/components/Autosuggest/Autosuggest.stories.mdx +4 -3
- package/src/components/Autosuggest/Autosuggest.stories.tsx +1 -1
- package/src/components/Autosuggest/_Autosuggest.scss +2 -2
- package/src/components/Breadcrumbs/Breadcrumbs.stories.mdx +57 -56
- package/src/components/Breadcrumbs/Breadcrumbs.test.tsx +31 -25
- package/src/components/Breadcrumbs/Breadcrumbs.tsx +71 -73
- package/src/components/Breadcrumbs/BreadcrumbsTypes.tsx +6 -0
- package/src/components/Breadcrumbs/__snapshots__/Breadcrumbs.test.tsx.snap +100 -0
- package/src/components/Button/Button.stories.mdx +125 -138
- package/src/components/Button/Button.test.tsx +65 -11
- package/src/components/Button/Button.tsx +72 -68
- package/src/components/Button/ButtonTypes.tsx +4 -2
- package/src/components/Button/_Button.scss +7 -92
- package/src/components/Button/__snapshots__/Button.test.tsx.snap +58 -3
- package/src/components/Card/Card.stories.mdx +694 -0
- package/src/components/Card/Card.test.tsx +97 -102
- package/src/components/Card/Card.tsx +182 -31
- package/src/components/Card/CardTypes.tsx +21 -0
- package/src/components/Card/_Card.scss +234 -49
- package/src/components/{Card/Card.stories.tsx → CardEdition/CardEdition.stories.tsx} +32 -22
- package/src/components/CardEdition/CardEdition.test.tsx +395 -0
- package/src/components/CardEdition/CardEdition.tsx +60 -0
- package/src/components/CardEdition/_CardEdition.scss +138 -0
- package/src/components/Chakra/Box.stories.mdx +57 -0
- package/src/components/Chakra/Center.stories.mdx +99 -0
- package/src/components/Chakra/Grid.stories.mdx +79 -0
- package/src/components/Chakra/Stack.stories.mdx +93 -0
- package/src/components/Checkbox/Checkbox.stories.mdx +57 -35
- package/src/components/Checkbox/Checkbox.test.tsx +117 -147
- package/src/components/Checkbox/Checkbox.tsx +76 -50
- package/src/components/Checkbox/__snapshots__/Checkbox.test.tsx.snap +325 -0
- package/src/components/CheckboxGroup/CheckboxGroup.stories.mdx +249 -0
- package/src/components/CheckboxGroup/CheckboxGroup.test.tsx +345 -0
- package/src/components/CheckboxGroup/CheckboxGroup.tsx +148 -0
- package/src/components/CheckboxGroup/CheckboxGroupLayoutTypes.tsx +4 -0
- package/src/components/CheckboxGroup/__snapshots__/CheckboxGroup.test.tsx.snap +1360 -0
- package/src/components/DatePicker/DatePicker.stories.mdx +284 -0
- package/src/components/DatePicker/DatePicker.test.tsx +657 -0
- package/src/components/DatePicker/DatePicker.tsx +396 -0
- package/src/components/DatePicker/DatePickerTypes.tsx +5 -0
- package/src/components/DatePicker/_DatePicker.scss +76 -0
- package/src/components/Form/Form.stories.mdx +130 -27
- package/src/components/Form/Form.test.tsx +78 -36
- package/src/components/Form/Form.tsx +53 -19
- package/src/components/Form/FormTypes.tsx +3 -0
- package/src/components/Form/__snapshots__/Form.test.tsx.snap +38 -0
- package/src/components/Grid/GridTypes.tsx +9 -0
- package/src/components/Grid/SimpleGrid.stories.mdx +275 -0
- package/src/components/Grid/SimpleGrid.test.tsx +66 -0
- package/src/components/Grid/SimpleGrid.tsx +37 -0
- package/src/components/Grid/__snapshots__/SimpleGrid.test.tsx.snap +8 -0
- package/src/components/Heading/Heading.stories.mdx +63 -33
- package/src/components/Heading/Heading.test.tsx +24 -16
- package/src/components/Heading/Heading.tsx +54 -38
- package/src/components/Heading/{HeadingDisplaySizes.tsx → HeadingTypes.tsx} +9 -0
- package/src/components/HelperErrorText/HelperErrorText.stories.tsx +2 -1
- package/src/components/HelperErrorText/_HelperErrorText.scss +1 -1
- package/src/components/Hero/Hero.stories.mdx +195 -85
- package/src/components/Hero/Hero.test.tsx +544 -113
- package/src/components/Hero/Hero.tsx +80 -93
- package/src/components/Hero/HeroTypes.tsx +17 -5
- package/src/components/Hero/__snapshots__/Hero.test.tsx.snap +307 -0
- package/src/components/HorizontalRule/HorizontalRule.stories.mdx +6 -1
- package/src/components/HorizontalRule/_HorizontalRule.scss +1 -1
- package/src/components/Icons/Icon.stories.mdx +89 -74
- package/src/components/Icons/Icon.test.tsx +30 -22
- package/src/components/Icons/Icon.tsx +63 -61
- package/src/components/Icons/IconSvgs.tsx +8 -0
- package/src/components/Icons/IconTypes.tsx +80 -60
- package/src/components/Image/Image.stories.tsx +2 -1
- package/src/components/Input/_Input.scss +2 -2
- package/src/components/Label/Label.stories.mdx +77 -0
- package/src/components/Label/Label.test.tsx +43 -12
- package/src/components/Label/Label.tsx +28 -45
- package/src/components/Label/__snapshots__/Label.test.tsx.snap +41 -0
- package/src/components/Link/Link.stories.mdx +47 -41
- package/src/components/Link/Link.test.tsx +33 -44
- package/src/components/Link/Link.tsx +114 -100
- package/src/components/List/List.stories.mdx +7 -3
- package/src/components/List/List.stories.tsx +14 -9
- package/src/components/List/List.test.tsx +12 -8
- package/src/components/List/List.tsx +9 -7
- package/src/components/List/_List.scss +3 -3
- package/src/components/Modal/Modal.stories.mdx +7 -3
- package/src/components/Modal/_Modal.scss +1 -1
- package/src/components/Notification/Notification.stories.mdx +99 -65
- package/src/components/Notification/Notification.test.tsx +3 -16
- package/src/components/Notification/Notification.tsx +12 -12
- package/src/components/Notification/_Notification.scss +5 -4
- package/src/components/Notification/__snapshots__/Notification.test.tsx.snap +1 -1
- package/src/components/Pagination/Pagination.stories.mdx +7 -1
- package/src/components/Pagination/Pagination.test.tsx +16 -10
- package/src/components/Radio/Radio.stories.mdx +57 -46
- package/src/components/Radio/Radio.test.tsx +92 -138
- package/src/components/Radio/Radio.tsx +70 -69
- package/src/components/Radio/__snapshots__/Radio.test.tsx.snap +250 -0
- package/src/components/RadioGroup/RadioGroup.stories.mdx +247 -0
- package/src/components/RadioGroup/RadioGroup.test.tsx +327 -0
- package/src/components/RadioGroup/RadioGroup.tsx +154 -0
- package/src/components/RadioGroup/RadioGroupLayoutTypes.tsx +4 -0
- package/src/components/RadioGroup/__snapshots__/RadioGroup.test.tsx.snap +1101 -0
- package/src/components/SearchBar/SearchBar.Test.tsx +151 -16
- package/src/components/SearchBar/SearchBar.stories.mdx +196 -224
- package/src/components/SearchBar/SearchBar.tsx +151 -46
- package/src/components/Select/Select.stories.mdx +193 -168
- package/src/components/Select/Select.test.tsx +129 -324
- package/src/components/Select/Select.tsx +120 -160
- package/src/components/Select/SelectTypes.tsx +4 -0
- package/src/components/SkeletonLoader/SkeletonLoader.stories.mdx +18 -29
- package/src/components/SkeletonLoader/SkeletonLoader.test.tsx +7 -7
- package/src/components/SkeletonLoader/SkeletonLoader.tsx +4 -2
- package/src/components/SkeletonLoader/SkeletonLoaderTypes.tsx +2 -2
- package/src/components/SkeletonLoader/_SkeletonLoader.scss +3 -3
- package/src/components/StatusBadge/StatusBadge.stories.mdx +91 -0
- package/src/components/StatusBadge/StatusBadge.test.tsx +35 -7
- package/src/components/StatusBadge/StatusBadge.tsx +24 -25
- package/src/components/StatusBadge/StatusBadgeTypes.tsx +5 -0
- package/src/components/StatusBadge/__snapshots__/StatusBadge.test.tsx.snap +28 -0
- package/src/components/StyleGuide/Bidirectionality.stories.mdx +112 -90
- package/src/components/StyleGuide/Buttons.stories.mdx +98 -100
- package/src/components/StyleGuide/Colors.stories.mdx +336 -0
- package/src/components/StyleGuide/Forms.stories.mdx +85 -0
- package/src/components/StyleGuide/Iconography.stories.mdx +86 -93
- package/src/components/StyleGuide/Spacing.stories.mdx +0 -1
- package/src/components/StyleGuide/Typography.stories.mdx +164 -166
- package/src/components/StyleGuide/UIDocCard.tsx +4 -4
- package/src/components/Tabs/Tabs.stories.mdx +221 -0
- package/src/components/Tabs/Tabs.test.tsx +264 -0
- package/src/components/Tabs/Tabs.tsx +220 -0
- package/src/components/Template/Template.stories.mdx +574 -0
- package/src/components/Template/Template.test.tsx +124 -0
- package/src/components/Template/Template.tsx +226 -0
- package/src/components/Text/Text.stories.mdx +70 -0
- package/src/components/Text/Text.test.tsx +63 -0
- package/src/components/Text/Text.tsx +55 -0
- package/src/components/Text/TextTypes.tsx +6 -0
- package/src/components/Text/__snapshots__/Text.test.tsx.snap +33 -0
- package/src/components/TextInput/TextInput.stories.mdx +90 -90
- package/src/components/TextInput/TextInput.test.tsx +103 -83
- package/src/components/TextInput/TextInput.tsx +108 -91
- package/src/components/TextInput/TextInputTypes.tsx +6 -0
- package/src/components/VideoPlayer/VideoPlayer.stories.mdx +2 -1
- package/src/components/VideoPlayer/VideoPlayer.tsx +4 -2
- package/src/components/VideoPlayer/_VideoPlayer.scss +1 -1
- package/src/docs/Chakra.stories.mdx +341 -0
- package/src/docs/Intro.stories.mdx +31 -24
- package/src/index.ts +70 -5
- package/src/styles/01-colors/_colors-brand.scss +6 -4
- package/src/styles/01-colors/_colors-utility.scss +14 -15
- package/src/styles/03-space/_space-inline.scss +47 -7
- package/src/styles/03-space/_space-inset.scss +33 -5
- package/src/styles/03-space/_space-stack.scss +48 -8
- package/src/styles/base/_02-breakpoints.scss +5 -4
- package/src/styles/base/_04-base.scss +2 -1
- package/src/styles/base/_place-holder.scss +1 -1
- package/src/styles/base/_typography.scss +1 -29
- package/src/styles.scss +22 -25
- package/src/theme/components/accordion.ts +30 -0
- package/src/theme/components/breadcrumb.ts +77 -0
- package/src/theme/components/button.ts +125 -0
- package/src/theme/components/checkbox.ts +107 -0
- package/src/theme/components/customCheckboxGroup.ts +12 -0
- package/src/theme/components/customRadioGroup.ts +12 -0
- package/src/theme/components/global.ts +71 -0
- package/src/theme/components/globalMixins.ts +16 -0
- package/src/theme/components/heading.ts +72 -0
- package/src/theme/components/hero.ts +239 -0
- package/src/theme/components/icon.ts +79 -0
- package/src/theme/components/label.ts +17 -0
- package/src/theme/components/link.ts +47 -0
- package/src/theme/components/radio.ts +106 -0
- package/src/theme/components/searchBar.ts +21 -0
- package/src/theme/components/select.ts +50 -0
- package/src/theme/components/statusBadge.ts +27 -0
- package/src/theme/components/tabs.ts +79 -0
- package/src/theme/components/template.ts +114 -0
- package/src/theme/components/text.ts +31 -0
- package/src/theme/components/textInput.ts +61 -0
- package/src/theme/foundations/breakpoints.ts +24 -0
- package/src/theme/foundations/colors.ts +208 -0
- package/src/theme/foundations/global.ts +26 -0
- package/src/theme/foundations/shadows.ts +5 -0
- package/src/theme/foundations/spacing.ts +85 -0
- package/src/theme/foundations/typography.ts +35 -0
- package/src/theme/index.ts +88 -0
- package/src/theme/provider.tsx +9 -0
- package/src/theme/types.ts +1 -0
- package/src/utils/componentCategories.ts +56 -21
- package/src/utils/utils.ts +13 -0
- package/dist/components/Accordion/Accordion.stories.d.ts +0 -5
- package/dist/components/Card/Card.stories.d.ts +0 -27
- package/dist/components/Label/Label.stories.d.ts +0 -12
- package/dist/components/StatusBadge/StatusBadge.stories.d.ts +0 -8
- package/dist/components/Template/Template.stories.d.ts +0 -29
- package/src/components/Accordion/Accordion.stories.tsx +0 -65
- package/src/components/Accordion/_Accordion.scss +0 -81
- package/src/components/Breadcrumbs/_Breadcrumbs.scss +0 -97
- package/src/components/Checkbox/_Checkbox.scss +0 -97
- package/src/components/Form/_Form.scss +0 -28
- package/src/components/Heading/_Heading.scss +0 -163
- package/src/components/Hero/_Hero.scss +0 -256
- package/src/components/Icons/_Icons.scss +0 -116
- package/src/components/Label/Label.stories.tsx +0 -30
- package/src/components/Label/_Label.scss +0 -22
- package/src/components/Link/_Link.scss +0 -73
- package/src/components/Radio/_Radio.scss +0 -84
- package/src/components/SearchBar/_SearchBar.scss +0 -16
- package/src/components/Select/_Select.scss +0 -82
- package/src/components/StatusBadge/StatusBadge.stories.tsx +0 -33
- package/src/components/StatusBadge/_StatusBadge.scss +0 -23
- package/src/components/StyleGuide/Colors.stories.tsx +0 -288
- package/src/components/Template/Template.stories.tsx +0 -85
- package/src/components/Template/_Template.scss +0 -63
- package/src/components/TextInput/_TextInput.scss +0 -59
|
@@ -1,181 +1,239 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { render } from "@testing-library/react";
|
|
2
|
+
import { render, screen } from "@testing-library/react";
|
|
3
3
|
import { axe } from "jest-axe";
|
|
4
|
+
import renderer from "react-test-renderer";
|
|
4
5
|
|
|
5
6
|
import Image from "../Image/Image";
|
|
6
7
|
import Heading from "../Heading/Heading";
|
|
8
|
+
import { HeadingLevels } from "../Heading/HeadingTypes";
|
|
7
9
|
import { HeroTypes } from "./HeroTypes";
|
|
8
10
|
import Hero from "./Hero";
|
|
9
11
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
12
|
+
export const subHeaderText = (
|
|
13
|
+
<>
|
|
14
|
+
Explore our collection of hundreds of online resources and databases. Use
|
|
15
|
+
our free online content to help with your research, whether it's finding a
|
|
16
|
+
single article, tracing a family tree, learning a new language, or anything
|
|
17
|
+
in between.
|
|
18
|
+
</>
|
|
19
|
+
);
|
|
20
|
+
export const otherSubHeaderText =
|
|
21
|
+
"With 92 locations across the Bronx, Manhattan, and Staten Island, The New York Public Library is an essential part of neighborhoods across the city. Visit us today.";
|
|
22
|
+
export const image = (
|
|
23
|
+
<Image src="https://placeimg.com/800/400/animals" alt="Image example" />
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
describe("Hero", () => {
|
|
27
|
+
describe("axe accessbility tests", () => {
|
|
28
|
+
it("passes for type Primary", async () => {
|
|
29
|
+
const { container } = render(
|
|
30
|
+
<Hero
|
|
31
|
+
heroType={HeroTypes.Primary}
|
|
32
|
+
heading={
|
|
33
|
+
<Heading
|
|
34
|
+
level={HeadingLevels.One}
|
|
35
|
+
id="a11y-hero"
|
|
36
|
+
text="Hero Primary"
|
|
37
|
+
/>
|
|
38
|
+
}
|
|
39
|
+
subHeaderText="Example Subtitle"
|
|
40
|
+
backgroundImageSrc="https://placeimg.com/1600/800/arch"
|
|
41
|
+
/>
|
|
42
|
+
);
|
|
43
|
+
expect(await axe(container)).toHaveNoViolations();
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
it("passes for type Secondary", async () => {
|
|
47
|
+
const { container } = render(
|
|
48
|
+
<Hero
|
|
49
|
+
heroType={HeroTypes.Secondary}
|
|
50
|
+
heading={
|
|
51
|
+
<Heading
|
|
52
|
+
level={HeadingLevels.One}
|
|
53
|
+
id="a11y-hero"
|
|
54
|
+
text="Hero Secondary"
|
|
55
|
+
/>
|
|
56
|
+
}
|
|
57
|
+
subHeaderText={subHeaderText}
|
|
58
|
+
image={image}
|
|
59
|
+
/>
|
|
60
|
+
);
|
|
61
|
+
expect(await axe(container)).toHaveNoViolations();
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it("passes for type Tertiary", async () => {
|
|
65
|
+
const { container } = render(
|
|
66
|
+
<Hero
|
|
67
|
+
heroType={HeroTypes.Tertiary}
|
|
68
|
+
heading={
|
|
69
|
+
<Heading
|
|
70
|
+
level={HeadingLevels.One}
|
|
71
|
+
id="a11y-hero"
|
|
72
|
+
text="Hero Tertiary"
|
|
73
|
+
/>
|
|
74
|
+
}
|
|
75
|
+
subHeaderText={otherSubHeaderText}
|
|
76
|
+
/>
|
|
77
|
+
);
|
|
78
|
+
expect(await axe(container)).toHaveNoViolations();
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
it("passes for type Campaign", async () => {
|
|
82
|
+
const { container } = render(
|
|
83
|
+
<Hero
|
|
84
|
+
heroType={HeroTypes.Campaign}
|
|
85
|
+
heading={
|
|
86
|
+
<Heading
|
|
87
|
+
level={HeadingLevels.One}
|
|
88
|
+
id="a11y-hero"
|
|
89
|
+
text="Hero Campaign"
|
|
90
|
+
/>
|
|
91
|
+
}
|
|
92
|
+
subHeaderText={otherSubHeaderText}
|
|
93
|
+
backgroundImageSrc="https://placeimg.com/2400/800/nature/grayscale"
|
|
94
|
+
image={image}
|
|
95
|
+
/>
|
|
96
|
+
);
|
|
97
|
+
expect(await axe(container)).toHaveNoViolations();
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
it("passes for type FiftyFifty", async () => {
|
|
101
|
+
const { container } = render(
|
|
102
|
+
<Hero
|
|
103
|
+
heroType={HeroTypes.FiftyFifty}
|
|
104
|
+
subHeaderText={otherSubHeaderText}
|
|
105
|
+
image={image}
|
|
106
|
+
/>
|
|
107
|
+
);
|
|
108
|
+
expect(await axe(container)).toHaveNoViolations();
|
|
109
|
+
});
|
|
27
110
|
});
|
|
28
111
|
|
|
29
|
-
it("renders Primary Hero
|
|
30
|
-
|
|
112
|
+
it("renders Primary Hero", () => {
|
|
113
|
+
render(
|
|
31
114
|
<Hero
|
|
32
115
|
heroType={HeroTypes.Primary}
|
|
33
116
|
heading={
|
|
34
117
|
<Heading
|
|
35
|
-
level={
|
|
118
|
+
level={HeadingLevels.One}
|
|
36
119
|
id="primary-hero"
|
|
37
120
|
text="Hero Primary"
|
|
38
|
-
blockName="hero"
|
|
39
121
|
/>
|
|
40
122
|
}
|
|
123
|
+
subHeaderText="Example Subtitle"
|
|
41
124
|
backgroundImageSrc="https://placeimg.com/1600/800/arch"
|
|
42
125
|
/>
|
|
43
126
|
);
|
|
44
|
-
|
|
45
|
-
expect(
|
|
127
|
+
|
|
128
|
+
expect(screen.getByText("Hero Primary")).toBeInTheDocument();
|
|
129
|
+
expect(screen.getByText("Example Subtitle")).toBeInTheDocument();
|
|
130
|
+
expect(screen.getByTestId("hero")).toHaveAttribute(
|
|
46
131
|
"style",
|
|
47
132
|
"background-image: url(https://placeimg.com/1600/800/arch);"
|
|
48
133
|
);
|
|
49
134
|
});
|
|
50
135
|
|
|
51
|
-
it("renders Secondary Hero
|
|
52
|
-
|
|
136
|
+
it("renders Secondary Hero", () => {
|
|
137
|
+
render(
|
|
53
138
|
<Hero
|
|
54
139
|
heroType={HeroTypes.Secondary}
|
|
55
140
|
heading={
|
|
56
141
|
<Heading
|
|
57
|
-
level={
|
|
142
|
+
level={HeadingLevels.One}
|
|
58
143
|
id="secondary-hero"
|
|
59
144
|
text="Hero Secondary"
|
|
60
|
-
blockName="hero"
|
|
61
|
-
/>
|
|
62
|
-
}
|
|
63
|
-
image={
|
|
64
|
-
<Image
|
|
65
|
-
src="https://placeimg.com/800/400/arch"
|
|
66
|
-
blockName="hero"
|
|
67
|
-
alt="Image alt text."
|
|
68
145
|
/>
|
|
69
146
|
}
|
|
147
|
+
subHeaderText={subHeaderText}
|
|
148
|
+
image={image}
|
|
70
149
|
/>
|
|
71
150
|
);
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
).toBeInTheDocument();
|
|
75
|
-
expect(
|
|
151
|
+
|
|
152
|
+
expect(screen.getByText("Hero Secondary")).toBeInTheDocument();
|
|
153
|
+
expect(screen.getByText(/Explore our collection of/i)).toBeInTheDocument();
|
|
154
|
+
expect(screen.getByRole("img")).toBeInTheDocument();
|
|
155
|
+
expect(screen.getByRole("img")).toHaveAttribute(
|
|
76
156
|
"src",
|
|
77
|
-
"https://placeimg.com/800/400/
|
|
157
|
+
"https://placeimg.com/800/400/animals"
|
|
78
158
|
);
|
|
79
159
|
});
|
|
80
160
|
|
|
81
|
-
it("renders Tertiary Hero
|
|
82
|
-
|
|
161
|
+
it("renders Tertiary Hero", () => {
|
|
162
|
+
render(
|
|
83
163
|
<Hero
|
|
84
164
|
heroType={HeroTypes.Tertiary}
|
|
85
165
|
heading={
|
|
86
166
|
<Heading
|
|
87
|
-
level={
|
|
167
|
+
level={HeadingLevels.One}
|
|
88
168
|
id="tertiary-hero"
|
|
89
169
|
text="Hero Tertiary"
|
|
90
|
-
blockName="hero"
|
|
91
170
|
/>
|
|
92
171
|
}
|
|
172
|
+
subHeaderText={otherSubHeaderText}
|
|
93
173
|
/>
|
|
94
174
|
);
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
).toBeInTheDocument();
|
|
98
|
-
expect(
|
|
99
|
-
utils.container.querySelector(".hero--tertiary")
|
|
100
|
-
).not.toHaveAttribute("style");
|
|
101
|
-
expect(
|
|
102
|
-
utils.container.querySelector(".hero__image ")
|
|
103
|
-
).not.toBeInTheDocument();
|
|
175
|
+
|
|
176
|
+
expect(screen.getByText("Hero Tertiary")).toBeInTheDocument();
|
|
177
|
+
expect(screen.getByText(/With 92 locations across/i)).toBeInTheDocument();
|
|
178
|
+
expect(screen.queryByRole("img")).not.toBeInTheDocument();
|
|
104
179
|
});
|
|
105
180
|
|
|
106
|
-
it("renders
|
|
107
|
-
|
|
181
|
+
it("renders Campaign Hero", () => {
|
|
182
|
+
render(
|
|
108
183
|
<Hero
|
|
109
|
-
heroType={HeroTypes.
|
|
184
|
+
heroType={HeroTypes.Campaign}
|
|
110
185
|
heading={
|
|
111
186
|
<Heading
|
|
112
|
-
level={
|
|
113
|
-
id="
|
|
114
|
-
text="Hero
|
|
115
|
-
blockName="hero"
|
|
116
|
-
/>
|
|
117
|
-
}
|
|
118
|
-
image={
|
|
119
|
-
<Image
|
|
120
|
-
src="https://placeimg.com/600/200/arch"
|
|
121
|
-
blockName="hero"
|
|
122
|
-
alt="Image alt text."
|
|
187
|
+
level={HeadingLevels.One}
|
|
188
|
+
id="campaign-hero"
|
|
189
|
+
text="Hero Campaign"
|
|
123
190
|
/>
|
|
124
191
|
}
|
|
192
|
+
subHeaderText={otherSubHeaderText}
|
|
193
|
+
backgroundImageSrc="https://placeimg.com/2400/800/nature/grayscale"
|
|
194
|
+
image={image}
|
|
125
195
|
/>
|
|
126
196
|
);
|
|
127
|
-
|
|
128
|
-
expect(
|
|
197
|
+
|
|
198
|
+
expect(screen.getByText("Hero Campaign")).toBeInTheDocument();
|
|
199
|
+
expect(screen.getByText(/With 92 locations across/i)).toBeInTheDocument();
|
|
200
|
+
expect(screen.getByTestId("hero")).toHaveAttribute(
|
|
201
|
+
"style",
|
|
202
|
+
"background-image: url(https://placeimg.com/2400/800/nature/grayscale);"
|
|
203
|
+
);
|
|
204
|
+
expect(screen.getByRole("img")).toBeInTheDocument();
|
|
205
|
+
expect(screen.getByRole("img")).toHaveAttribute(
|
|
129
206
|
"src",
|
|
130
|
-
"https://placeimg.com/
|
|
207
|
+
"https://placeimg.com/800/400/animals"
|
|
131
208
|
);
|
|
132
209
|
});
|
|
133
210
|
|
|
134
|
-
it("renders
|
|
135
|
-
|
|
211
|
+
it("renders Fifty-Fifty Hero", () => {
|
|
212
|
+
render(
|
|
136
213
|
<Hero
|
|
137
|
-
heroType={HeroTypes.
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
level={1}
|
|
141
|
-
id="campaign-hero"
|
|
142
|
-
text="Hero campaign"
|
|
143
|
-
blockName="hero"
|
|
144
|
-
/>
|
|
145
|
-
}
|
|
146
|
-
backgroundImageSrc="https://placeimg.com/1600/800/arch"
|
|
147
|
-
image={
|
|
148
|
-
<Image
|
|
149
|
-
src="https://placeimg.com/800/400/arch"
|
|
150
|
-
blockName="hero"
|
|
151
|
-
alt="Image alt text."
|
|
152
|
-
/>
|
|
153
|
-
}
|
|
214
|
+
heroType={HeroTypes.FiftyFifty}
|
|
215
|
+
subHeaderText={otherSubHeaderText}
|
|
216
|
+
image={image}
|
|
154
217
|
/>
|
|
155
218
|
);
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
).toBeInTheDocument();
|
|
159
|
-
expect(
|
|
160
|
-
"style",
|
|
161
|
-
"background-image: url(https://placeimg.com/1600/800/arch);"
|
|
162
|
-
);
|
|
163
|
-
expect(utils.container.querySelector(".hero__image ")).toHaveAttribute(
|
|
219
|
+
|
|
220
|
+
expect(screen.getByText(/With 92 locations across/i)).toBeInTheDocument();
|
|
221
|
+
expect(screen.getByRole("img")).toBeInTheDocument();
|
|
222
|
+
expect(screen.getByRole("img")).toHaveAttribute(
|
|
164
223
|
"src",
|
|
165
|
-
"https://placeimg.com/800/400/
|
|
224
|
+
"https://placeimg.com/800/400/animals"
|
|
166
225
|
);
|
|
167
226
|
});
|
|
168
227
|
|
|
169
|
-
it("renders custom background and foreground colors", () => {
|
|
170
|
-
const
|
|
228
|
+
it("renders custom background and foreground colors for all but the Secondary type", () => {
|
|
229
|
+
const { rerender } = render(
|
|
171
230
|
<Hero
|
|
172
231
|
heroType={HeroTypes.Primary}
|
|
173
232
|
heading={
|
|
174
233
|
<Heading
|
|
175
|
-
level={
|
|
234
|
+
level={HeadingLevels.One}
|
|
176
235
|
id="custom-colors-hero"
|
|
177
|
-
text="Hero with
|
|
178
|
-
blockName="hero"
|
|
236
|
+
text="Hero with Custom Colors"
|
|
179
237
|
/>
|
|
180
238
|
}
|
|
181
239
|
backgroundImageSrc="https://placeimg.com/1600/800/arch"
|
|
@@ -183,26 +241,399 @@ describe("Hero Component", () => {
|
|
|
183
241
|
backgroundColor="#654321"
|
|
184
242
|
/>
|
|
185
243
|
);
|
|
186
|
-
|
|
244
|
+
|
|
245
|
+
expect(screen.getByTestId("hero-content")).toHaveAttribute(
|
|
187
246
|
"style",
|
|
188
247
|
"color: rgb(18, 52, 86); background-color: rgb(101, 67, 33);"
|
|
189
248
|
);
|
|
190
|
-
});
|
|
191
249
|
|
|
192
|
-
|
|
193
|
-
const utils = render(
|
|
250
|
+
rerender(
|
|
194
251
|
<Hero
|
|
195
|
-
heroType={HeroTypes.
|
|
252
|
+
heroType={HeroTypes.FiftyFifty}
|
|
253
|
+
subHeaderText={otherSubHeaderText}
|
|
254
|
+
image={image}
|
|
255
|
+
foregroundColor="#123456"
|
|
256
|
+
backgroundColor="#654321"
|
|
257
|
+
/>
|
|
258
|
+
);
|
|
259
|
+
|
|
260
|
+
expect(screen.getByTestId("hero-content")).toHaveAttribute(
|
|
261
|
+
"style",
|
|
262
|
+
"color: rgb(18, 52, 86); background-color: rgb(101, 67, 33);"
|
|
263
|
+
);
|
|
264
|
+
|
|
265
|
+
rerender(
|
|
266
|
+
<Hero
|
|
267
|
+
heroType={HeroTypes.Secondary}
|
|
196
268
|
heading={
|
|
197
269
|
<Heading
|
|
198
|
-
level={
|
|
199
|
-
id="hero
|
|
200
|
-
text="Hero
|
|
201
|
-
blockName="hero"
|
|
270
|
+
level={HeadingLevels.One}
|
|
271
|
+
id="secondary-hero"
|
|
272
|
+
text="Hero Secondary"
|
|
202
273
|
/>
|
|
203
274
|
}
|
|
275
|
+
subHeaderText={subHeaderText}
|
|
276
|
+
image={image}
|
|
277
|
+
foregroundColor="#123456"
|
|
278
|
+
backgroundColor="#654321"
|
|
204
279
|
/>
|
|
205
280
|
);
|
|
206
|
-
|
|
281
|
+
|
|
282
|
+
expect(screen.getByTestId("hero-content")).not.toHaveAttribute(
|
|
283
|
+
"style",
|
|
284
|
+
"color: rgb(18, 52, 86); background-color: rgb(101, 67, 33);"
|
|
285
|
+
);
|
|
286
|
+
});
|
|
287
|
+
|
|
288
|
+
it("renders Primary Hero with warnings in browser console", () => {
|
|
289
|
+
const warn = jest.spyOn(console, "warn");
|
|
290
|
+
const heading = (
|
|
291
|
+
<Heading
|
|
292
|
+
level={HeadingLevels.One}
|
|
293
|
+
id="hero-errors"
|
|
294
|
+
text="Hero with Error Warnings"
|
|
295
|
+
/>
|
|
296
|
+
);
|
|
297
|
+
const { rerender } = render(
|
|
298
|
+
<Hero heroType={HeroTypes.Primary} heading={heading} />
|
|
299
|
+
);
|
|
300
|
+
expect(warn).toHaveBeenCalledWith(
|
|
301
|
+
`Warning: it is recommended to use the "backgroundImageSrc" prop for PRIMARY hero.`
|
|
302
|
+
);
|
|
303
|
+
|
|
304
|
+
rerender(
|
|
305
|
+
<Hero
|
|
306
|
+
heroType={HeroTypes.Primary}
|
|
307
|
+
heading={heading}
|
|
308
|
+
backgroundImageSrc="https://placeimg.com/1600/800/arch"
|
|
309
|
+
image={image}
|
|
310
|
+
/>
|
|
311
|
+
);
|
|
312
|
+
expect(warn).toHaveBeenCalledWith(
|
|
313
|
+
`Warning: the "image" prop has been passed, but PRIMARY hero will not use it.`
|
|
314
|
+
);
|
|
315
|
+
});
|
|
316
|
+
|
|
317
|
+
it("renders Secondary Hero with warnings in browser console", () => {
|
|
318
|
+
const warn = jest.spyOn(console, "warn");
|
|
319
|
+
const heading = (
|
|
320
|
+
<Heading
|
|
321
|
+
level={HeadingLevels.One}
|
|
322
|
+
id="hero-errors"
|
|
323
|
+
text="Hero with Error Warnings"
|
|
324
|
+
/>
|
|
325
|
+
);
|
|
326
|
+
const { rerender } = render(
|
|
327
|
+
<Hero
|
|
328
|
+
heroType={HeroTypes.Secondary}
|
|
329
|
+
heading={heading}
|
|
330
|
+
subHeaderText={subHeaderText}
|
|
331
|
+
image={image}
|
|
332
|
+
locationDetails={<>Some location details.</>}
|
|
333
|
+
/>
|
|
334
|
+
);
|
|
335
|
+
expect(warn).toHaveBeenCalledWith(
|
|
336
|
+
`Warning: Please provide "locationDetails" only to PRIMARY hero.`
|
|
337
|
+
);
|
|
338
|
+
|
|
339
|
+
rerender(
|
|
340
|
+
<Hero
|
|
341
|
+
heroType={HeroTypes.Secondary}
|
|
342
|
+
heading={heading}
|
|
343
|
+
subHeaderText={subHeaderText}
|
|
344
|
+
image={image}
|
|
345
|
+
backgroundImageSrc="https://placeimg.com/1600/800/arch"
|
|
346
|
+
/>
|
|
347
|
+
);
|
|
348
|
+
expect(warn).toHaveBeenCalledWith(
|
|
349
|
+
`Warning: the "backgroundImageSrc" prop has been passed, but SECONDARY hero will not use it.`
|
|
350
|
+
);
|
|
351
|
+
|
|
352
|
+
rerender(
|
|
353
|
+
<Hero
|
|
354
|
+
heroType={HeroTypes.Secondary}
|
|
355
|
+
heading={heading}
|
|
356
|
+
subHeaderText={subHeaderText}
|
|
357
|
+
image={image}
|
|
358
|
+
foregroundColor="#123456"
|
|
359
|
+
backgroundColor="#654321"
|
|
360
|
+
/>
|
|
361
|
+
);
|
|
362
|
+
expect(warn).toHaveBeenCalledWith(
|
|
363
|
+
`Warning: the "foregroundColor" and/or "backgroundColor" props have been passed, but SECONDARY Hero will not use them.`
|
|
364
|
+
);
|
|
365
|
+
});
|
|
366
|
+
|
|
367
|
+
it("renders Tertiary Hero with warnings in browser console", () => {
|
|
368
|
+
const warn = jest.spyOn(console, "warn");
|
|
369
|
+
const heading = (
|
|
370
|
+
<Heading
|
|
371
|
+
level={HeadingLevels.One}
|
|
372
|
+
id="hero-errors"
|
|
373
|
+
text="Hero with Error Warnings"
|
|
374
|
+
/>
|
|
375
|
+
);
|
|
376
|
+
const { rerender } = render(
|
|
377
|
+
<Hero
|
|
378
|
+
heroType={HeroTypes.Tertiary}
|
|
379
|
+
heading={heading}
|
|
380
|
+
subHeaderText={otherSubHeaderText}
|
|
381
|
+
locationDetails={<>Some location details.</>}
|
|
382
|
+
/>
|
|
383
|
+
);
|
|
384
|
+
expect(warn).toHaveBeenCalledWith(
|
|
385
|
+
`Warning: Please provide "locationDetails" only to PRIMARY hero.`
|
|
386
|
+
);
|
|
387
|
+
|
|
388
|
+
rerender(
|
|
389
|
+
<Hero
|
|
390
|
+
heroType={HeroTypes.Tertiary}
|
|
391
|
+
heading={heading}
|
|
392
|
+
subHeaderText={otherSubHeaderText}
|
|
393
|
+
image={image}
|
|
394
|
+
/>
|
|
395
|
+
);
|
|
396
|
+
expect(warn).toHaveBeenCalledWith(
|
|
397
|
+
`Warning: TERTIARY hero will not use any of the image props.`
|
|
398
|
+
);
|
|
399
|
+
|
|
400
|
+
rerender(
|
|
401
|
+
<Hero
|
|
402
|
+
heroType={HeroTypes.Tertiary}
|
|
403
|
+
heading={heading}
|
|
404
|
+
subHeaderText={otherSubHeaderText}
|
|
405
|
+
backgroundImageSrc="https://placeimg.com/1600/800/arch"
|
|
406
|
+
/>
|
|
407
|
+
);
|
|
408
|
+
expect(warn).toHaveBeenCalledWith(
|
|
409
|
+
`Warning: TERTIARY hero will not use any of the image props.`
|
|
410
|
+
);
|
|
411
|
+
});
|
|
412
|
+
|
|
413
|
+
it("renders Campaign Hero with warnings in browser console", () => {
|
|
414
|
+
const warn = jest.spyOn(console, "warn");
|
|
415
|
+
const heading = (
|
|
416
|
+
<Heading
|
|
417
|
+
level={HeadingLevels.One}
|
|
418
|
+
id="hero-errors"
|
|
419
|
+
text="Hero with Error Warnings"
|
|
420
|
+
/>
|
|
421
|
+
);
|
|
422
|
+
const { rerender } = render(
|
|
423
|
+
<Hero
|
|
424
|
+
heroType={HeroTypes.Campaign}
|
|
425
|
+
heading={heading}
|
|
426
|
+
subHeaderText={otherSubHeaderText}
|
|
427
|
+
backgroundImageSrc="https://placeimg.com/2400/800/nature/grayscale"
|
|
428
|
+
image={image}
|
|
429
|
+
locationDetails={<>Some location details.</>}
|
|
430
|
+
/>
|
|
431
|
+
);
|
|
432
|
+
expect(warn).toHaveBeenCalledWith(
|
|
433
|
+
`Warning: Please provide "locationDetails" only to PRIMARY hero.`
|
|
434
|
+
);
|
|
435
|
+
|
|
436
|
+
rerender(
|
|
437
|
+
<Hero
|
|
438
|
+
heroType={HeroTypes.Campaign}
|
|
439
|
+
heading={heading}
|
|
440
|
+
subHeaderText={otherSubHeaderText}
|
|
441
|
+
image={image}
|
|
442
|
+
locationDetails={<>Some location details.</>}
|
|
443
|
+
/>
|
|
444
|
+
);
|
|
445
|
+
expect(warn).toHaveBeenCalledWith(
|
|
446
|
+
`Warning: it is recommended to use both "backgroundImageSrc" and "image" props for CAMPAIGN hero.`
|
|
447
|
+
);
|
|
448
|
+
|
|
449
|
+
rerender(
|
|
450
|
+
<Hero
|
|
451
|
+
heroType={HeroTypes.Campaign}
|
|
452
|
+
heading={heading}
|
|
453
|
+
subHeaderText={otherSubHeaderText}
|
|
454
|
+
backgroundImageSrc="https://placeimg.com/2400/800/nature/grayscale"
|
|
455
|
+
locationDetails={<>Some location details.</>}
|
|
456
|
+
/>
|
|
457
|
+
);
|
|
458
|
+
expect(warn).toHaveBeenCalledWith(
|
|
459
|
+
`Warning: it is recommended to use both "backgroundImageSrc" and "image" props for CAMPAIGN hero.`
|
|
460
|
+
);
|
|
461
|
+
});
|
|
462
|
+
|
|
463
|
+
it("renders FiftyFifty Hero with warnings in browser console", () => {
|
|
464
|
+
const warn = jest.spyOn(console, "warn");
|
|
465
|
+
const { rerender } = render(
|
|
466
|
+
<Hero
|
|
467
|
+
heroType={HeroTypes.FiftyFifty}
|
|
468
|
+
subHeaderText={otherSubHeaderText}
|
|
469
|
+
image={image}
|
|
470
|
+
locationDetails={<>Some location details.</>}
|
|
471
|
+
/>
|
|
472
|
+
);
|
|
473
|
+
expect(warn).toHaveBeenCalledWith(
|
|
474
|
+
`Warning: Please provide "locationDetails" only to PRIMARY hero.`
|
|
475
|
+
);
|
|
476
|
+
|
|
477
|
+
rerender(
|
|
478
|
+
<Hero
|
|
479
|
+
heroType={HeroTypes.FiftyFifty}
|
|
480
|
+
subHeaderText={otherSubHeaderText}
|
|
481
|
+
image={image}
|
|
482
|
+
backgroundImageSrc="https://placeimg.com/2400/800/nature/grayscale"
|
|
483
|
+
/>
|
|
484
|
+
);
|
|
485
|
+
expect(warn).toHaveBeenCalledWith(
|
|
486
|
+
`Warning: the "backgroundImageSrc" prop has been passed, but FIFTYFIFTY hero will not use it.`
|
|
487
|
+
);
|
|
488
|
+
});
|
|
489
|
+
|
|
490
|
+
it("Renders the UI snapshot correctly", () => {
|
|
491
|
+
const primary = renderer
|
|
492
|
+
.create(
|
|
493
|
+
<Hero
|
|
494
|
+
heroType={HeroTypes.Primary}
|
|
495
|
+
heading={
|
|
496
|
+
<Heading
|
|
497
|
+
level={HeadingLevels.One}
|
|
498
|
+
id="primary-hero"
|
|
499
|
+
text="Hero Primary"
|
|
500
|
+
/>
|
|
501
|
+
}
|
|
502
|
+
subHeaderText="Example Subtitle"
|
|
503
|
+
backgroundImageSrc="https://placeimg.com/1600/800/arch"
|
|
504
|
+
/>
|
|
505
|
+
)
|
|
506
|
+
.toJSON();
|
|
507
|
+
const secondary = renderer
|
|
508
|
+
.create(
|
|
509
|
+
<Hero
|
|
510
|
+
heroType={HeroTypes.Secondary}
|
|
511
|
+
heading={
|
|
512
|
+
<Heading
|
|
513
|
+
level={HeadingLevels.One}
|
|
514
|
+
id="secondary-hero"
|
|
515
|
+
text="Hero Secondary"
|
|
516
|
+
/>
|
|
517
|
+
}
|
|
518
|
+
subHeaderText={subHeaderText}
|
|
519
|
+
image={image}
|
|
520
|
+
/>
|
|
521
|
+
)
|
|
522
|
+
.toJSON();
|
|
523
|
+
const secondaryBooksAndMore = renderer
|
|
524
|
+
.create(
|
|
525
|
+
<Hero
|
|
526
|
+
heroType={HeroTypes.SecondaryBooksAndMore}
|
|
527
|
+
heading={
|
|
528
|
+
<Heading
|
|
529
|
+
level={HeadingLevels.One}
|
|
530
|
+
id="secondary-hero"
|
|
531
|
+
text="Hero Secondary Books and More"
|
|
532
|
+
/>
|
|
533
|
+
}
|
|
534
|
+
subHeaderText={subHeaderText}
|
|
535
|
+
image={image}
|
|
536
|
+
/>
|
|
537
|
+
)
|
|
538
|
+
.toJSON();
|
|
539
|
+
const secondaryLocations = renderer
|
|
540
|
+
.create(
|
|
541
|
+
<Hero
|
|
542
|
+
heroType={HeroTypes.SecondaryLocations}
|
|
543
|
+
heading={
|
|
544
|
+
<Heading
|
|
545
|
+
level={HeadingLevels.One}
|
|
546
|
+
id="secondary-hero"
|
|
547
|
+
text="Hero Secondary Locations"
|
|
548
|
+
/>
|
|
549
|
+
}
|
|
550
|
+
subHeaderText={subHeaderText}
|
|
551
|
+
image={image}
|
|
552
|
+
/>
|
|
553
|
+
)
|
|
554
|
+
.toJSON();
|
|
555
|
+
const secondaryResearch = renderer
|
|
556
|
+
.create(
|
|
557
|
+
<Hero
|
|
558
|
+
heroType={HeroTypes.SecondaryResearch}
|
|
559
|
+
heading={
|
|
560
|
+
<Heading
|
|
561
|
+
level={HeadingLevels.One}
|
|
562
|
+
id="secondary-hero"
|
|
563
|
+
text="Hero Secondary"
|
|
564
|
+
/>
|
|
565
|
+
}
|
|
566
|
+
subHeaderText={subHeaderText}
|
|
567
|
+
image={image}
|
|
568
|
+
/>
|
|
569
|
+
)
|
|
570
|
+
.toJSON();
|
|
571
|
+
const secondaryWhatsOn = renderer
|
|
572
|
+
.create(
|
|
573
|
+
<Hero
|
|
574
|
+
heroType={HeroTypes.SecondaryWhatsOn}
|
|
575
|
+
heading={
|
|
576
|
+
<Heading
|
|
577
|
+
level={HeadingLevels.One}
|
|
578
|
+
id="secondary-hero"
|
|
579
|
+
text="Hero Secondary What's On"
|
|
580
|
+
/>
|
|
581
|
+
}
|
|
582
|
+
subHeaderText={subHeaderText}
|
|
583
|
+
image={image}
|
|
584
|
+
/>
|
|
585
|
+
)
|
|
586
|
+
.toJSON();
|
|
587
|
+
const campaign = renderer
|
|
588
|
+
.create(
|
|
589
|
+
<Hero
|
|
590
|
+
heroType={HeroTypes.Campaign}
|
|
591
|
+
heading={
|
|
592
|
+
<Heading
|
|
593
|
+
level={HeadingLevels.One}
|
|
594
|
+
id="campaign-hero"
|
|
595
|
+
text="Hero Campaign"
|
|
596
|
+
/>
|
|
597
|
+
}
|
|
598
|
+
subHeaderText={otherSubHeaderText}
|
|
599
|
+
backgroundImageSrc="https://placeimg.com/2400/800/nature/grayscale"
|
|
600
|
+
image={image}
|
|
601
|
+
/>
|
|
602
|
+
)
|
|
603
|
+
.toJSON();
|
|
604
|
+
const tertiary = renderer
|
|
605
|
+
.create(
|
|
606
|
+
<Hero
|
|
607
|
+
heroType={HeroTypes.Tertiary}
|
|
608
|
+
heading={
|
|
609
|
+
<Heading
|
|
610
|
+
level={HeadingLevels.One}
|
|
611
|
+
id="tertiary-hero"
|
|
612
|
+
text="Hero Tertiary"
|
|
613
|
+
/>
|
|
614
|
+
}
|
|
615
|
+
subHeaderText={otherSubHeaderText}
|
|
616
|
+
/>
|
|
617
|
+
)
|
|
618
|
+
.toJSON();
|
|
619
|
+
const fiftyFifty = renderer
|
|
620
|
+
.create(
|
|
621
|
+
<Hero
|
|
622
|
+
heroType={HeroTypes.FiftyFifty}
|
|
623
|
+
subHeaderText={otherSubHeaderText}
|
|
624
|
+
image={image}
|
|
625
|
+
/>
|
|
626
|
+
)
|
|
627
|
+
.toJSON();
|
|
628
|
+
|
|
629
|
+
expect(primary).toMatchSnapshot();
|
|
630
|
+
expect(secondary).toMatchSnapshot();
|
|
631
|
+
expect(secondaryBooksAndMore).toMatchSnapshot();
|
|
632
|
+
expect(secondaryLocations).toMatchSnapshot();
|
|
633
|
+
expect(secondaryResearch).toMatchSnapshot();
|
|
634
|
+
expect(secondaryWhatsOn).toMatchSnapshot();
|
|
635
|
+
expect(tertiary).toMatchSnapshot();
|
|
636
|
+
expect(campaign).toMatchSnapshot();
|
|
637
|
+
expect(fiftyFifty).toMatchSnapshot();
|
|
207
638
|
});
|
|
208
639
|
});
|