@scottish-government/designsystem-react 0.5.1 → 0.7.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/.svgrrc +2 -1
- package/.svgrrc_documents +15 -0
- package/@types/common/FileIcon.d.ts +7 -0
- package/@types/components/Accordion.d.ts +2 -2
- package/@types/components/ConfirmationMessage.d.ts +1 -1
- package/@types/components/FileDownload.d.ts +11 -0
- package/@types/components/NotificationPanel.d.ts +1 -1
- package/@types/components/SummaryCard.d.ts +1 -1
- package/@types/components/Tabs.d.ts +1 -1
- package/@types/sgds.d.ts +2 -1
- package/CHANGELOG.md +81 -0
- package/README.md +4 -0
- package/dist/common/AbstractNotificationBanner.jsx +63 -0
- package/dist/common/ConditionalWrapper.jsx +8 -0
- package/dist/common/FileIcon.jsx +51 -0
- package/dist/common/HintText.jsx +9 -0
- package/dist/common/Icon.jsx +57 -0
- package/dist/common/ScreenReaderText.jsx +9 -0
- package/dist/common/WrapperTag.jsx +11 -0
- package/dist/common/file-icon.jsx +51 -0
- package/dist/common/icon.jsx +1 -1
- package/dist/components/Accordion/Accordion.jsx +102 -0
- package/dist/components/AspectBox/AspectBox.jsx +79 -0
- package/dist/components/BackToTop/BackToTop.jsx +27 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.jsx +28 -0
- package/dist/components/Button/Button.jsx +30 -0
- package/dist/components/Checkbox/Checkbox.jsx +62 -0
- package/dist/components/ConfirmationMessage/ConfirmationMessage.jsx +24 -0
- package/dist/components/ContentsNav/ContentsNav.jsx +33 -0
- package/dist/components/CookieBanner/CookieBanner.jsx +21 -0
- package/dist/components/DatePicker/DatePicker.jsx +54 -0
- package/dist/components/Details/Details.jsx +17 -0
- package/dist/components/ErrorMessage/ErrorMessage.jsx +12 -0
- package/dist/components/ErrorSummary/ErrorSummary.jsx +27 -0
- package/dist/components/FileDownload/FileDownload.jsx +50 -0
- package/dist/components/HideThisPage/HideThisPage.jsx +71 -0
- package/dist/components/InsetText/InsetText.jsx +14 -0
- package/dist/components/NotificationBanner/NotificationBanner.jsx +26 -0
- package/dist/components/NotificationPanel/NotificationPanel.jsx +21 -0
- package/dist/components/PageHeader/PageHeader.jsx +15 -0
- package/dist/components/PageMetadata/PageMetadata.jsx +26 -0
- package/dist/components/Pagination/Pagination.jsx +97 -0
- package/dist/components/PhaseBanner/PhaseBanner.jsx +23 -0
- package/dist/components/Question/Question.jsx +22 -0
- package/dist/components/RadioButton/RadioButton.jsx +43 -0
- package/dist/components/Select/Select.jsx +52 -0
- package/dist/components/SequentialNavigation/SequentialNavigation.jsx +31 -0
- package/dist/components/SideNavigation/SideNavigation.jsx +52 -0
- package/dist/components/SiteHeader/SiteHeader.jsx +68 -0
- package/dist/components/SiteNavigation/SiteNavigation.jsx +22 -0
- package/dist/components/SiteSearch/SiteSearch.jsx +55 -0
- package/dist/components/SkipLinks/SkipLinks.jsx +21 -0
- package/dist/components/SummaryCard/SummaryCard.jsx +67 -0
- package/dist/components/SummaryList/SummaryList.jsx +75 -0
- package/dist/components/Table/Table.jsx +24 -0
- package/dist/components/Tabs/Tabs.jsx +99 -0
- package/dist/components/Tag/Tag.jsx +13 -0
- package/dist/components/TaskList/TaskList.jsx +95 -0
- package/dist/components/TextInput/TextInput.jsx +58 -0
- package/dist/components/Textarea/Textarea.jsx +54 -0
- package/dist/components/WarningText/WarningText.jsx +16 -0
- package/dist/components/file-download/file-download.jsx +50 -0
- package/dist/images/documents/audio.jsx +47 -0
- package/dist/images/documents/csv.jsx +57 -0
- package/dist/images/documents/excel.jsx +57 -0
- package/dist/images/documents/file.jsx +48 -0
- package/dist/images/documents/generic.jsx +47 -0
- package/dist/images/documents/geodata.jsx +44 -0
- package/dist/images/documents/ical.jsx +48 -0
- package/dist/images/documents/ico.jsx +48 -0
- package/dist/images/documents/image.jsx +43 -0
- package/dist/images/documents/index.js +50 -0
- package/dist/images/documents/odf.jsx +46 -0
- package/dist/images/documents/odg.jsx +46 -0
- package/dist/images/documents/odp.jsx +45 -0
- package/dist/images/documents/ods.jsx +55 -0
- package/dist/images/documents/odt.jsx +46 -0
- package/dist/images/documents/pdf.jsx +48 -0
- package/dist/images/documents/ppt.jsx +47 -0
- package/dist/images/documents/rtf.jsx +48 -0
- package/dist/images/documents/text.jsx +48 -0
- package/dist/images/documents/video.jsx +47 -0
- package/dist/images/documents/word.jsx +48 -0
- package/dist/images/documents/xml.jsx +48 -0
- package/dist/images/documents/zip.jsx +48 -0
- package/dist/images/icons/arrow_upward.jsx +41 -0
- package/dist/images/icons/calendar_today.jsx +41 -0
- package/dist/images/icons/cancel.jsx +40 -0
- package/dist/images/icons/check_circle.jsx +41 -0
- package/dist/images/icons/chevron_left.jsx +41 -0
- package/dist/images/icons/chevron_right.jsx +41 -0
- package/dist/images/icons/close.jsx +41 -0
- package/dist/images/icons/description.jsx +41 -0
- package/dist/images/icons/double_chevron_left.jsx +40 -0
- package/dist/images/icons/double_chevron_right.jsx +40 -0
- package/dist/images/icons/error.jsx +41 -0
- package/dist/images/icons/expand_less.jsx +41 -0
- package/dist/images/icons/expand_more.jsx +41 -0
- package/dist/images/icons/index.js +40 -0
- package/dist/images/icons/list.jsx +44 -0
- package/dist/images/icons/menu.jsx +41 -0
- package/dist/images/icons/priority_high.jsx +42 -0
- package/dist/images/icons/search.jsx +41 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -1
- package/src/common/{abstract-notification-banner.test.tsx → AbstractNotificationBanner.test.tsx} +11 -11
- package/src/common/{abstract-notification-banner.tsx → AbstractNotificationBanner.tsx} +2 -2
- package/src/common/{conditional-wrapper.test.tsx → ConditionalWrapper.test.tsx} +1 -1
- package/src/common/FileIcon.test.tsx +50 -0
- package/src/common/FileIcon.tsx +25 -0
- package/src/common/{hint-text.test.tsx → HintText.test.tsx} +12 -12
- package/src/common/{icon.test.tsx → Icon.test.tsx} +16 -16
- package/src/common/{icon.tsx → Icon.tsx} +1 -1
- package/src/common/{screen-reader-text.test.tsx → ScreenReaderText.test.tsx} +5 -5
- package/src/common/{wrapper-tag.test.tsx → WrapperTag.test.tsx} +5 -5
- package/src/components/{accordion/accordion.test.tsx → Accordion/Accordion.test.tsx} +35 -35
- package/src/components/{accordion/accordion.tsx → Accordion/Accordion.tsx} +5 -5
- package/src/components/{aspect-box/aspect-box.test.tsx → AspectBox/AspectBox.test.tsx} +2 -2
- package/src/components/{back-to-top/back-to-top.test.tsx → BackToTop/BackToTop.test.tsx} +1 -1
- package/src/components/{back-to-top/back-to-top.tsx → BackToTop/BackToTop.tsx} +1 -1
- package/src/components/{breadcrumbs/breadcrumbs.test.tsx → Breadcrumbs/Breadcrumbs.test.tsx} +7 -7
- package/src/components/{button/button.test.tsx → Button/Button.test.tsx} +1 -1
- package/src/components/{button/button.tsx → Button/Button.tsx} +3 -3
- package/src/components/{checkbox/checkbox.test.tsx → Checkbox/Checkbox.test.tsx} +16 -16
- package/src/components/{checkbox/checkbox.tsx → Checkbox/Checkbox.tsx} +1 -1
- package/src/components/{confirmation-message/confirmation-message.test.tsx → ConfirmationMessage/ConfirmationMessage.test.tsx} +12 -14
- package/src/components/{confirmation-message/confirmation-message.tsx → ConfirmationMessage/ConfirmationMessage.tsx} +4 -4
- package/src/components/{contents-nav/contents-nav.test.tsx → ContentsNav/ContentsNav.test.tsx} +21 -28
- package/src/components/{contents-nav/contents-nav.tsx → ContentsNav/ContentsNav.tsx} +1 -1
- package/src/components/{cookie-banner/cookie-banner.test.tsx → CookieBanner/CookieBanner.test.tsx} +3 -3
- package/src/components/{cookie-banner/cookie-banner.tsx → CookieBanner/CookieBanner.tsx} +1 -1
- package/src/components/{date-picker/date-picker.test.tsx → DatePicker/DatePicker.test.tsx} +76 -66
- package/src/components/{date-picker/date-picker.tsx → DatePicker/DatePicker.tsx} +2 -2
- package/src/components/{details/details.test.tsx → Details/Details.test.tsx} +10 -10
- package/src/components/{error-message/error-message.test.tsx → ErrorMessage/ErrorMessage.test.tsx} +10 -10
- package/src/components/{error-summary/error-summary.test.tsx → ErrorSummary/ErrorSummary.test.tsx} +13 -14
- package/src/components/{error-summary/error-summary.tsx → ErrorSummary/ErrorSummary.tsx} +1 -1
- package/src/components/FileDownload/FileDownload.test.tsx +167 -0
- package/src/components/FileDownload/FileDownload.tsx +67 -0
- package/src/components/{hide-this-page/hide-this-page.test.tsx → HideThisPage/HideThisPage.test.tsx} +4 -4
- package/src/components/{hide-this-page/hide-this-page.tsx → HideThisPage/HideThisPage.tsx} +3 -3
- package/src/components/{inset-text/inset-text.test.tsx → InsetText/InsetText.test.tsx} +1 -1
- package/src/components/{notification-banner/notification-banner.test.tsx → NotificationBanner/NotificationBanner.test.tsx} +4 -4
- package/src/components/{notification-banner/notification-banner.tsx → NotificationBanner/NotificationBanner.tsx} +1 -1
- package/src/components/{notification-panel/notification-panel.test.tsx → NotificationPanel/NotificationPanel.test.tsx} +24 -23
- package/src/components/{notification-panel/notification-panel.tsx → NotificationPanel/NotificationPanel.tsx} +3 -3
- package/src/components/{page-header/page-header.test.tsx → PageHeader/PageHeader.test.tsx} +9 -9
- package/src/components/{page-metadata/page-metadata.test.tsx → PageMetadata/PageMetadata.test.tsx} +9 -9
- package/src/components/{pagination/pagination.test.tsx → Pagination/Pagination.test.tsx} +56 -56
- package/src/components/{pagination/pagination.tsx → Pagination/Pagination.tsx} +1 -1
- package/src/components/{phase-banner/phase-banner.test.tsx → PhaseBanner/PhaseBanner.test.tsx} +9 -9
- package/src/components/{phase-banner/phase-banner.tsx → PhaseBanner/PhaseBanner.tsx} +1 -1
- package/src/components/{question/question.test.tsx → Question/Question.test.tsx} +10 -10
- package/src/components/{question/question.tsx → Question/Question.tsx} +3 -3
- package/src/components/{radio-button/radio-button.test.tsx → RadioButton/RadioButton.test.tsx} +23 -23
- package/src/components/{radio-button/radio-button.tsx → RadioButton/RadioButton.tsx} +1 -1
- package/src/components/{select/select.test.tsx → Select/Select.test.tsx} +67 -64
- package/src/components/{select/select.tsx → Select/Select.tsx} +2 -2
- package/src/components/{sequential-navigation/sequential-navigation.test.tsx → SequentialNavigation/SequentialNavigation.test.tsx} +18 -18
- package/src/components/{side-navigation/side-navigation.test.tsx → SideNavigation/SideNavigation.test.tsx} +8 -8
- package/src/components/{site-header/site-header.test.tsx → SiteHeader/SiteHeader.test.tsx} +25 -25
- package/src/components/{site-header/site-header.tsx → SiteHeader/SiteHeader.tsx} +4 -4
- package/src/components/{site-navigation/site-navigation.test.tsx → SiteNavigation/SiteNavigation.test.tsx} +8 -8
- package/src/components/{site-search/site-search.test.tsx → SiteSearch/SiteSearch.test.tsx} +16 -16
- package/src/components/{site-search/site-search.tsx → SiteSearch/SiteSearch.tsx} +1 -1
- package/src/components/{skip-links/skip-links.test.tsx → SkipLinks/SkipLinks.test.tsx} +15 -15
- package/src/components/{summary-card/summary-card.test.tsx → SummaryCard/SummaryCard.test.tsx} +28 -28
- package/src/components/{summary-card/summary-card.tsx → SummaryCard/SummaryCard.tsx} +4 -4
- package/src/components/{summary-list/summary-list.test.tsx → SummaryList/SummaryList.test.tsx} +55 -56
- package/src/components/{summary-list/summary-list.tsx → SummaryList/SummaryList.tsx} +2 -2
- package/src/components/{table/table.test.tsx → Table/Table.test.tsx} +4 -4
- package/src/components/{tabs/tabs.test.tsx → Tabs/Tabs.test.tsx} +22 -42
- package/src/components/{tabs/tabs.tsx → Tabs/Tabs.tsx} +3 -3
- package/src/components/{tag/tag.test.tsx → Tag/Tag.test.tsx} +10 -10
- package/src/components/{task-list/task-list.test.tsx → TaskList/TaskList.test.tsx} +109 -108
- package/src/components/{task-list/task-list.tsx → TaskList/TaskList.tsx} +4 -4
- package/src/components/{text-input/text-input.test.tsx → TextInput/TextInput.test.tsx} +92 -87
- package/src/components/{text-input/text-input.tsx → TextInput/TextInput.tsx} +4 -4
- package/src/components/{textarea/textarea.test.tsx → Textarea/Textarea.test.tsx} +71 -67
- package/src/components/{textarea/textarea.tsx → Textarea/Textarea.tsx} +3 -3
- package/src/components/{warning-text/warning-text.test.tsx → WarningText/WarningText.test.tsx} +1 -1
- package/src/images/documents/audio.tsx +34 -0
- package/src/images/documents/csv.tsx +39 -0
- package/src/images/documents/excel.tsx +39 -0
- package/src/images/documents/file.tsx +30 -0
- package/src/images/documents/generic.tsx +26 -0
- package/src/images/documents/geodata.tsx +29 -0
- package/src/images/documents/ical.tsx +30 -0
- package/src/images/documents/ico.tsx +30 -0
- package/src/images/documents/image.tsx +25 -0
- package/src/images/documents/index.ts +22 -0
- package/src/images/documents/odf.tsx +28 -0
- package/src/images/documents/odg.tsx +28 -0
- package/src/images/documents/odp.tsx +33 -0
- package/src/images/documents/ods.tsx +37 -0
- package/src/images/documents/odt.tsx +28 -0
- package/src/images/documents/pdf.tsx +30 -0
- package/src/images/documents/ppt.tsx +28 -0
- package/src/images/documents/rtf.tsx +30 -0
- package/src/images/documents/text.tsx +30 -0
- package/src/images/documents/video.tsx +34 -0
- package/src/images/documents/word.tsx +30 -0
- package/src/images/documents/xml.tsx +30 -0
- package/src/images/documents/zip.tsx +30 -0
- package/src/images/icons/index.ts +17 -0
- package/vite.config.ts +1 -1
- package/src/icons/index.ts +0 -17
- /package/src/common/{conditional-wrapper.tsx → ConditionalWrapper.tsx} +0 -0
- /package/src/common/{hint-text.tsx → HintText.tsx} +0 -0
- /package/src/common/{screen-reader-text.tsx → ScreenReaderText.tsx} +0 -0
- /package/src/common/{wrapper-tag.tsx → WrapperTag.tsx} +0 -0
- /package/src/components/{aspect-box/aspect-box.tsx → AspectBox/AspectBox.tsx} +0 -0
- /package/src/components/{breadcrumbs/breadcrumbs.tsx → Breadcrumbs/Breadcrumbs.tsx} +0 -0
- /package/src/components/{details/details.tsx → Details/Details.tsx} +0 -0
- /package/src/components/{error-message/error-message.tsx → ErrorMessage/ErrorMessage.tsx} +0 -0
- /package/src/components/{inset-text/inset-text.tsx → InsetText/InsetText.tsx} +0 -0
- /package/src/components/{page-header/page-header.tsx → PageHeader/PageHeader.tsx} +0 -0
- /package/src/components/{page-metadata/page-metadata.tsx → PageMetadata/PageMetadata.tsx} +0 -0
- /package/src/components/{sequential-navigation/sequential-navigation.tsx → SequentialNavigation/SequentialNavigation.tsx} +0 -0
- /package/src/components/{side-navigation/side-navigation.tsx → SideNavigation/SideNavigation.tsx} +0 -0
- /package/src/components/{site-navigation/site-navigation.tsx → SiteNavigation/SiteNavigation.tsx} +0 -0
- /package/src/components/{skip-links/skip-links.tsx → SkipLinks/SkipLinks.tsx} +0 -0
- /package/src/components/{table/table.tsx → Table/Table.tsx} +0 -0
- /package/src/components/{tag/tag.tsx → Tag/Tag.tsx} +0 -0
- /package/src/components/{warning-text/warning-text.tsx → WarningText/WarningText.tsx} +0 -0
- /package/src/{icons/ArrowUpward.tsx → images/icons/arrow_upward.tsx} +0 -0
- /package/src/{icons/CalendarToday.tsx → images/icons/calendar_today.tsx} +0 -0
- /package/src/{icons/Cancel.tsx → images/icons/cancel.tsx} +0 -0
- /package/src/{icons/CheckCircle.tsx → images/icons/check_circle.tsx} +0 -0
- /package/src/{icons/ChevronLeft.tsx → images/icons/chevron_left.tsx} +0 -0
- /package/src/{icons/ChevronRight.tsx → images/icons/chevron_right.tsx} +0 -0
- /package/src/{icons/Close.tsx → images/icons/close.tsx} +0 -0
- /package/src/{icons/Description.tsx → images/icons/description.tsx} +0 -0
- /package/src/{icons/DoubleChevronLeft.tsx → images/icons/double_chevron_left.tsx} +0 -0
- /package/src/{icons/DoubleChevronRight.tsx → images/icons/double_chevron_right.tsx} +0 -0
- /package/src/{icons/Error.tsx → images/icons/error.tsx} +0 -0
- /package/src/{icons/ExpandLess.tsx → images/icons/expand_less.tsx} +0 -0
- /package/src/{icons/ExpandMore.tsx → images/icons/expand_more.tsx} +0 -0
- /package/src/{icons/List.tsx → images/icons/list.tsx} +0 -0
- /package/src/{icons/Menu.tsx → images/icons/menu.tsx} +0 -0
- /package/src/{icons/PriorityHigh.tsx → images/icons/priority_high.tsx} +0 -0
- /package/src/{icons/Search.tsx → images/icons/search.tsx} +0 -0
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { test, expect } from 'vitest';
|
|
2
2
|
import { render } from '@testing-library/react';
|
|
3
|
-
import WrapperTag from './
|
|
3
|
+
import WrapperTag from './WrapperTag';
|
|
4
4
|
|
|
5
|
-
const
|
|
5
|
+
const CONTENT = 'My content';
|
|
6
6
|
|
|
7
7
|
test('wrapper tag renders correctly', () => {
|
|
8
8
|
render(
|
|
9
9
|
<WrapperTag id="foo">
|
|
10
|
-
{
|
|
10
|
+
{CONTENT}
|
|
11
11
|
</WrapperTag>
|
|
12
12
|
);
|
|
13
13
|
|
|
@@ -21,7 +21,7 @@ test('wrapper tag widh tag name', () => {
|
|
|
21
21
|
<WrapperTag id="foo"
|
|
22
22
|
tagName="section"
|
|
23
23
|
>
|
|
24
|
-
{
|
|
24
|
+
{CONTENT}
|
|
25
25
|
</WrapperTag>
|
|
26
26
|
);
|
|
27
27
|
|
|
@@ -33,7 +33,7 @@ test('wrapper tag widh tag name', () => {
|
|
|
33
33
|
test('passing additional props', () => {
|
|
34
34
|
render(
|
|
35
35
|
<WrapperTag id="foo" data-test="foo">
|
|
36
|
-
{
|
|
36
|
+
{CONTENT}
|
|
37
37
|
</WrapperTag>
|
|
38
38
|
);
|
|
39
39
|
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { test, expect } from 'vitest';
|
|
2
2
|
import { render, screen, within } from '@testing-library/react';
|
|
3
|
-
import Accordion from './
|
|
3
|
+
import Accordion from './Accordion';
|
|
4
4
|
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
5
|
+
const ACCORDION_ID = 'my-accordion';
|
|
6
|
+
const ACCORDION_ITEM_ID = 'my-accordion-item';
|
|
7
|
+
const TITLE_TEXT = 'Healthcare for veterans';
|
|
8
|
+
const CONTENT_TEXT = `Veterans are entitled to the same healthcare as any citizen. And there
|
|
9
9
|
are health care options and support available specifically for veterans`;
|
|
10
10
|
|
|
11
11
|
test('accordion renders correctly', () => {
|
|
12
|
-
const
|
|
12
|
+
const DEFAULT_HEADING_LEVEL = 'h3';
|
|
13
13
|
|
|
14
14
|
render(
|
|
15
|
-
<Accordion id={
|
|
15
|
+
<Accordion id={ACCORDION_ID} data-testid={ACCORDION_ID}>
|
|
16
16
|
<Accordion.Item id="accordion-1" title="Healthcare for veterans">
|
|
17
17
|
<p>Veterans are entitled to the same healthcare as any citizen. And there
|
|
18
18
|
are health care options and support available specifically for veterans.</p>
|
|
@@ -30,7 +30,7 @@ test('accordion renders correctly', () => {
|
|
|
30
30
|
</Accordion>
|
|
31
31
|
);
|
|
32
32
|
|
|
33
|
-
const accordion = screen.getByTestId(
|
|
33
|
+
const accordion = screen.getByTestId(ACCORDION_ID);
|
|
34
34
|
const openAllButton = document.querySelector('.ds_accordion__open-all');
|
|
35
35
|
const accordionItems = document.querySelectorAll('.ds_accordion-item');
|
|
36
36
|
const firstAccordionTitle = document.querySelector('.ds_accordion-item__title');
|
|
@@ -45,12 +45,12 @@ test('accordion renders correctly', () => {
|
|
|
45
45
|
|
|
46
46
|
expect(accordionItems.length).toEqual(3);
|
|
47
47
|
|
|
48
|
-
expect(firstAccordionTitle?.tagName).toEqual(
|
|
48
|
+
expect(firstAccordionTitle?.tagName).toEqual(DEFAULT_HEADING_LEVEL.toUpperCase());
|
|
49
49
|
});
|
|
50
50
|
|
|
51
51
|
test('accordion without open all', () => {
|
|
52
52
|
render(
|
|
53
|
-
<Accordion id={
|
|
53
|
+
<Accordion id={ACCORDION_ID} data-testid={ACCORDION_ID} hideOpenAll>
|
|
54
54
|
<Accordion.Item id="accordion-1" title="Healthcare for veterans">
|
|
55
55
|
<p>Veterans are entitled to the same healthcare as any citizen. And there
|
|
56
56
|
are health care options and support available specifically for veterans.</p>
|
|
@@ -75,7 +75,7 @@ test('accordion without open all', () => {
|
|
|
75
75
|
|
|
76
76
|
test('empty accordion has no open all', () => {
|
|
77
77
|
render(
|
|
78
|
-
<Accordion id={
|
|
78
|
+
<Accordion id={ACCORDION_ID} data-testid={ACCORDION_ID} hideOpenAll>
|
|
79
79
|
</Accordion>
|
|
80
80
|
);
|
|
81
81
|
|
|
@@ -84,11 +84,11 @@ test('empty accordion has no open all', () => {
|
|
|
84
84
|
expect(openAllButton).toBeNull();
|
|
85
85
|
})
|
|
86
86
|
|
|
87
|
-
test('accordion with custom
|
|
88
|
-
const
|
|
87
|
+
test('accordion with custom heading level', () => {
|
|
88
|
+
const HEADING_LEVEL = 'h2';
|
|
89
89
|
|
|
90
90
|
render(
|
|
91
|
-
<Accordion id={
|
|
91
|
+
<Accordion id={ACCORDION_ID} data-testid={ACCORDION_ID} headingLevel={HEADING_LEVEL}>
|
|
92
92
|
<Accordion.Item id="accordion-1" title="Healthcare for veterans">
|
|
93
93
|
<p>Veterans are entitled to the same healthcare as any citizen. And there
|
|
94
94
|
are health care options and support available specifically for veterans.</p>
|
|
@@ -99,37 +99,37 @@ test('accordion with custom header level', () => {
|
|
|
99
99
|
);
|
|
100
100
|
|
|
101
101
|
const firstAccordionTitle = document.querySelector('.ds_accordion-item__title');
|
|
102
|
-
expect(firstAccordionTitle?.tagName).toEqual(
|
|
102
|
+
expect(firstAccordionTitle?.tagName).toEqual(HEADING_LEVEL.toUpperCase());
|
|
103
103
|
});
|
|
104
104
|
|
|
105
105
|
test('passing additional props to accordion', () => {
|
|
106
106
|
render(
|
|
107
|
-
<Accordion id={
|
|
107
|
+
<Accordion id={ACCORDION_ID} data-testid={ACCORDION_ID} data-test="foo">
|
|
108
108
|
</Accordion>
|
|
109
109
|
);
|
|
110
110
|
|
|
111
|
-
const accordion = screen.getByTestId(
|
|
111
|
+
const accordion = screen.getByTestId(ACCORDION_ID);
|
|
112
112
|
expect(accordion?.dataset.test).toEqual('foo');
|
|
113
113
|
});
|
|
114
114
|
|
|
115
115
|
test('passing additional CSS classes', () => {
|
|
116
116
|
render(
|
|
117
|
-
<Accordion id={
|
|
117
|
+
<Accordion id={ACCORDION_ID} data-testid={ACCORDION_ID} className="foo">
|
|
118
118
|
</Accordion>
|
|
119
119
|
);
|
|
120
120
|
|
|
121
|
-
const accordion = screen.getByTestId(
|
|
121
|
+
const accordion = screen.getByTestId(ACCORDION_ID);
|
|
122
122
|
expect(accordion).toHaveClass('foo', 'ds_accordion');
|
|
123
123
|
});
|
|
124
124
|
|
|
125
125
|
test('accordion item renders correctly', () => {
|
|
126
126
|
render(
|
|
127
|
-
<Accordion.Item id={
|
|
128
|
-
<p>{
|
|
127
|
+
<Accordion.Item id={ACCORDION_ITEM_ID} data-testid={ACCORDION_ITEM_ID} title={TITLE_TEXT}>
|
|
128
|
+
<p>{CONTENT_TEXT}</p>
|
|
129
129
|
</Accordion.Item>
|
|
130
130
|
);
|
|
131
131
|
|
|
132
|
-
const accordionItem = screen.getByTestId(
|
|
132
|
+
const accordionItem = screen.getByTestId(ACCORDION_ITEM_ID);
|
|
133
133
|
const input = within(accordionItem).getByRole('checkbox');
|
|
134
134
|
const header = document.querySelector('.ds_accordion-item__header');
|
|
135
135
|
const title = header?.querySelector('.ds_accordion-item__title');
|
|
@@ -138,16 +138,16 @@ test('accordion item renders correctly', () => {
|
|
|
138
138
|
const body = document.querySelector('.ds_accordion-item__body');
|
|
139
139
|
|
|
140
140
|
expect(accordionItem).toHaveClass('ds_accordion-item');
|
|
141
|
-
expect(accordionItem).toHaveAttribute('id',
|
|
141
|
+
expect(accordionItem).toHaveAttribute('id', ACCORDION_ITEM_ID);
|
|
142
142
|
|
|
143
143
|
expect(input).toHaveClass('ds_accordion-item__control', 'visually-hidden')
|
|
144
|
-
expect(input).toHaveAttribute('id', `${
|
|
144
|
+
expect(input).toHaveAttribute('id', `${ACCORDION_ITEM_ID}-control`);
|
|
145
145
|
|
|
146
146
|
expect(header?.tagName).toEqual('DIV');
|
|
147
147
|
|
|
148
|
-
expect(title).toHaveAttribute('id', `panel-${
|
|
148
|
+
expect(title).toHaveAttribute('id', `panel-${ACCORDION_ITEM_ID}-heading`);
|
|
149
149
|
expect(title?.tagName).toEqual('H3');
|
|
150
|
-
expect(title?.textContent).toEqual(
|
|
150
|
+
expect(title?.textContent).toEqual(TITLE_TEXT);
|
|
151
151
|
|
|
152
152
|
expect(indicator?.tagName).toEqual('SPAN');
|
|
153
153
|
|
|
@@ -156,12 +156,12 @@ test('accordion item renders correctly', () => {
|
|
|
156
156
|
expect(label?.textContent).toEqual('Show this section');
|
|
157
157
|
expect(label?.children[0]).toHaveClass('visually-hidden');
|
|
158
158
|
|
|
159
|
-
expect(body?.innerHTML).toEqual(`<p>${
|
|
159
|
+
expect(body?.innerHTML).toEqual(`<p>${CONTENT_TEXT}</p>`);
|
|
160
160
|
});
|
|
161
161
|
|
|
162
162
|
test('accordion items without ID are given unique IDs', () => {
|
|
163
163
|
render(
|
|
164
|
-
<Accordion id={
|
|
164
|
+
<Accordion id={ACCORDION_ID} data-testid={ACCORDION_ID} hideOpenAll>
|
|
165
165
|
<Accordion.Item data-testid="item1" title="Healthcare for veterans">
|
|
166
166
|
<p>Veterans are entitled to the same healthcare as any citizen. And there
|
|
167
167
|
are health care options and support available specifically for veterans.</p>
|
|
@@ -194,12 +194,12 @@ test('accordion items without ID are given unique IDs', () => {
|
|
|
194
194
|
|
|
195
195
|
test('open accordion item', () => {
|
|
196
196
|
render(
|
|
197
|
-
<Accordion.Item open id={
|
|
198
|
-
<p>{
|
|
197
|
+
<Accordion.Item open id={ACCORDION_ITEM_ID} data-testid={ACCORDION_ITEM_ID} title={TITLE_TEXT}>
|
|
198
|
+
<p>{CONTENT_TEXT}</p>
|
|
199
199
|
</Accordion.Item>
|
|
200
200
|
);
|
|
201
201
|
|
|
202
|
-
const accordionItem = screen.getByTestId(
|
|
202
|
+
const accordionItem = screen.getByTestId(ACCORDION_ITEM_ID);
|
|
203
203
|
const input = within(accordionItem).getByRole('checkbox');
|
|
204
204
|
|
|
205
205
|
expect(input).toHaveAttribute('checked');
|
|
@@ -207,7 +207,7 @@ test('open accordion item', () => {
|
|
|
207
207
|
|
|
208
208
|
test('passing additional props to accordion item', () => {
|
|
209
209
|
render(
|
|
210
|
-
<Accordion.Item id={
|
|
210
|
+
<Accordion.Item id={ACCORDION_ITEM_ID} data-testid={ACCORDION_ITEM_ID} title="Healthcare for veterans" data-test="foo">
|
|
211
211
|
<p>Veterans are entitled to the same healthcare as any citizen. And there
|
|
212
212
|
are health care options and support available specifically for veterans.</p>
|
|
213
213
|
<p>If you have a health condition that’s related to your service, you’re
|
|
@@ -215,13 +215,13 @@ test('passing additional props to accordion item', () => {
|
|
|
215
215
|
</Accordion.Item>
|
|
216
216
|
);
|
|
217
217
|
|
|
218
|
-
const accordionItem = screen.getByTestId(
|
|
218
|
+
const accordionItem = screen.getByTestId(ACCORDION_ITEM_ID);
|
|
219
219
|
expect(accordionItem?.dataset.test).toEqual('foo');
|
|
220
220
|
});
|
|
221
221
|
|
|
222
222
|
test('passing additional CSS classes', () => {
|
|
223
223
|
render(
|
|
224
|
-
<Accordion.Item id={
|
|
224
|
+
<Accordion.Item id={ACCORDION_ITEM_ID} data-testid={ACCORDION_ITEM_ID} title="Healthcare for veterans" className="foo">
|
|
225
225
|
<p>Veterans are entitled to the same healthcare as any citizen. And there
|
|
226
226
|
are health care options and support available specifically for veterans.</p>
|
|
227
227
|
<p>If you have a health condition that’s related to your service, you’re
|
|
@@ -229,6 +229,6 @@ test('passing additional CSS classes', () => {
|
|
|
229
229
|
</Accordion.Item>
|
|
230
230
|
);
|
|
231
231
|
|
|
232
|
-
const accordionItem = screen.getByTestId(
|
|
232
|
+
const accordionItem = screen.getByTestId(ACCORDION_ITEM_ID);
|
|
233
233
|
expect(accordionItem).toHaveClass('foo', 'ds_accordion-item');
|
|
234
234
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { Children, useEffect, useRef } from 'react';
|
|
2
|
-
import WrapperTag from '../../common/
|
|
2
|
+
import WrapperTag from '../../common/WrapperTag';
|
|
3
3
|
// @ts-ignore
|
|
4
4
|
import DSAccordion from '@scottish-government/design-system/src/components/accordion/accordion';
|
|
5
5
|
|
|
@@ -8,7 +8,7 @@ let accordionItemCounter = 0;
|
|
|
8
8
|
const AccordionItem: React.FC<SGDS.Component.Accordion.Item> = ({
|
|
9
9
|
children,
|
|
10
10
|
className,
|
|
11
|
-
|
|
11
|
+
headingLevel = 'h3',
|
|
12
12
|
id: rawId,
|
|
13
13
|
open = false,
|
|
14
14
|
title,
|
|
@@ -39,7 +39,7 @@ const AccordionItem: React.FC<SGDS.Component.Accordion.Item> = ({
|
|
|
39
39
|
<WrapperTag
|
|
40
40
|
id={`panel-${processedId}-heading`}
|
|
41
41
|
className="ds_accordion-item__title"
|
|
42
|
-
tagName={
|
|
42
|
+
tagName={headingLevel}
|
|
43
43
|
>
|
|
44
44
|
{title}
|
|
45
45
|
</WrapperTag>
|
|
@@ -62,7 +62,7 @@ const Accordion: React.FC<SGDS.Component.Accordion>
|
|
|
62
62
|
& { Item: React.FC<SGDS.Component.Accordion.Item> } = ({
|
|
63
63
|
children,
|
|
64
64
|
className,
|
|
65
|
-
|
|
65
|
+
headingLevel = 'h3',
|
|
66
66
|
hideOpenAll,
|
|
67
67
|
...props
|
|
68
68
|
}) => {
|
|
@@ -79,7 +79,7 @@ const Accordion: React.FC<SGDS.Component.Accordion>
|
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
function processChild(child: any) {
|
|
82
|
-
return React.cloneElement(child, {
|
|
82
|
+
return React.cloneElement(child, { headingLevel: headingLevel });
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
return (
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { test, expect } from 'vitest';
|
|
2
|
-
import { render
|
|
3
|
-
import AspectBox from './
|
|
2
|
+
import { render } from '@testing-library/react';
|
|
3
|
+
import AspectBox from './AspectBox';
|
|
4
4
|
|
|
5
5
|
test('aspect box renders correctly', () => {
|
|
6
6
|
render(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useEffect, useRef } from 'react';
|
|
2
|
+
import Icon from '../../common/Icon';
|
|
2
3
|
// @ts-ignore
|
|
3
4
|
import DSBackToTop from '@scottish-government/design-system/src/components/back-to-top/back-to-top';
|
|
4
|
-
import Icon from '../../common/icon';
|
|
5
5
|
|
|
6
6
|
const BackToTop: React.FC<SGDS.Component.BackToTop> = ({
|
|
7
7
|
className,
|
package/src/components/{breadcrumbs/breadcrumbs.test.tsx → Breadcrumbs/Breadcrumbs.test.tsx}
RENAMED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { test, expect } from 'vitest';
|
|
2
2
|
import { render, screen, within } from '@testing-library/react';
|
|
3
|
-
import Breadcrumbs from './
|
|
3
|
+
import Breadcrumbs from './Breadcrumbs';
|
|
4
4
|
|
|
5
|
-
const
|
|
5
|
+
const ITEMS = [
|
|
6
6
|
{ href: 'home', title: 'Home' },
|
|
7
7
|
{ href: 'category', title: 'Category' },
|
|
8
8
|
{ title: 'Page' }
|
|
@@ -10,7 +10,7 @@ const items = [
|
|
|
10
10
|
|
|
11
11
|
test('renders correctly', () => {
|
|
12
12
|
render(
|
|
13
|
-
<Breadcrumbs items={
|
|
13
|
+
<Breadcrumbs items={ITEMS} />
|
|
14
14
|
);
|
|
15
15
|
|
|
16
16
|
const nav = screen.getByRole('navigation');
|
|
@@ -25,7 +25,7 @@ test('renders correctly', () => {
|
|
|
25
25
|
expect(list).toHaveClass('ds_breadcrumbs');
|
|
26
26
|
|
|
27
27
|
// check items
|
|
28
|
-
expect(listItems.length).toEqual(
|
|
28
|
+
expect(listItems.length).toEqual(ITEMS.length);
|
|
29
29
|
|
|
30
30
|
listItems.forEach((item, index) => {
|
|
31
31
|
expect(item).toHaveClass('ds_breadcrumbs__item');
|
|
@@ -49,7 +49,7 @@ test('renders with last item hidden', () => {
|
|
|
49
49
|
render(
|
|
50
50
|
<Breadcrumbs
|
|
51
51
|
hideLastItem
|
|
52
|
-
items={
|
|
52
|
+
items={ITEMS}
|
|
53
53
|
/>
|
|
54
54
|
);
|
|
55
55
|
|
|
@@ -67,7 +67,7 @@ test('renders with last item hidden', () => {
|
|
|
67
67
|
test('passing additional props', () => {
|
|
68
68
|
render(
|
|
69
69
|
<Breadcrumbs
|
|
70
|
-
items={
|
|
70
|
+
items={ITEMS}
|
|
71
71
|
data-test="foo"
|
|
72
72
|
/>
|
|
73
73
|
);
|
|
@@ -79,7 +79,7 @@ test('passing additional props', () => {
|
|
|
79
79
|
test('passing additional CSS classes', () => {
|
|
80
80
|
render(
|
|
81
81
|
<Breadcrumbs
|
|
82
|
-
items={
|
|
82
|
+
items={ITEMS}
|
|
83
83
|
className="foo"
|
|
84
84
|
/>
|
|
85
85
|
);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import Icon from '../../common/
|
|
2
|
-
import ScreenReaderText from '../../common/
|
|
3
|
-
import WrapperTag from '../../common/
|
|
1
|
+
import Icon from '../../common/Icon';
|
|
2
|
+
import ScreenReaderText from '../../common/ScreenReaderText';
|
|
3
|
+
import WrapperTag from '../../common/WrapperTag';
|
|
4
4
|
|
|
5
5
|
const Button: React.FC<SGDS.Component.Button> = ({
|
|
6
6
|
buttonStyle,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { test, expect, vi } from 'vitest';
|
|
2
2
|
import { render, screen, fireEvent } from '@testing-library/react';
|
|
3
|
-
import CheckboxGroup, { Checkbox } from './
|
|
3
|
+
import CheckboxGroup, { Checkbox } from './Checkbox';
|
|
4
4
|
|
|
5
5
|
test('checkbox group renders correct children', () => {
|
|
6
|
-
const
|
|
6
|
+
const ITEMS = [
|
|
7
7
|
{
|
|
8
8
|
id: 'universal-credit',
|
|
9
9
|
label: 'Universal Credit',
|
|
@@ -25,18 +25,18 @@ test('checkbox group renders correct children', () => {
|
|
|
25
25
|
];
|
|
26
26
|
|
|
27
27
|
render(
|
|
28
|
-
<CheckboxGroup items={
|
|
28
|
+
<CheckboxGroup items={ITEMS} />
|
|
29
29
|
);
|
|
30
30
|
|
|
31
31
|
const checkboxes = screen.getAllByRole('checkbox');
|
|
32
32
|
const groupContainer = checkboxes[0].parentElement?.parentElement;
|
|
33
|
-
expect(checkboxes.length).toEqual(
|
|
33
|
+
expect(checkboxes.length).toEqual(ITEMS.length);
|
|
34
34
|
expect(groupContainer).toHaveClass('ds_checkboxes', 'ds_field-group');
|
|
35
35
|
});
|
|
36
36
|
|
|
37
37
|
test('checkbox group passes all expected item params', () => {
|
|
38
|
-
const
|
|
39
|
-
const
|
|
38
|
+
const ONBLUR_FUNCTION = vi.fn();
|
|
39
|
+
const ONCHANGE_FUNCTION = vi.fn();
|
|
40
40
|
|
|
41
41
|
render(
|
|
42
42
|
<CheckboxGroup small items={[
|
|
@@ -46,8 +46,8 @@ test('checkbox group passes all expected item params', () => {
|
|
|
46
46
|
hintText: 'hint text',
|
|
47
47
|
id: 'myid',
|
|
48
48
|
label: 'label text',
|
|
49
|
-
onBlur: {
|
|
50
|
-
onChange: {
|
|
49
|
+
onBlur: {ONBLUR_FUNCTION},
|
|
50
|
+
onChange: {ONCHANGE_FUNCTION},
|
|
51
51
|
small: true
|
|
52
52
|
}
|
|
53
53
|
]}/>
|
|
@@ -65,10 +65,10 @@ test('checkbox group passes all expected item params', () => {
|
|
|
65
65
|
expect(checkbox).toHaveAttribute('aria-describedby', hintText.id);
|
|
66
66
|
|
|
67
67
|
// fireEvent.blur(checkbox);
|
|
68
|
-
// expect(
|
|
68
|
+
// expect(ONBLUR_FUNCTION).toHaveBeenCalled();
|
|
69
69
|
|
|
70
70
|
// fireEvent.click(checkbox);
|
|
71
|
-
// expect(
|
|
71
|
+
// expect(ONCHANGE_FUNCTION).toHaveBeenCalled();
|
|
72
72
|
});
|
|
73
73
|
|
|
74
74
|
test('individual checkbox renders correctly', () => {
|
|
@@ -116,31 +116,31 @@ test('exclusive checkbox', () => {
|
|
|
116
116
|
});
|
|
117
117
|
|
|
118
118
|
test('checkbox with blur fn', () => {
|
|
119
|
-
const
|
|
119
|
+
const ONBLUR_FUNCTION = vi.fn();
|
|
120
120
|
|
|
121
121
|
render(
|
|
122
|
-
<Checkbox onBlur={
|
|
122
|
+
<Checkbox onBlur={ONBLUR_FUNCTION} label="Pension Credit" id="pensioncredit" />
|
|
123
123
|
);
|
|
124
124
|
|
|
125
125
|
const checkbox = screen.getByRole('checkbox');
|
|
126
126
|
|
|
127
127
|
fireEvent.blur(checkbox);
|
|
128
128
|
|
|
129
|
-
expect(
|
|
129
|
+
expect(ONBLUR_FUNCTION).toHaveBeenCalled();
|
|
130
130
|
});
|
|
131
131
|
|
|
132
132
|
test('checkbox with change fn', () => {
|
|
133
|
-
const
|
|
133
|
+
const ONCHANGE_FUNCTION = vi.fn();
|
|
134
134
|
|
|
135
135
|
render(
|
|
136
|
-
<Checkbox onChange={
|
|
136
|
+
<Checkbox onChange={ONCHANGE_FUNCTION} label="Pension Credit" id="pensioncredit" />
|
|
137
137
|
);
|
|
138
138
|
|
|
139
139
|
const checkbox = screen.getByRole('checkbox');
|
|
140
140
|
|
|
141
141
|
fireEvent.click(checkbox);
|
|
142
142
|
|
|
143
|
-
expect(
|
|
143
|
+
expect(ONCHANGE_FUNCTION).toHaveBeenCalled();
|
|
144
144
|
});
|
|
145
145
|
|
|
146
146
|
test('checkbox with hint text', () => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useEffect, useRef } from 'react';
|
|
2
2
|
// @ts-ignore
|
|
3
3
|
import DSCheckboxes from '@scottish-government/design-system/src/forms/checkbox/checkboxes'
|
|
4
|
-
import HintText from '../../common/
|
|
4
|
+
import HintText from '../../common/HintText';
|
|
5
5
|
|
|
6
6
|
export const Checkbox: React.FC<SGDS.Component.Checkbox> = ({
|
|
7
7
|
checked,
|
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
import { test, expect } from 'vitest';
|
|
2
2
|
import { render, screen } from '@testing-library/react';
|
|
3
|
-
import ConfirmationMessage from './
|
|
3
|
+
import ConfirmationMessage from './ConfirmationMessage';
|
|
4
4
|
|
|
5
|
-
const
|
|
5
|
+
const TITLE_TEXT = 'Landlord added successfully';
|
|
6
6
|
|
|
7
7
|
test('renders correctly with icon, title and message', () => {
|
|
8
8
|
render(
|
|
9
|
-
<ConfirmationMessage title={
|
|
9
|
+
<ConfirmationMessage title={TITLE_TEXT}>
|
|
10
10
|
<p>You have added the landlord <strong>John Smith</strong> to the application.</p>
|
|
11
11
|
</ConfirmationMessage>
|
|
12
12
|
);
|
|
13
13
|
|
|
14
14
|
const container = document.querySelector('.ds_confirmation-message');
|
|
15
|
-
const
|
|
15
|
+
const heading = screen.getByRole('heading');
|
|
16
16
|
|
|
17
17
|
expect(container?.ariaLive).toEqual('polite');
|
|
18
18
|
|
|
19
|
-
expect(
|
|
20
|
-
expect(
|
|
19
|
+
expect(heading.tagName).toEqual('H3');
|
|
20
|
+
expect(heading.textContent).toEqual(TITLE_TEXT)
|
|
21
21
|
});
|
|
22
22
|
|
|
23
23
|
test("does not render body when no children specified", () => {
|
|
24
|
-
const { container } = render(<ConfirmationMessage title={
|
|
24
|
+
const { container } = render(<ConfirmationMessage title={TITLE_TEXT} />);
|
|
25
25
|
|
|
26
26
|
expect(
|
|
27
27
|
container.querySelector(".ds_confirmation-message__body"),
|
|
@@ -29,25 +29,23 @@ test("does not render body when no children specified", () => {
|
|
|
29
29
|
});
|
|
30
30
|
|
|
31
31
|
test('renders confirmation message with custom aria live and custom heaer level', () => {
|
|
32
|
-
const titleString = 'Landlord added successfully';
|
|
33
|
-
|
|
34
32
|
render(
|
|
35
|
-
<ConfirmationMessage
|
|
33
|
+
<ConfirmationMessage headingLevel="h2" ariaLive="alert" title={TITLE_TEXT}>
|
|
36
34
|
<p>You have added the landlord <strong>John Smith</strong> to the application.</p>
|
|
37
35
|
</ConfirmationMessage>
|
|
38
36
|
);
|
|
39
37
|
|
|
40
38
|
const container = document.querySelector('.ds_confirmation-message');
|
|
41
|
-
const
|
|
39
|
+
const heading = screen.getByRole('heading');
|
|
42
40
|
|
|
43
41
|
expect(container?.ariaLive).toEqual('alert');
|
|
44
42
|
|
|
45
|
-
expect(
|
|
43
|
+
expect(heading.tagName).toEqual('H2');
|
|
46
44
|
});
|
|
47
45
|
|
|
48
46
|
test('passing additional props', () => {
|
|
49
47
|
render(
|
|
50
|
-
<ConfirmationMessage data-test="foo" title={
|
|
48
|
+
<ConfirmationMessage data-test="foo" title={TITLE_TEXT}>
|
|
51
49
|
<p>You have added the landlord <strong>John Smith</strong> to the application.</p>
|
|
52
50
|
</ConfirmationMessage>
|
|
53
51
|
);
|
|
@@ -58,7 +56,7 @@ test('passing additional props', () => {
|
|
|
58
56
|
|
|
59
57
|
test('passing additional CSS classes', () => {
|
|
60
58
|
render(
|
|
61
|
-
<ConfirmationMessage className="foo" title={
|
|
59
|
+
<ConfirmationMessage className="foo" title={TITLE_TEXT}>
|
|
62
60
|
<p>You have added the landlord <strong>John Smith</strong> to the application.</p>
|
|
63
61
|
</ConfirmationMessage>
|
|
64
62
|
);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import Icon from '../../common/
|
|
2
|
-
import WrapperTag from '../../common/
|
|
1
|
+
import Icon from '../../common/Icon';
|
|
2
|
+
import WrapperTag from '../../common/WrapperTag';
|
|
3
3
|
|
|
4
4
|
const ConfirmationMessage: React.FC<SGDS.Component.ConfirmationMessage> = ({
|
|
5
5
|
ariaLive = 'polite',
|
|
6
6
|
children,
|
|
7
7
|
className,
|
|
8
|
-
|
|
8
|
+
headingLevel = 'h3',
|
|
9
9
|
title,
|
|
10
10
|
...props
|
|
11
11
|
}) => {
|
|
@@ -22,7 +22,7 @@ const ConfirmationMessage: React.FC<SGDS.Component.ConfirmationMessage> = ({
|
|
|
22
22
|
|
|
23
23
|
<WrapperTag
|
|
24
24
|
className="ds_confirmation-message__title"
|
|
25
|
-
tagName={
|
|
25
|
+
tagName={headingLevel}
|
|
26
26
|
>
|
|
27
27
|
{title}
|
|
28
28
|
</WrapperTag>
|