@eeacms/volto-marine-policy 1.1.18 → 2.0.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 CHANGED
@@ -4,7 +4,44 @@ All notable changes to this project will be documented in this file. Dates are d
4
4
 
5
5
  Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
6
6
 
7
- ### [1.1.18](https://github.com/eea/volto-marine-policy/compare/1.1.17...1.1.18) - 10 July 2024
7
+ ### [2.0.0](https://github.com/eea/volto-marine-policy/compare/1.1.18...2.0.0) - 19 July 2024
8
+
9
+ #### :bug: Bug Fixes
10
+
11
+ - fix: minor fix [nileshgulia1 - [`7310c64`](https://github.com/eea/volto-marine-policy/commit/7310c646894d62b947b5f4a72d7ffcc42bbca9f2)]
12
+ - fix: add tests [nileshgulia1 - [`bcc22da`](https://github.com/eea/volto-marine-policy/commit/bcc22da492ed02e506f2f2b0c0f9f71567429459)]
13
+ - fix: update env vars for elastic_index [nileshgulia1 - [`704e9bf`](https://github.com/eea/volto-marine-policy/commit/704e9bf97190592ed3e03cf97c45e5568a03392c)]
14
+ - fix: add a custom theme widget for sub-theme refs#270459 [nileshgulia1 - [`cb9689b`](https://github.com/eea/volto-marine-policy/commit/cb9689b8ea430b80c04d4fe4ecff6d3b23818da5)]
15
+
16
+ #### :house: Internal changes
17
+
18
+ - chore(jenkins): test only with CI [nileshgulia1 - [`f79e5e8`](https://github.com/eea/volto-marine-policy/commit/f79e5e876541b42ae9b00ebcedef67eca1e25bc6)]
19
+ - chore:cleanup [nileshgulia1 - [`8ff1fec`](https://github.com/eea/volto-marine-policy/commit/8ff1fecfd6a1cbe484dfdababe155cb2d6cba7fb)]
20
+ - chore: remove d3-array resolutions [nileshgulia1 - [`94b8d35`](https://github.com/eea/volto-marine-policy/commit/94b8d358cf0f1265467af2e1e175b5091c2f70ee)]
21
+ - chore: pin addons to latest versions [nileshgulia1 - [`4a44533`](https://github.com/eea/volto-marine-policy/commit/4a44533b2b8a3be810b1cb13c68b9365ad80b457)]
22
+ - style: Automated code fix [eea-jenkins - [`79dd9e3`](https://github.com/eea/volto-marine-policy/commit/79dd9e32bcd1c0e16069b3d433047a2e4e9df415)]
23
+ - style: Automated code fix [eea-jenkins - [`e6e107d`](https://github.com/eea/volto-marine-policy/commit/e6e107d25a6262704411146b096ae7e2230c5a27)]
24
+
25
+ #### :hammer_and_wrench: Others
26
+
27
+ - pin volto-searchlib to 2.0.2 [nileshgulia1 - [`f08b01f`](https://github.com/eea/volto-marine-policy/commit/f08b01fb751eb64bdf2bb4ea9bd73a049ac475c9)]
28
+ - bump version [nileshgulia1 - [`6853ecd`](https://github.com/eea/volto-marine-policy/commit/6853ecdfcb7cbb78b57839047b8a638d1061f2d1)]
29
+ - make sonaqqube happy [nileshgulia1 - [`d4b52ff`](https://github.com/eea/volto-marine-policy/commit/d4b52ff4c57d233587f03b4f06d77eb906e47aaf)]
30
+ - pin d3-array": ^2.12.1 [nileshgulia1 - [`3ad72f8`](https://github.com/eea/volto-marine-policy/commit/3ad72f8652ef4e7e07f4824a9b5201d12f47a797)]
31
+ - update [nileshgulia1 - [`0c463f1`](https://github.com/eea/volto-marine-policy/commit/0c463f17b677130f91bb8dc6520c4f810fb60668)]
32
+ - update package.json with res [nileshgulia1 - [`015fd27`](https://github.com/eea/volto-marine-policy/commit/015fd27d2af44ac597e7859d34e4f17eb55de519)]
33
+ - update package.json [nileshgulia1 - [`d4cfbe9`](https://github.com/eea/volto-marine-policy/commit/d4cfbe91ec1e80b595e30559a2fee1a138b6d41f)]
34
+ - test:update [nileshgulia1 - [`61ed93a`](https://github.com/eea/volto-marine-policy/commit/61ed93abcff8a46f356c16d4e532bf8eac42cebb)]
35
+ - update [nileshgulia1 - [`c60cd26`](https://github.com/eea/volto-marine-policy/commit/c60cd26d19f0c5258207ac72213bad4cf8cf4da3)]
36
+ - update [nileshgulia1 - [`cf8895d`](https://github.com/eea/volto-marine-policy/commit/cf8895dc7839a82ff2967e6c0fc876b225080181)]
37
+ - pin addons to volto 17 compatible [nileshgulia1 - [`c054d6b`](https://github.com/eea/volto-marine-policy/commit/c054d6b8cc173d61b7ca52cb5143fb574b7a5e86)]
38
+ - few more tests [nileshgulia1 - [`b593f51`](https://github.com/eea/volto-marine-policy/commit/b593f5166f3a135afbc45371e40d8e7f191535d8)]
39
+ - fix customizations [nileshgulia1 - [`7428e73`](https://github.com/eea/volto-marine-policy/commit/7428e73c6fbaad9099f5959760d77be0b1f39429)]
40
+ - make logo also inverse on /marine/ [nileshgulia1 - [`8348ed6`](https://github.com/eea/volto-marine-policy/commit/8348ed618838265f6708da2acbd9ae9220ee2454)]
41
+ - remove volto-17 specific customiations that are needed for prefix-path as well [nileshgulia1 - [`7586b7c`](https://github.com/eea/volto-marine-policy/commit/7586b7cccecb59044cefbb6d9ce3ea602505f208)]
42
+ - test: add unit tests [ana-oprea - [`4a55e1d`](https://github.com/eea/volto-marine-policy/commit/4a55e1d2cda27a8bc75fe120093fa591d426d93b)]
43
+ - test: fix eslint errors and add unit tests [ana-oprea - [`0ce996b`](https://github.com/eea/volto-marine-policy/commit/0ce996bd32e89e8540f1626b712b7c59451a428b)]
44
+ ### [1.1.18](https://github.com/eea/volto-marine-policy/compare/1.1.17...1.1.18) - 11 July 2024
8
45
 
9
46
  #### :bug: Bug Fixes
10
47
 
package/babel.config.js CHANGED
@@ -2,6 +2,7 @@ module.exports = function (api) {
2
2
  api.cache(true);
3
3
  const presets = ['razzle'];
4
4
  const plugins = [
5
+ '@babel/plugin-proposal-export-default-from',
5
6
  [
6
7
  'react-intl', // React Intl extractor, required for the whole i18n infrastructure to work
7
8
  {
@@ -8,14 +8,18 @@ module.exports = {
8
8
  ],
9
9
  moduleNameMapper: {
10
10
  '\\.(css|less|scss|sass)$': 'identity-obj-proxy',
11
+ '@plone-collective/volto-authomatic/(.*)$':
12
+ '<rootDir>/node_modules/@plone-collective/volto-authomatic/src/$1',
11
13
  '@plone/volto/cypress': '<rootDir>/node_modules/@plone/volto/cypress',
12
14
  '@plone/volto/babel': '<rootDir>/node_modules/@plone/volto/babel',
13
15
  '@plone/volto/(.*)$': '<rootDir>/node_modules/@plone/volto/src/$1',
14
16
  '@package/(.*)$': '<rootDir>/node_modules/@plone/volto/src/$1',
15
17
  '@root/(.*)$': '<rootDir>/node_modules/@plone/volto/src/$1',
16
18
  '@plone/volto-quanta/(.*)$': '<rootDir>/src/addons/volto-quanta/src/$1',
17
- '@eeacms/search/(.*)$': '<rootDir>/src/addons/volto-searchlib/searchlib/$1',
18
- '@eeacms/search': '<rootDir>/src/addons/volto-searchlib/searchlib',
19
+ '@eeacms/search/(.*)$':
20
+ '<rootDir>/node_modules/@eeacms/volto-searchlib/searchlib/$1',
21
+ '@eeacms/search':
22
+ '<rootDir>/node_modules/@eeacms/volto-searchlib/searchlib',
19
23
  '@eeacms/(.*?)/(.*)$': '<rootDir>/node_modules/@eeacms/$1/src/$2',
20
24
  '@plone/volto-slate$':
21
25
  '<rootDir>/node_modules/@plone/volto/packages/volto-slate/src',
@@ -26,25 +30,26 @@ module.exports = {
26
30
  '<rootDir>/node_modules/@plone/volto/jest-addons-loader.js',
27
31
  },
28
32
  transformIgnorePatterns: [
29
- '/node_modules/(?!(@plone|@root|@package|@eeacms)/).*/',
33
+ '/node_modules/(?!(@plone|@root|@package|@eeacms|@plone-collective)/).*/',
30
34
  ],
31
35
  transform: {
32
36
  '^.+\\.js(x)?$': 'babel-jest',
37
+ '^.+\\.ts(x)?$': 'babel-jest',
33
38
  '^.+\\.(png)$': 'jest-file',
34
39
  '^.+\\.(jpg)$': 'jest-file',
35
40
  '^.+\\.(svg)$': './node_modules/@plone/volto/jest-svgsystem-transform.js',
36
41
  },
37
42
  coverageThreshold: {
38
43
  global: {
39
- branches: 1,
40
- functions: 1,
41
- lines: 1,
42
- statements: 1,
44
+ branches: 5,
45
+ functions: 5,
46
+ lines: 5,
47
+ statements: 5,
43
48
  },
44
49
  },
45
50
  ...(process.env.JEST_USE_SETUP === 'ON' && {
46
51
  setupFilesAfterEnv: [
47
- '<rootDir>/node_modules/@eeacms/volto-marine-policy/jest.setup.js',
52
+ '<rootDir>/node_modules/@eeacms/volto-eea-website-policy/jest.setup.js',
48
53
  ],
49
54
  }),
50
55
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-marine-policy",
3
- "version": "1.1.18",
3
+ "version": "2.0.0",
4
4
  "description": "@eeacms/volto-marine-policy: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -16,32 +16,33 @@
16
16
  "type": "git",
17
17
  "url": "git@github.com:eea/volto-marine-policy.git"
18
18
  },
19
- "resolutions": {
20
- "react-countup/countup.js": "2.5.0",
21
- "d3-array": "^2.12.1",
22
- "@elastic/search-ui": "1.21.2",
23
- "@eeacms/volto-searchlib": "^0.9.3"
24
- },
25
19
  "addons": [
26
20
  "@eeacms/volto-tabs-block",
27
21
  "@eeacms/volto-embed",
28
22
  "@eeacms/volto-eea-design-system",
29
23
  "@eeacms/volto-eea-website-theme",
30
- "@eeacms/volto-globalsearch",
31
- "@eeacms/volto-searchlib"
24
+ "@eeacms/volto-globalsearch"
32
25
  ],
26
+ "resolutions": {
27
+ "react-countup/countup.js": "2.5.0",
28
+ "d3-array": "^2.12.1",
29
+ "@eeacms/volto-searchlib": "1.0.0",
30
+ "@eeacms/countup": "^2.0.6",
31
+ "@elastic/search-ui": "1.21.2"
32
+ },
33
33
  "dependencies": {
34
34
  "@eeacms/volto-eea-design-system": "*",
35
- "@eeacms/volto-eea-website-theme": "^1.33.2",
36
- "@eeacms/volto-embed": "^9.1.1",
37
- "@eeacms/volto-globalsearch": "^1.0.20",
38
- "@eeacms/volto-searchlib": "^0.6.3",
39
- "@eeacms/volto-tabs-block": "*",
35
+ "@eeacms/volto-eea-website-theme": "^2.1.2",
36
+ "@eeacms/volto-searchlib": "^2.0.2",
37
+ "@eeacms/volto-embed": "^10.0.2",
38
+ "@eeacms/volto-globalsearch": "^2.0.0",
39
+ "@eeacms/volto-tabs-block": "^8.0.0",
40
40
  "axios": "0.25.0",
41
41
  "jquery": "3.6.0",
42
42
  "razzle-plugin-scss": "^4.2.18",
43
43
  "react-lazy-load-image-component": "^1.4.0",
44
44
  "react-slick": "^0.24.0",
45
+ "d3-array": "^2.12.1",
45
46
  "slick-carousel": "^1.8.1"
46
47
  },
47
48
  "devDependencies": {
@@ -49,7 +50,11 @@
49
50
  "@cypress/code-coverage": "^3.9.5",
50
51
  "@plone/scripts": "2.1.1",
51
52
  "babel-plugin-transform-class-properties": "^6.24.1",
52
- "dotenv": "^16.3.2"
53
+ "cypress": "13.1.0",
54
+ "dotenv": "^16.3.2",
55
+ "husky": "^8.0.3",
56
+ "lint-staged": "^14.0.1",
57
+ "md5": "^2.3.0"
53
58
  },
54
59
  "scripts": {
55
60
  "release": "release-it",
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { MemoryRouter } from 'react-router-dom';
3
3
  import configureStore from 'redux-mock-store';
4
- import { render } from '@testing-library/react';
4
+ import { render, fireEvent, waitFor, screen } from '@testing-library/react';
5
5
  import '@testing-library/jest-dom/extend-expect';
6
6
  import { Provider } from 'react-intl-redux';
7
7
  import Accordion from './Accordion';
@@ -9,22 +9,11 @@ import Accordion from './Accordion';
9
9
  const mockStore = configureStore();
10
10
 
11
11
  describe('RASTAccordion', () => {
12
- it('should render the component', () => {
13
- const data = {
14
- items: [
15
- {
16
- id: 'my-item',
17
- title: 'Hello',
18
- '@id': '/my-item',
19
- '@type': 'Folder',
20
- href: '/my-item-href',
21
- },
22
- ],
23
- activeMenu: 1,
24
- curent_location: '/my-item-href',
25
- };
12
+ let store;
13
+ let data;
26
14
 
27
- const store = mockStore({
15
+ beforeEach(() => {
16
+ store = mockStore({
28
17
  userSession: { token: '1234' },
29
18
  intl: {
30
19
  locale: 'en',
@@ -35,6 +24,56 @@ describe('RASTAccordion', () => {
35
24
  },
36
25
  });
37
26
 
27
+ data = {
28
+ items: [
29
+ {
30
+ id: 'item1',
31
+ title: 'Item 1',
32
+ '@id': '/item1',
33
+ '@type': 'Folder',
34
+ href: '/item1-href',
35
+ },
36
+ {
37
+ id: 'item2',
38
+ title: 'Item 2',
39
+ '@id': '/item2',
40
+ '@type': 'Folder',
41
+ href: '/item2-href',
42
+ },
43
+ ],
44
+ activeMenu: 1,
45
+ curent_location: '/item1-href',
46
+ data: { title: "Accordion's Title" },
47
+ };
48
+ });
49
+
50
+ it('renders the component with initial data', () => {
51
+ const { getByText } = render(
52
+ <Provider store={store}>
53
+ <MemoryRouter>
54
+ <Accordion {...data} />
55
+ </MemoryRouter>
56
+ </Provider>,
57
+ );
58
+
59
+ expect(getByText('Item 1')).toBeInTheDocument();
60
+ expect(getByText('Item 2')).toBeInTheDocument();
61
+ });
62
+
63
+ it('navigates to correct path on item click', () => {
64
+ const { getByText, history } = render(
65
+ <Provider store={store}>
66
+ <MemoryRouter>
67
+ <Accordion {...data} />
68
+ </MemoryRouter>
69
+ </Provider>,
70
+ );
71
+
72
+ fireEvent.click(getByText('Item 1'));
73
+ waitFor(() => expect(history.location.pathname).toBe('/item1'));
74
+ });
75
+
76
+ it('clicks on accordion items', () => {
38
77
  const { container } = render(
39
78
  <Provider store={store}>
40
79
  <MemoryRouter>
@@ -42,6 +81,26 @@ describe('RASTAccordion', () => {
42
81
  </MemoryRouter>
43
82
  </Provider>,
44
83
  );
45
- expect(container.querySelector('.accordion')).toBeInTheDocument();
84
+
85
+ screen.debug();
86
+
87
+ // check that item1 is expanded by default
88
+ expect(container.querySelector('#item2 .active.title')).toBeInTheDocument();
89
+
90
+ const item1 = container.querySelector('#item1');
91
+ fireEvent.click(item1);
92
+ });
93
+
94
+ it('responds to keyboard events', () => {
95
+ const { getByText } = render(
96
+ <Provider store={store}>
97
+ <MemoryRouter>
98
+ <Accordion {...data} />
99
+ </MemoryRouter>
100
+ </Provider>,
101
+ );
102
+
103
+ fireEvent.keyDown(getByText('Item 1'), { keyCode: 13 }); // Enter key
104
+ waitFor(() => expect(getByText('Content of Item 1')).toBeVisible());
46
105
  });
47
106
  });
@@ -1,6 +1,6 @@
1
1
  const fields = ['root_path', 'title', 'types'];
2
2
 
3
- export default ({ contentTypes }) => {
3
+ const schema = ({ contentTypes }) => {
4
4
  const availableTypes = contentTypes.map((type) => [
5
5
  type.id,
6
6
  type.title || type.name,
@@ -39,3 +39,5 @@ export default ({ contentTypes }) => {
39
39
  required: [],
40
40
  };
41
41
  };
42
+
43
+ export default schema;
@@ -0,0 +1,42 @@
1
+ import { render, waitFor, screen } from '@testing-library/react';
2
+ import axios from 'axios';
3
+ import '@testing-library/jest-dom/extend-expect';
4
+
5
+ import MsfdDataExplorerBlockView from './View';
6
+
7
+ jest.mock('axios');
8
+
9
+ describe('MsfdDataExplorerBlockView', () => {
10
+ const mockHtmlResponse = '<div class="msfd-search-wrapper">Content</div>';
11
+
12
+ beforeEach(() => {
13
+ axios.get.mockClear();
14
+ });
15
+
16
+ it('should prompt to select an article when none is selected', () => {
17
+ const { getByText } = render(
18
+ <MsfdDataExplorerBlockView data={{}} editable={true} />,
19
+ );
20
+ expect(getByText('Select article')).toBeInTheDocument();
21
+ });
22
+
23
+ it('displays loader while fetching data', () => {
24
+ axios.get.mockResolvedValueOnce({ data: mockHtmlResponse });
25
+ render(
26
+ <MsfdDataExplorerBlockView
27
+ Network={false}
28
+ data={{ article_select: 'article1' }}
29
+ />,
30
+ );
31
+ expect(screen.getByText('Loading')).toBeInTheDocument();
32
+ });
33
+
34
+ it('renders content upon successful data fetch', async () => {
35
+ axios.get.mockResolvedValueOnce({ data: mockHtmlResponse });
36
+ render(<MsfdDataExplorerBlockView data={{ article_select: 'article1' }} />);
37
+
38
+ await waitFor(() => {
39
+ expect(screen.getByText('Content')).toBeInTheDocument();
40
+ });
41
+ });
42
+ });
@@ -2,7 +2,7 @@ import worldSVG from '@plone/volto/icons/world.svg';
2
2
  import MsfdDataExplorerBlockView from './View';
3
3
  import MsfdDataExplorerBlockEdit from './Edit';
4
4
 
5
- export default (config) => {
5
+ const config = (config) => {
6
6
  config.blocks.blocksConfig.msfdDataExplorerBlock = {
7
7
  id: 'msfdDataExplorerBlock',
8
8
  title: 'MSFD Data explorer block',
@@ -21,3 +21,5 @@ export default (config) => {
21
21
  };
22
22
  return config;
23
23
  };
24
+
25
+ export default config;
@@ -21,7 +21,7 @@ function IsomorphicPortal({ children }) {
21
21
  }
22
22
 
23
23
  const MeasureView = (props) => {
24
- const { origin } = props?.content;
24
+ const { origin } = props.content;
25
25
 
26
26
  //conditional fields shown in view based on origin of measure
27
27
  const conditions = {
@@ -1,15 +1,15 @@
1
1
  import React from 'react';
2
2
 
3
- const String = ({ val }) => {
3
+ const StringWidget = ({ val }) => {
4
4
  return typeof val === 'string'
5
5
  ? val
6
6
  : Array.isArray(val)
7
7
  ? val.map((item, i) => (
8
8
  <span key={i} className="array-string-item">
9
- <String val={item} key={i} />
9
+ <StringWidget val={item} key={i} />
10
10
  </span>
11
11
  ))
12
12
  : `${val}`;
13
13
  };
14
14
 
15
- export default String;
15
+ export default StringWidget;
@@ -14,7 +14,7 @@ const VALUE_MAP = [
14
14
  ['justify', alignJustifySVG],
15
15
  ];
16
16
 
17
- export default (props) => {
17
+ function TextAlign(props) {
18
18
  const { value, onChange, id } = props;
19
19
  return (
20
20
  <FormFieldWrapper {...props}>
@@ -38,4 +38,6 @@ export default (props) => {
38
38
  </div>
39
39
  </FormFieldWrapper>
40
40
  );
41
- };
41
+ }
42
+
43
+ export default TextAlign;
@@ -0,0 +1,33 @@
1
+ import React from 'react';
2
+ import renderer from 'react-test-renderer';
3
+ import configureStore from 'redux-mock-store';
4
+ import { Provider } from 'react-intl-redux';
5
+
6
+ import TextAlign from './TextAlign';
7
+
8
+ const mockStore = configureStore();
9
+
10
+ test('renders a text align component', () => {
11
+ const store = mockStore({
12
+ intl: {
13
+ locale: 'en',
14
+ messages: {},
15
+ },
16
+ });
17
+
18
+ const component = renderer.create(
19
+ <Provider store={store}>
20
+ <TextAlign
21
+ id="my-field"
22
+ title="My field"
23
+ value="left"
24
+ fieldSet="default"
25
+ onChange={() => {}}
26
+ onBlur={() => {}}
27
+ onClick={() => {}}
28
+ />
29
+ </Provider>,
30
+ );
31
+ const json = component.toJSON();
32
+ expect(json).toMatchSnapshot();
33
+ });
@@ -1,7 +1,7 @@
1
1
  import ScrollToTop from './ScrollToTop';
2
2
  // import PrintPage from './PrintPage';
3
3
 
4
- export default (config) => {
4
+ const config = (config) => {
5
5
  config.settings.appExtras = [
6
6
  ...(config.settings.appExtras || []),
7
7
  {
@@ -16,3 +16,5 @@ export default (config) => {
16
16
 
17
17
  return config;
18
18
  };
19
+
20
+ export default config;
@@ -3,12 +3,8 @@ import React from 'react';
3
3
  import './less/herosection.less';
4
4
 
5
5
  function HeroSection(props) {
6
- const {
7
- image_caption,
8
- image_url,
9
- content_description,
10
- content_title,
11
- } = props;
6
+ const { image_caption, image_url, content_description, content_title } =
7
+ props;
12
8
 
13
9
  return (
14
10
  <>
@@ -0,0 +1,30 @@
1
+ import React from 'react';
2
+ import renderer from 'react-test-renderer';
3
+ import configureStore from 'redux-mock-store';
4
+ import { Provider } from 'react-intl-redux';
5
+
6
+ import HeroSection from './HeroSection';
7
+
8
+ const mockStore = configureStore();
9
+
10
+ test('renders Hero section component', () => {
11
+ const store = mockStore({
12
+ intl: {
13
+ locale: 'en',
14
+ messages: {},
15
+ },
16
+ });
17
+
18
+ const component = renderer.create(
19
+ <Provider store={store}>
20
+ <HeroSection
21
+ image_caption="caption"
22
+ image_url="https://www.google.com"
23
+ content_description="description"
24
+ content_title="title"
25
+ />
26
+ </Provider>,
27
+ );
28
+ const json = component.toJSON();
29
+ expect(json).toMatchSnapshot();
30
+ });
@@ -0,0 +1,25 @@
1
+ import React from 'react';
2
+ import renderer from 'react-test-renderer';
3
+ import configureStore from 'redux-mock-store';
4
+ import { Provider } from 'react-intl-redux';
5
+
6
+ import StickyHeader from './StickyHeader';
7
+
8
+ const mockStore = configureStore();
9
+
10
+ test('renders a sticky header component', () => {
11
+ const store = mockStore({
12
+ intl: {
13
+ locale: 'en',
14
+ messages: {},
15
+ },
16
+ });
17
+
18
+ const component = renderer.create(
19
+ <Provider store={store}>
20
+ <StickyHeader stickyBreakpoint={700} />
21
+ </Provider>,
22
+ );
23
+ const json = component.toJSON();
24
+ expect(json).toMatchSnapshot();
25
+ });
@@ -200,8 +200,8 @@ svg.selected {
200
200
  width: 32px;
201
201
  height: 32px;
202
202
  padding: 2px !important;
203
- background-color: @orange !important;
204
203
  border-radius: 3px !important;
204
+ background-color: @orange !important;
205
205
  color: @white !important;
206
206
 
207
207
  &:hover {
@@ -590,8 +590,8 @@ class Toolbar extends Component {
590
590
  messages.shrinkToolbar,
591
591
  )}
592
592
  className={cx({
593
- [this.props.content?.review_state]: this.props.content
594
- ?.review_state,
593
+ [this.props.content?.review_state]:
594
+ this.props.content?.review_state,
595
595
  })}
596
596
  onClick={this.handleShrink}
597
597
  />
package/src/index.js CHANGED
@@ -170,11 +170,10 @@ const applyConfig = (config) => {
170
170
  },
171
171
  ];
172
172
 
173
- // do not expand breadcrumbs. This fixed the breadcrumbs in contents view. The hasApiExpander needs to be made
174
- // generic to also look for nonContentRoutes.
173
+ //In volto 17, we expand everyting by-default. Do not expand navigation, required for fat-menu to work
175
174
  (config.settings.apiExpanders || []).forEach((item) => {
176
- if (item.GET_CONTENT.includes('breadcrumbs')) {
177
- item.GET_CONTENT.splice(item.GET_CONTENT.indexOf('breadcrumbs', 1));
175
+ if (item.GET_CONTENT.includes('navigation')) {
176
+ item.GET_CONTENT.splice(item.GET_CONTENT.indexOf('navigation', 1));
178
177
  }
179
178
  });
180
179
 
@@ -236,8 +235,7 @@ const applyConfig = (config) => {
236
235
  // },
237
236
  {
238
237
  match: {
239
- path:
240
- '/(.*)marine(-new)?/policy-and-reporting/reports-and-assessments(.*)',
238
+ path: '/(.*)marine(-new)?/policy-and-reporting/reports-and-assessments(.*)',
241
239
  exact: false,
242
240
  strict: false,
243
241
  },
@@ -104,6 +104,8 @@ const facets = [
104
104
  }),
105
105
  ];
106
106
 
107
- export default {
107
+ const facetsObj = {
108
108
  facets,
109
109
  };
110
+
111
+ export default facetsObj;
@@ -1,4 +1,4 @@
1
- export default {
1
+ const views = {
2
2
  resultViews: [
3
3
  {
4
4
  id: 'marineMeasureCard',
@@ -55,3 +55,5 @@ export default {
55
55
  ],
56
56
  },
57
57
  };
58
+
59
+ export default views;
@@ -0,0 +1,70 @@
1
+ import {
2
+ getPath,
3
+ getScaleUrl,
4
+ formatItemType,
5
+ doStringifySearchquery,
6
+ deStringifySearchquery,
7
+ } from './utils';
8
+
9
+ describe('getPath', () => {
10
+ it('returns the pathname for a fully qualified URL', () => {
11
+ const url = 'http://example.com/some/path';
12
+ expect(getPath(url)).toBe('/some/path');
13
+ });
14
+
15
+ it('returns the input URL if it is not fully qualified', () => {
16
+ const url = '/some/path';
17
+ expect(getPath(url)).toBe(url);
18
+ });
19
+
20
+ it('handles edge case with no input', () => {
21
+ expect(getPath('')).toBe('');
22
+ });
23
+ });
24
+
25
+ describe('getScaleUrl', () => {
26
+ it('returns a scaled image URL for internal API URLs', () => {
27
+ const url = '/api/some/path';
28
+ const size = 'large';
29
+ expect(getScaleUrl(url, size)).toBe('/some/path/@@images/image/large');
30
+ });
31
+
32
+ it('returns a scaled image URL for external URLs', () => {
33
+ const url = 'http://example.com/api/some/path';
34
+ const size = 'medium';
35
+ expect(getScaleUrl(url, size)).toBe(
36
+ 'http://example.com/some/path/@@images/image/medium',
37
+ );
38
+ });
39
+
40
+ it('handles null inputs', () => {
41
+ expect(getScaleUrl(null, 'small')).toBe('undefined/@@images/image/small');
42
+ });
43
+ });
44
+
45
+ describe('formatItemType', () => {
46
+ it('formats item types correctly', () => {
47
+ expect(formatItemType('type_example')).toBe('Type / Example');
48
+ });
49
+
50
+ it('returns an empty string for empty input', () => {
51
+ expect(formatItemType('')).toBe('');
52
+ });
53
+
54
+ it('handles types without underscores', () => {
55
+ expect(formatItemType('typeexample')).toBe('Typeexample');
56
+ });
57
+ });
58
+
59
+ describe('Search query conversion', () => {
60
+ const queryString = 'key1=value1&key2=value2';
61
+ const jsonString = '{"key1":["value1"],"key2":["value2"]}';
62
+
63
+ it('converts query string to JSON string', () => {
64
+ expect(doStringifySearchquery(queryString)).toBe(jsonString);
65
+ });
66
+
67
+ it('converts JSON string to query string', () => {
68
+ expect(deStringifySearchquery(jsonString)).toBe(queryString);
69
+ });
70
+ });