@eeacms/volto-eea-design-system 1.16.0 → 1.18.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/CHANGELOG.md +57 -0
- package/docker-compose.yml +5 -1
- package/locales/en/LC_MESSAGES/volto.po +14 -0
- package/package.json +1 -1
- package/src/helpers/index.js +4 -4
- package/src/helpers/useClickOutside.test.js +63 -0
- package/src/helpers/useFirstVisited.test.js +54 -0
- package/src/ui/Accordion/Accordion.stories.js +3 -1
- package/src/ui/Accordion/Accordion.stories.test.js +45 -0
- package/src/ui/Banner/Banner.test.jsx +292 -0
- package/src/ui/CallToAction/CallToAction.stories.test.jsx +69 -0
- package/src/ui/Card/Card.stories.test.jsx +78 -0
- package/src/ui/Card/IconCard/IconCard.stories.test.jsx +64 -0
- package/src/ui/Card/RelatedContent/RelatedContent.jsx +1 -1
- package/src/ui/Card/RelatedContent/RelatedContent.stories.jsx +2 -2
- package/src/ui/Card/RelatedContent/RelatedContent.stories.test.jsx +65 -0
- package/src/ui/Confirm/Confirm.stories.test.js +27 -0
- package/src/ui/ContextNavigation/ContextNavigation.stories.test.jsx +170 -0
- package/src/ui/Divider/Divider.stories.test.jsx +44 -0
- package/src/ui/DownloadLabeledIcon/DownloadLabeledIcon.stories.test.jsx +24 -0
- package/src/ui/Footer/Description.test.jsx +11 -0
- package/src/ui/Footer/Footer.stories.test.js +131 -0
- package/src/ui/Footer/Social.test.jsx +11 -0
- package/src/ui/Form/Button/Button.stories.test.jsx +55 -0
- package/src/ui/Form/Checkbox.stories.test.js +79 -0
- package/src/ui/Form/Dropdown.stories.test.js +24 -0
- package/src/ui/Form/Radio.stories.test.js +55 -0
- package/src/ui/Form/Textarea.stories.test.js +41 -0
- package/src/ui/Form/input.stories.test.js +52 -0
- package/src/ui/Grid/ComponentGrid.stories.test.js +21 -0
- package/src/ui/Header/Header.stories.test.js +158 -0
- package/src/ui/Header/Header.test.jsx +293 -0
- package/src/ui/Header/HeaderMenuPopUp.js +12 -4
- package/src/ui/Header/HeaderSearchPopUp.test.js +114 -0
- package/src/ui/Hero/Hero.stories.test.jsx +67 -0
- package/src/ui/InpageNavigation/InpageNavigation.stories.test.jsx +10 -0
- package/src/ui/InpageNavigation/InpageNavigation.test.jsx +87 -0
- package/src/ui/Item/Item.stories.test.js +39 -0
- package/src/ui/Item/ItemGroupWithIcons.stories.test.js +119 -0
- package/src/ui/Label/Label.stories.test.js +76 -0
- package/src/ui/LabeledIconGroup/LabeledIconGroup.stories.test.jsx +19 -0
- package/src/ui/LanguageLabeledIcon/LanguageLabeledIcon.jsx +3 -2
- package/src/ui/LanguageLabeledIcon/LanguangeLabeledIcon.test.jsx +60 -0
- package/src/ui/Loader/Loader.stories.test.jsx +30 -0
- package/src/ui/Logo/Logo.stories.test.jsx +81 -0
- package/src/ui/Media/Image.stories.test.js +35 -0
- package/src/ui/Message/Message.stories.test.js +44 -0
- package/src/ui/Modal/Modal.stories.test.js +45 -0
- package/src/ui/Popup/Popup.jsx +24 -17
- package/src/ui/Popup/Popup.test.jsx +60 -0
- package/src/ui/Progress/Progress.stories.test.js +30 -0
- package/src/ui/Quote/Testimonial/Testimonial.stories.test.jsx +18 -0
- package/src/ui/Statistic/Statistic.stories.test.js +93 -0
- package/src/ui/Table/Table.stories.js +8 -0
- package/src/ui/Table/Table.stories.test.js +54 -0
- package/src/ui/Timeline/Timeline.stories.test.jsx +43 -0
- package/src/ui/index.js +21 -41
- package/theme/themes/eea/assets/images/Footer/Extras/footer-visual.svg +1 -2065
- package/theme/themes/eea/extras/banner.less +3 -3
- package/theme/themes/eea/modules/accordion.overrides +36 -11
- package/theme/themes/eea/modules/accordion.variables +2 -0
- package/theme/themes/eea/views/item.overrides +21 -0
- package/src/i18n.js +0 -180
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render } from '@testing-library/react';
|
|
3
|
+
import { Default, ProgressWithValue, CustomColor } from './Progress.stories';
|
|
4
|
+
import '@testing-library/jest-dom/extend-expect';
|
|
5
|
+
|
|
6
|
+
describe('CustomColor component', () => {
|
|
7
|
+
it('renders correctly', () => {
|
|
8
|
+
const { getByText } = render(<CustomColor {...CustomColor.args} />);
|
|
9
|
+
expect(getByText(`${CustomColor.args.value}%`)).toBeInTheDocument();
|
|
10
|
+
expect(getByText(`${CustomColor.args.children}`)).toBeInTheDocument();
|
|
11
|
+
});
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
describe('ProgressWithValue component', () => {
|
|
15
|
+
it('renders correctly', () => {
|
|
16
|
+
const { getByText } = render(
|
|
17
|
+
<ProgressWithValue {...ProgressWithValue.args} />,
|
|
18
|
+
);
|
|
19
|
+
expect(getByText(`${ProgressWithValue.args.value}%`)).toBeInTheDocument();
|
|
20
|
+
expect(getByText(`${ProgressWithValue.args.children}`)).toBeInTheDocument();
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
describe('Default component', () => {
|
|
25
|
+
it('renders correctly', () => {
|
|
26
|
+
const { getByText } = render(<Default {...Default.args} />);
|
|
27
|
+
expect(getByText(`${Default.args.percent}%`)).toBeInTheDocument();
|
|
28
|
+
expect(getByText(`${Default.args.children}`)).toBeInTheDocument();
|
|
29
|
+
});
|
|
30
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render } from '@testing-library/react';
|
|
3
|
+
import { Inline } from './Testimonial.stories';
|
|
4
|
+
import '@testing-library/jest-dom/extend-expect';
|
|
5
|
+
|
|
6
|
+
describe('Inline component', () => {
|
|
7
|
+
it('renders corectly', () => {
|
|
8
|
+
const { container, getByText } = render(<Inline {...Inline.args} />);
|
|
9
|
+
|
|
10
|
+
expect(
|
|
11
|
+
container.querySelector(`div[quote="${Inline.args.quote}"]`),
|
|
12
|
+
).toBeInTheDocument();
|
|
13
|
+
expect(getByText(Inline.args.avatartitle)).toBeInTheDocument();
|
|
14
|
+
expect(getByText(Inline.args.avatarinfo)).toBeInTheDocument();
|
|
15
|
+
expect(getByText(Inline.args.title)).toBeInTheDocument();
|
|
16
|
+
expect(getByText(Inline.args.quote)).toBeInTheDocument();
|
|
17
|
+
});
|
|
18
|
+
});
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render } from '@testing-library/react';
|
|
3
|
+
import {
|
|
4
|
+
Default,
|
|
5
|
+
Group,
|
|
6
|
+
Custom,
|
|
7
|
+
Animation,
|
|
8
|
+
AnimationGroup,
|
|
9
|
+
} from './Statistic.stories';
|
|
10
|
+
import '@testing-library/jest-dom/extend-expect';
|
|
11
|
+
|
|
12
|
+
describe('AnimationGroup component', () => {
|
|
13
|
+
let observe;
|
|
14
|
+
let unobserve;
|
|
15
|
+
let disconnect;
|
|
16
|
+
observe = jest.fn();
|
|
17
|
+
unobserve = jest.fn();
|
|
18
|
+
disconnect = jest.fn();
|
|
19
|
+
|
|
20
|
+
window.IntersectionObserver = jest.fn(function () {
|
|
21
|
+
this.observe = observe;
|
|
22
|
+
this.unobserve = unobserve;
|
|
23
|
+
this.disconnect = disconnect;
|
|
24
|
+
});
|
|
25
|
+
it('renders a button with label', () => {
|
|
26
|
+
const { getByText } = render(<AnimationGroup {...AnimationGroup.args} />);
|
|
27
|
+
|
|
28
|
+
expect(
|
|
29
|
+
getByText(AnimationGroup.args.elements[0].label),
|
|
30
|
+
).toBeInTheDocument();
|
|
31
|
+
expect(
|
|
32
|
+
getByText(AnimationGroup.args.elements[1].label),
|
|
33
|
+
).toBeInTheDocument();
|
|
34
|
+
expect(
|
|
35
|
+
getByText(AnimationGroup.args.elements[2].label),
|
|
36
|
+
).toBeInTheDocument();
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
describe('Animation component', () => {
|
|
41
|
+
let observe;
|
|
42
|
+
let unobserve;
|
|
43
|
+
let disconnect;
|
|
44
|
+
observe = jest.fn();
|
|
45
|
+
unobserve = jest.fn();
|
|
46
|
+
disconnect = jest.fn();
|
|
47
|
+
|
|
48
|
+
window.IntersectionObserver = jest.fn(function () {
|
|
49
|
+
this.observe = observe;
|
|
50
|
+
this.unobserve = unobserve;
|
|
51
|
+
this.disconnect = disconnect;
|
|
52
|
+
});
|
|
53
|
+
it('renders a button with label', () => {
|
|
54
|
+
const { getByText } = render(<Animation {...Animation.args} />);
|
|
55
|
+
|
|
56
|
+
expect(getByText('Count up label')).toBeInTheDocument();
|
|
57
|
+
expect(getByText('Start')).toBeInTheDocument();
|
|
58
|
+
expect(getByText('Reset')).toBeInTheDocument();
|
|
59
|
+
expect(getByText('Pause/Resume')).toBeInTheDocument();
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
describe('Custom component', () => {
|
|
64
|
+
it('renders a button with label', () => {
|
|
65
|
+
const { getByText, getAllByText } = render(<Custom {...Custom.args} />);
|
|
66
|
+
|
|
67
|
+
Custom.args.elements.forEach((element) => {
|
|
68
|
+
expect(getByText(element.value)).toBeInTheDocument();
|
|
69
|
+
expect(getByText(element.label)).toBeInTheDocument();
|
|
70
|
+
});
|
|
71
|
+
expect(getAllByText('Text from slate')).toHaveLength(3);
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
describe('Group component', () => {
|
|
76
|
+
it('renders a button with label', () => {
|
|
77
|
+
const { getByText } = render(<Group {...Group.args} />);
|
|
78
|
+
|
|
79
|
+
Group.args.elements.forEach((element) => {
|
|
80
|
+
expect(getByText(element.value)).toBeInTheDocument();
|
|
81
|
+
expect(getByText(element.label)).toBeInTheDocument();
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
describe('Default component', () => {
|
|
87
|
+
it('renders a button with label', () => {
|
|
88
|
+
const { getByText } = render(<Default {...Default.args} />);
|
|
89
|
+
|
|
90
|
+
expect(getByText(Default.args.label)).toBeInTheDocument();
|
|
91
|
+
expect(getByText(Default.args.value)).toBeInTheDocument();
|
|
92
|
+
});
|
|
93
|
+
});
|
|
@@ -270,9 +270,17 @@ function SortableTableContent({
|
|
|
270
270
|
key={item.key}
|
|
271
271
|
textAlign="center"
|
|
272
272
|
sorted={column === item.key ? direction : null}
|
|
273
|
+
tabIndex={0}
|
|
273
274
|
onClick={() =>
|
|
274
275
|
dispatch({ type: 'CHANGE_SORT', column: item.key })
|
|
275
276
|
}
|
|
277
|
+
onKeyDown={(event) => {
|
|
278
|
+
if (event.key === 'Enter') {
|
|
279
|
+
event.preventDefault();
|
|
280
|
+
event.target.click();
|
|
281
|
+
}
|
|
282
|
+
}}
|
|
283
|
+
aria-label={direction ? direction + ` sorted ` : ''}
|
|
276
284
|
>
|
|
277
285
|
{item.name}
|
|
278
286
|
</Table.HeaderCell>
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render, fireEvent } from '@testing-library/react';
|
|
3
|
+
import { Default, Sortable, Responsive } from './Table.stories';
|
|
4
|
+
import '@testing-library/jest-dom/extend-expect';
|
|
5
|
+
|
|
6
|
+
describe('Responsive component', () => {
|
|
7
|
+
it('renders corectly', () => {
|
|
8
|
+
const { getByText } = render(<Responsive {...Responsive.args} />);
|
|
9
|
+
|
|
10
|
+
Responsive.args.headers.forEach((element) => {
|
|
11
|
+
expect(getByText(element.name)).toBeInTheDocument();
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
Responsive.args.tableData.forEach((element) => {
|
|
15
|
+
expect(getByText(element.col1)).toBeInTheDocument();
|
|
16
|
+
expect(getByText(element.col2)).toBeInTheDocument();
|
|
17
|
+
expect(getByText(element.col3)).toBeInTheDocument();
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
describe('Sortable component', () => {
|
|
23
|
+
it('renders corectly', () => {
|
|
24
|
+
const { getByText } = render(<Sortable {...Sortable.args} />);
|
|
25
|
+
|
|
26
|
+
Sortable.args.headers.forEach((element) => {
|
|
27
|
+
expect(getByText(element.name)).toBeInTheDocument();
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
Sortable.args.tableData.forEach((element) => {
|
|
31
|
+
expect(getByText(element.col1)).toBeInTheDocument();
|
|
32
|
+
expect(getByText(element.col2)).toBeInTheDocument();
|
|
33
|
+
expect(getByText(element.col3)).toBeInTheDocument();
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
fireEvent.click(getByText(Sortable.args.headers[0].name));
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
describe('Default component', () => {
|
|
41
|
+
it('renders corectly', () => {
|
|
42
|
+
const { getByText } = render(<Default {...Default.args} />);
|
|
43
|
+
|
|
44
|
+
Default.args.headers.forEach((element) => {
|
|
45
|
+
expect(getByText(element.name)).toBeInTheDocument();
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
Default.args.tableData.forEach((element) => {
|
|
49
|
+
expect(getByText(element.col1)).toBeInTheDocument();
|
|
50
|
+
expect(getByText(element.col2)).toBeInTheDocument();
|
|
51
|
+
expect(getByText(element.col3)).toBeInTheDocument();
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
});
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render } from '@testing-library/react';
|
|
3
|
+
import {
|
|
4
|
+
Default,
|
|
5
|
+
DefaultReversed,
|
|
6
|
+
Multiple,
|
|
7
|
+
MultipleReversed,
|
|
8
|
+
} from './Timeline.stories';
|
|
9
|
+
import '@testing-library/jest-dom/extend-expect';
|
|
10
|
+
|
|
11
|
+
describe('MultipleReversed component', () => {
|
|
12
|
+
it('renders corectly', () => {
|
|
13
|
+
const { getAllByText } = render(
|
|
14
|
+
<MultipleReversed {...MultipleReversed.args} />,
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
expect(getAllByText(MultipleReversed.args.items[0].time)).toHaveLength(3);
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
describe('Multiple component', () => {
|
|
22
|
+
it('renders corectly', () => {
|
|
23
|
+
const { getAllByText } = render(<Multiple {...Multiple.args} />);
|
|
24
|
+
|
|
25
|
+
expect(getAllByText(Multiple.args.items[0].time)).toHaveLength(3);
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
describe('DefaultReversed component', () => {
|
|
30
|
+
it('renders corectly', () => {
|
|
31
|
+
const { getByText } = render(<DefaultReversed {...DefaultReversed.args} />);
|
|
32
|
+
|
|
33
|
+
expect(getByText(DefaultReversed.args.time)).toBeInTheDocument();
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
describe('Default component', () => {
|
|
38
|
+
it('renders corectly', () => {
|
|
39
|
+
const { getByText } = render(<Default {...Default.args} />);
|
|
40
|
+
|
|
41
|
+
expect(getByText(Default.args.time)).toBeInTheDocument();
|
|
42
|
+
});
|
|
43
|
+
});
|
package/src/ui/index.js
CHANGED
|
@@ -1,41 +1,21 @@
|
|
|
1
|
-
export Banner from './Banner/Banner';
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
export
|
|
10
|
-
|
|
11
|
-
export
|
|
12
|
-
|
|
13
|
-
export
|
|
14
|
-
|
|
15
|
-
export
|
|
16
|
-
|
|
17
|
-
export
|
|
18
|
-
|
|
19
|
-
export
|
|
20
|
-
|
|
21
|
-
export
|
|
22
|
-
|
|
23
|
-
export Testimonial from './Quote/Testimonial/Testimonial';
|
|
24
|
-
|
|
25
|
-
export KeyContent from './KeyContent/KeyContent';
|
|
26
|
-
|
|
27
|
-
export DownloadLabeledIcon from './DownloadLabeledIcon/DownloadLabeledIcon';
|
|
28
|
-
|
|
29
|
-
export NewTabLabeledIcon from './NewTabLabeledIcon/NewTabLabeledIcon';
|
|
30
|
-
|
|
31
|
-
export LabeledIconGroup from './LabeledIconGroup/LabeledIconGroup';
|
|
32
|
-
|
|
33
|
-
export LanguageLabeledIcon from './LanguageLabeledIcon/LanguageLabeledIcon';
|
|
34
|
-
|
|
35
|
-
export RelatedContent from './Card/RelatedContent/RelatedContent';
|
|
36
|
-
|
|
37
|
-
export Hero from './Hero/Hero';
|
|
38
|
-
|
|
39
|
-
export Copyright from './Copyright/Copyright';
|
|
40
|
-
|
|
41
|
-
export Video from './Video/Video';
|
|
1
|
+
export { default as Banner } from './Banner/Banner';
|
|
2
|
+
export { default as Callout } from './Callout/Callout';
|
|
3
|
+
export { default as Breadcrumbs } from './Breadcrumbs/Breadcrumbs';
|
|
4
|
+
export { default as Tag } from './Tag/Tag';
|
|
5
|
+
export { default as TagList } from './TagList/TagList';
|
|
6
|
+
export { default as Footer } from './Footer/Footer';
|
|
7
|
+
export { default as Header } from './Header/Header';
|
|
8
|
+
export { default as InpageNavigation } from './InpageNavigation/InpageNavigation';
|
|
9
|
+
export { default as Logo } from './Logo/Logo';
|
|
10
|
+
export { default as Quote } from './Quote/Quote';
|
|
11
|
+
export { default as Timeline } from './Timeline/Timeline';
|
|
12
|
+
export { default as Testimonial } from './Quote/Testimonial/Testimonial';
|
|
13
|
+
export { default as KeyContent } from './KeyContent/KeyContent';
|
|
14
|
+
export { default as DownloadLabeledIcon } from './DownloadLabeledIcon/DownloadLabeledIcon';
|
|
15
|
+
export { default as NewTabLabeledIcon } from './NewTabLabeledIcon/NewTabLabeledIcon';
|
|
16
|
+
export { default as LabeledIconGroup } from './LabeledIconGroup/LabeledIconGroup';
|
|
17
|
+
export { default as LanguageLabeledIcon } from './LanguageLabeledIcon/LanguageLabeledIcon';
|
|
18
|
+
export { default as RelatedContent } from './Card/RelatedContent/RelatedContent';
|
|
19
|
+
export { default as Hero } from './Hero/Hero';
|
|
20
|
+
export { default as Copyright } from './Copyright/Copyright';
|
|
21
|
+
export { default as Video } from './Video/Video';
|