@eeacms/volto-cca-policy 0.1.92 → 0.1.94
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/.eslintrc.js +61 -0
- package/CHANGELOG.md +72 -8
- package/babel.config.js +2 -1
- package/jest-addon.config.js +18 -4
- package/jest.setup.js +65 -0
- package/locales/de/LC_MESSAGES/volto.po +551 -0
- package/locales/eea.pot +18 -0
- package/locales/en/LC_MESSAGES/volto.po +551 -0
- package/locales/it/LC_MESSAGES/volto.po +551 -0
- package/locales/pl/LC_MESSAGES/volto.po +565 -0
- package/locales/ro/LC_MESSAGES/volto.po +551 -0
- package/locales/volto.pot +552 -1
- package/package.json +1 -1
- package/src/components/MigrationButtons.jsx +48 -35
- package/src/components/index.js +1 -0
- package/src/components/manage/Blocks/CaseStudyExplorer/CaseStudyFilters.jsx +14 -2
- package/src/components/manage/Blocks/CollectionStatistics/CollectionStatsEdit.jsx +4 -1
- package/src/components/manage/Blocks/CountryMapHeatIndex/Filter.jsx +44 -8
- package/src/components/manage/Blocks/FilterAceContent/FilterAceContentView.jsx +7 -2
- package/src/components/manage/Blocks/Listing/EventCardsListingView.jsx +54 -16
- package/src/components/manage/Blocks/Listing/OrganisationCardsListingView.jsx +21 -46
- package/src/components/manage/TransparentOverlay.jsx +11 -0
- package/src/components/theme/Header.jsx +0 -2
- package/src/components/theme/TranslationDisclaimer/TranslationDisclaimer.jsx +98 -0
- package/src/components/theme/Views/AdaptationOptionView.jsx +106 -54
- package/src/components/theme/Views/C3SIndicatorView.jsx +12 -7
- package/src/components/theme/Views/CaseStudyView.jsx +84 -20
- package/src/components/theme/Views/CcaEventView.jsx +5 -1
- package/src/components/theme/Views/DatabaseItemView.jsx +40 -29
- package/src/components/theme/Views/DatabaseItemView.test.jsx +10 -0
- package/src/components/theme/Views/EventView.jsx +12 -3
- package/src/components/theme/Views/NewsItemView.jsx +2 -0
- package/src/components/theme/Views/ProjectView.jsx +31 -27
- package/src/components/theme/Views/VideoView.jsx +5 -1
- package/src/customizations/volto/components/theme/View/DefaultView.jsx +6 -1
- package/src/helpers/ContentMetadata.jsx +204 -40
- package/src/helpers/ShareInfo.jsx +20 -8
- package/src/helpers/Utils.jsx +196 -27
- package/src/helpers/index.js +26 -2
- package/src/index.js +46 -126
- package/theme/elements/list.variables +9 -0
- package/theme/globals/views.less +32 -9
package/.eslintrc.js
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const projectRootPath = fs.realpathSync(__dirname + '/../../../');
|
|
4
|
+
|
|
5
|
+
let voltoPath = path.join(projectRootPath, 'node_modules/@plone/volto');
|
|
6
|
+
let configFile;
|
|
7
|
+
if (fs.existsSync(`${projectRootPath}/tsconfig.json`))
|
|
8
|
+
configFile = `${projectRootPath}/tsconfig.json`;
|
|
9
|
+
else if (fs.existsSync(`${projectRootPath}/jsconfig.json`))
|
|
10
|
+
configFile = `${projectRootPath}/jsconfig.json`;
|
|
11
|
+
|
|
12
|
+
if (configFile) {
|
|
13
|
+
const jsConfig = require(configFile).compilerOptions;
|
|
14
|
+
const pathsConfig = jsConfig.paths;
|
|
15
|
+
if (pathsConfig['@plone/volto'])
|
|
16
|
+
voltoPath = `./${jsConfig.baseUrl}/${pathsConfig['@plone/volto'][0]}`;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const AddonConfigurationRegistry = require(`${voltoPath}/addon-registry.js`);
|
|
20
|
+
const reg = new AddonConfigurationRegistry(projectRootPath);
|
|
21
|
+
|
|
22
|
+
// Extends ESlint configuration for adding the aliases to `src` directories in Volto addons
|
|
23
|
+
const addonAliases = Object.keys(reg.packages).map((o) => [
|
|
24
|
+
o,
|
|
25
|
+
reg.packages[o].modulePath,
|
|
26
|
+
]);
|
|
27
|
+
|
|
28
|
+
const addonExtenders = reg.getEslintExtenders().map((m) => require(m));
|
|
29
|
+
|
|
30
|
+
const defaultConfig = {
|
|
31
|
+
extends: `${voltoPath}/.eslintrc`,
|
|
32
|
+
settings: {
|
|
33
|
+
'import/resolver': {
|
|
34
|
+
alias: {
|
|
35
|
+
map: [
|
|
36
|
+
['@plone/volto', '@plone/volto/src'],
|
|
37
|
+
['@plone/volto-slate', '@plone/volto/packages/volto-slate/src'],
|
|
38
|
+
['@root/routes', '@plone/volto/src'],
|
|
39
|
+
...addonAliases,
|
|
40
|
+
['@package', `${__dirname}/src`],
|
|
41
|
+
// ['@root', `${__dirname}/src`],
|
|
42
|
+
['~', `${__dirname}/src`],
|
|
43
|
+
],
|
|
44
|
+
extensions: ['.js', '.jsx', '.json'],
|
|
45
|
+
},
|
|
46
|
+
'babel-plugin-root-import': {
|
|
47
|
+
rootPathSuffix: 'src',
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
rules: {
|
|
52
|
+
'react/jsx-no-target-blank': 'off',
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const config = addonExtenders.reduce(
|
|
57
|
+
(acc, extender) => extender.modify(acc),
|
|
58
|
+
defaultConfig,
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
module.exports = config;
|
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,78 @@ 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
|
+
### [0.1.94](https://github.com/eea/volto-cca-policy/compare/0.1.93...0.1.94) - 13 March 2024
|
|
8
|
+
|
|
9
|
+
#### :rocket: New Features
|
|
10
|
+
|
|
11
|
+
- feat: add translation disclaimer [kreafox - [`5501cb3`](https://github.com/eea/volto-cca-policy/commit/5501cb38b127adc5b0b2a795339e2a9f3cff5fbb)]
|
|
12
|
+
- feat(views): add read more for long list of contributions [kreafox - [`d67099e`](https://github.com/eea/volto-cca-policy/commit/d67099eab657feea1b790108ea4a6a3406960773)]
|
|
13
|
+
- feat(views): add contributions link [kreafox - [`e0cad4c`](https://github.com/eea/volto-cca-policy/commit/e0cad4caaa42028a40fe01d698d88b4dda3bccfd)]
|
|
14
|
+
|
|
15
|
+
#### :nail_care: Enhancements
|
|
16
|
+
|
|
17
|
+
- change(lists): use List from semantic UI [kreafox - [`53ff919`](https://github.com/eea/volto-cca-policy/commit/53ff9196a608dffeb2cb6a6778b151383a44388b)]
|
|
18
|
+
- change(views) : show Observatory contributions [kreafox - [`c03fff4`](https://github.com/eea/volto-cca-policy/commit/c03fff408f73f0916ef10f7c7a56f96f71df567e)]
|
|
19
|
+
|
|
20
|
+
#### :house: Internal changes
|
|
21
|
+
|
|
22
|
+
- style(disclaimer): change color [kreafox - [`ded2a43`](https://github.com/eea/volto-cca-policy/commit/ded2a43270e30b9c948989875698cc9236b709df)]
|
|
23
|
+
|
|
24
|
+
#### :hammer_and_wrench: Others
|
|
25
|
+
|
|
26
|
+
- Refs #266914 - translate event view [Tripon Eugen - [`6f70578`](https://github.com/eea/volto-cca-policy/commit/6f70578b8f0e87204c5206c75cbd9c5859073ecd)]
|
|
27
|
+
- Add pl .po file [Tiberiu Ichim - [`0457389`](https://github.com/eea/volto-cca-policy/commit/0457389d0bd1e24a3d550dabaa67b4ccd16edbeb)]
|
|
28
|
+
- Refs #266914 - case study view and share your info [Tripon Eugen - [`86f6e38`](https://github.com/eea/volto-cca-policy/commit/86f6e3856b9bac49b858d2440d7a4c112749dfca)]
|
|
29
|
+
- Refs #266914 - view adaptation option [Tripon Eugen - [`0defa3e`](https://github.com/eea/volto-cca-policy/commit/0defa3e44f03057ae6e97cad083b9bac32180439)]
|
|
30
|
+
- Wip on i18n [Tiberiu Ichim - [`d6fbdef`](https://github.com/eea/volto-cca-policy/commit/d6fbdef18f8be50fbba0fc2e186b58f4cb875a2f)]
|
|
31
|
+
- Refs #266914 - translation wip [Tripon Eugen - [`1dbf724`](https://github.com/eea/volto-cca-policy/commit/1dbf724c78c86e5160c46b52c0f7ad9d4afcbc85)]
|
|
32
|
+
- Refs #266914 - translation wip content metadata tooltip [Tripon Eugen - [`49b9bba`](https://github.com/eea/volto-cca-policy/commit/49b9bba08060407becb9a17a9af08a1b4574a266)]
|
|
33
|
+
- Refs #266914 - translation wip [Tripon Eugen - [`70cf337`](https://github.com/eea/volto-cca-policy/commit/70cf337a04995c775d599feb33a5906914d0eff1)]
|
|
34
|
+
- Wip on i18n [Tiberiu Ichim - [`e380c2f`](https://github.com/eea/volto-cca-policy/commit/e380c2f55c1936a685b09b69396761b624a4788c)]
|
|
35
|
+
- WIP on i18n [Tiberiu Ichim - [`9534c85`](https://github.com/eea/volto-cca-policy/commit/9534c85ed2a195abffcc5f925f78b862563a8180)]
|
|
36
|
+
- WIP on i18n [Tiberiu Ichim - [`7bccdb2`](https://github.com/eea/volto-cca-policy/commit/7bccdb292722bc24f9ddd06882d1ada5dbfa8ecc)]
|
|
37
|
+
- test: update snapshots [kreafox - [`1121ab0`](https://github.com/eea/volto-cca-policy/commit/1121ab0a979be6a004042b3096bb534fa8c2e6e0)]
|
|
38
|
+
- test: update snapshots [kreafox - [`5c16fee`](https://github.com/eea/volto-cca-policy/commit/5c16fee32a7733fc83722f2f48a661fd982a7214)]
|
|
39
|
+
### [0.1.93](https://github.com/eea/volto-cca-policy/compare/0.1.92...0.1.93) - 8 March 2024
|
|
40
|
+
|
|
41
|
+
#### :rocket: New Features
|
|
42
|
+
|
|
43
|
+
- feat: add AnchorLink to smooth scroll to sections [kreafox - [`997d732`](https://github.com/eea/volto-cca-policy/commit/997d732e8cbb679e5944db5197174109fc7df315)]
|
|
44
|
+
|
|
45
|
+
#### :bug: Bug Fixes
|
|
46
|
+
|
|
47
|
+
- fix(views): show info only on observatory [kreafox - [`fbc7558`](https://github.com/eea/volto-cca-policy/commit/fbc7558b062c89af891d75c41735b334a1775594)]
|
|
48
|
+
- fix(views): fix case when we use thumbnail instead of logo [kreafox - [`0222507`](https://github.com/eea/volto-cca-policy/commit/02225070d6dea7211e4ecd5d8608ef6749590789)]
|
|
49
|
+
- fix:unable to resolve path to module @eeacms/search [ana-oprea - [`0abeaf3`](https://github.com/eea/volto-cca-policy/commit/0abeaf36b3123e3f9c738e1593681e39b78ca4c1)]
|
|
50
|
+
- fix(views): share info button link [kreafox - [`af797f0`](https://github.com/eea/volto-cca-policy/commit/af797f07571c95f94aef62ae680d72019493431d)]
|
|
51
|
+
- fix(views): fix metadata for db items [kreafox - [`cc81806`](https://github.com/eea/volto-cca-policy/commit/cc818068ed389a53ca517d95e81fad58a88bbebd)]
|
|
52
|
+
|
|
53
|
+
#### :nail_care: Enhancements
|
|
54
|
+
|
|
55
|
+
- change(views): update section layout on Adaptation Option [kreafox - [`3ee4fb7`](https://github.com/eea/volto-cca-policy/commit/3ee4fb7a378435555726cbb9f04c3914995d1643)]
|
|
56
|
+
- change(views): add IPCC metadata [kreafox - [`a66ad07`](https://github.com/eea/volto-cca-policy/commit/a66ad07be594c8dc1dbec1f5f7b0ef17c0116042)]
|
|
57
|
+
|
|
58
|
+
#### :house: Internal changes
|
|
59
|
+
|
|
60
|
+
- style(views): fix icon position in DocumentList [kreafox - [`7cc9fa8`](https://github.com/eea/volto-cca-policy/commit/7cc9fa8cf2b3bda26eafd17316ab4e8449e0c500)]
|
|
61
|
+
|
|
62
|
+
#### :hammer_and_wrench: Others
|
|
63
|
+
|
|
64
|
+
- Add transparent overlay for collection stats, to make it easier to select the block [Tiberiu Ichim - [`6c8507a`](https://github.com/eea/volto-cca-policy/commit/6c8507a928ffd53d8c6b5384ff492839bfc42c77)]
|
|
65
|
+
- Add another migration button [Tiberiu Ichim - [`5759f2c`](https://github.com/eea/volto-cca-policy/commit/5759f2cd5c4cca7937f74d3f398157ec120524b9)]
|
|
66
|
+
- update path [Teodor - [`0ddd49f`](https://github.com/eea/volto-cca-policy/commit/0ddd49f12cb3b33fba1fda0819b2967bd6948029)]
|
|
67
|
+
- cleanup code [kreafox - [`b096c4c`](https://github.com/eea/volto-cca-policy/commit/b096c4c71ab7c9d04acb2908c6a5e023af41801c)]
|
|
68
|
+
- update rule [Teodor - [`d6f0bba`](https://github.com/eea/volto-cca-policy/commit/d6f0bbabda5279b56a0cf3dcd395cea7852ed915)]
|
|
69
|
+
- test: update snapshots [kreafox - [`afde48c`](https://github.com/eea/volto-cca-policy/commit/afde48c32b461ec06592fc0adb195a4995170998)]
|
|
70
|
+
- test: Update jest,Jenkinsfile,lint to volto-addons-template PR30 [valentinab25 - [`0ab94c8`](https://github.com/eea/volto-cca-policy/commit/0ab94c8a8ff7c457b02ad2b177b79f2b18936e50)]
|
|
71
|
+
- remove eslintrc [Teodor - [`4020b91`](https://github.com/eea/volto-cca-policy/commit/4020b918d28efa18073fb87b011ab2702addf518)]
|
|
72
|
+
- eslintrc removed from gitignore [Teodor - [`f427a9c`](https://github.com/eea/volto-cca-policy/commit/f427a9c8baa29d20d41fd901dda039f251e6fdba)]
|
|
73
|
+
- revert razzle extend config [Teodor - [`b849609`](https://github.com/eea/volto-cca-policy/commit/b84960945009e9821c21a423f8d5f8eec3b21f80)]
|
|
74
|
+
- update eslint rule [Teodor - [`dc1b2c2`](https://github.com/eea/volto-cca-policy/commit/dc1b2c22caa3b0d2359d08093a12a33ee2c65a06)]
|
|
75
|
+
- add eslint rules [Teodor - [`8ab2af3`](https://github.com/eea/volto-cca-policy/commit/8ab2af3336f3c6b4416db1c79df1b9a44383f310)]
|
|
76
|
+
- Fix navigation children [Tiberiu Ichim - [`4ef429d`](https://github.com/eea/volto-cca-policy/commit/4ef429d1b3c4ac359f27741d54f44092e81d4d4d)]
|
|
77
|
+
- Add translate button [Tiberiu Ichim - [`6d4751e`](https://github.com/eea/volto-cca-policy/commit/6d4751e0750373c1e9dd657dc9346c5590ef38d0)]
|
|
78
|
+
- Simplify code [Tiberiu Ichim - [`900e867`](https://github.com/eea/volto-cca-policy/commit/900e867db1d45a3a2f042eb9763c306528346509)]
|
|
7
79
|
### [0.1.92](https://github.com/eea/volto-cca-policy/compare/0.1.91...0.1.92) - 6 March 2024
|
|
8
80
|
|
|
9
81
|
#### :rocket: New Features
|
|
@@ -604,13 +676,10 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
604
676
|
- Refs #260715 rast-block wip [Tripon Eugen - [`f19d54e`](https://github.com/eea/volto-cca-policy/commit/f19d54e0b9a6a86bf344eb85b6a1cda7f3de91bf)]
|
|
605
677
|
- Refs #260715 rast-block wip [Tripon Eugen - [`2828537`](https://github.com/eea/volto-cca-policy/commit/2828537b6c084cd1a82162d552fb4ef025b71f9f)]
|
|
606
678
|
- Refs #260715 rast-block updates [Tripon Eugen - [`1e803e5`](https://github.com/eea/volto-cca-policy/commit/1e803e5bd3d3fb7558f261c76c68866be7beb8b5)]
|
|
607
|
-
- test: [JENKINS] Use java17 for sonarqube scanner [valentinab25 - [`0a15e1b`](https://github.com/eea/volto-cca-policy/commit/0a15e1b2ad081233685e80d5b3c60a8663f6b896)]
|
|
608
|
-
- test: [JENKINS] Run cypress in started frontend container [valentinab25 - [`9554e44`](https://github.com/eea/volto-cca-policy/commit/9554e44c92a621a52b2adb5a4830fb084ee5734b)]
|
|
609
679
|
### [0.1.49](https://github.com/eea/volto-cca-policy/compare/0.1.48...0.1.49) - 15 November 2023
|
|
610
680
|
|
|
611
681
|
#### :house: Internal changes
|
|
612
682
|
|
|
613
|
-
- chore: [JENKINS] Refactor automated testing [valentinab25 - [`7b820a6`](https://github.com/eea/volto-cca-policy/commit/7b820a6369c2ddd5203b1a4abe352cb4bb43db7a)]
|
|
614
683
|
- chore: husky, lint-staged use fixed versions [valentinab25 - [`f0a8061`](https://github.com/eea/volto-cca-policy/commit/f0a8061c275c236deb00087c23fac9860a073106)]
|
|
615
684
|
|
|
616
685
|
#### :hammer_and_wrench: Others
|
|
@@ -627,9 +696,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
627
696
|
- Refs #259267 - jenkins test [Tripon Eugen - [`cacd31e`](https://github.com/eea/volto-cca-policy/commit/cacd31e7b1afe0983674ed5c7632d2e1d7fa752e)]
|
|
628
697
|
- Refs #259267 - jenkins [Tripon Eugen - [`5b3affe`](https://github.com/eea/volto-cca-policy/commit/5b3affee8401239de10097884c1b7f2349d15ec0)]
|
|
629
698
|
- Refs #259267 - add When, lead image and title to files [Tripon Eugen - [`2cedb23`](https://github.com/eea/volto-cca-policy/commit/2cedb237f898af9057e13fba94b615ef71077204)]
|
|
630
|
-
- test: [JENKINS] Add cpu limit on cypress docker [valentinab25 - [`4d607a5`](https://github.com/eea/volto-cca-policy/commit/4d607a576e9d0a5c34e48c41b409e7df616ee3d6)]
|
|
631
|
-
- test: [JENKINS] Increase shm-size to cypress docker [valentinab25 - [`b7f74d5`](https://github.com/eea/volto-cca-policy/commit/b7f74d53513a6edbfbca5cb6d19687929bb1e5db)]
|
|
632
|
-
- test: [JENKINS] Improve cypress time [valentinab25 - [`db65617`](https://github.com/eea/volto-cca-policy/commit/db656173391f65157098d95d388c25f6429753d8)]
|
|
633
699
|
- Refs #259267 - cca event blocks attachments and check not mandatoty fields [Tripon Eugen - [`3138e5a`](https://github.com/eea/volto-cca-policy/commit/3138e5afb5bfbdbed14e27ed457b16867b7fa414)]
|
|
634
700
|
- Refs #256681 - Fix error in CCA Event view menu. ([React Intl] An id must be provided to format a message.) [GhitaB - [`517eeb8`](https://github.com/eea/volto-cca-policy/commit/517eeb817264a47bbfd6b9b7d22aaf22d44ed224)]
|
|
635
701
|
- Refs #161485 - Fix ECDE name conflict. [GhitaB - [`8bfd99f`](https://github.com/eea/volto-cca-policy/commit/8bfd99ff68bb82a04d1c0ed625fa514fcf46289e)]
|
|
@@ -846,7 +912,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
846
912
|
|
|
847
913
|
#### :house: Internal changes
|
|
848
914
|
|
|
849
|
-
- chore: [JENKINS] Remove alpha testing version [valentinab25 - [`ad1ced0`](https://github.com/eea/volto-cca-policy/commit/ad1ced0971ba116c13a3b5fcc039172cc915c919)]
|
|
850
915
|
|
|
851
916
|
#### :hammer_and_wrench: Others
|
|
852
917
|
|
|
@@ -1327,7 +1392,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
1327
1392
|
#### :hammer_and_wrench: Others
|
|
1328
1393
|
|
|
1329
1394
|
- Refs #158294 - Update supported languages list. [GhitaB - [`0a4f91f`](https://github.com/eea/volto-cca-policy/commit/0a4f91f39b7edc367bd4c127d6a8f273c7788361)]
|
|
1330
|
-
- Add Sonarqube tag using cca-frontend addons list [EEA Jenkins - [`8f1f9ce`](https://github.com/eea/volto-cca-policy/commit/8f1f9ce6c22805670cc0800d3c779b6d619d0f31)]
|
|
1331
1395
|
### [0.1.1](https://github.com/eea/volto-cca-policy/compare/0.1.0...0.1.1) - 13 December 2022
|
|
1332
1396
|
|
|
1333
1397
|
#### :hammer_and_wrench: Others
|
package/babel.config.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
module.exports = function
|
|
1
|
+
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
|
{
|
package/jest-addon.config.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
require('dotenv').config({ path: __dirname + '/.env' })
|
|
2
|
+
|
|
1
3
|
module.exports = {
|
|
2
4
|
testMatch: ['**/src/addons/**/?(*.)+(spec|test).[jt]s?(x)'],
|
|
3
5
|
collectCoverageFrom: [
|
|
@@ -9,16 +11,23 @@ module.exports = {
|
|
|
9
11
|
'@plone/volto/cypress': '<rootDir>/node_modules/@plone/volto/cypress',
|
|
10
12
|
'@plone/volto/babel': '<rootDir>/node_modules/@plone/volto/babel',
|
|
11
13
|
'@plone/volto/(.*)$': '<rootDir>/node_modules/@plone/volto/src/$1',
|
|
12
|
-
'@package/(.*)$': '<rootDir>/src/$1',
|
|
13
|
-
'@root/(.*)$': '<rootDir>/src/$1',
|
|
14
|
+
'@package/(.*)$': '<rootDir>/node_modules/@plone/volto/src/$1',
|
|
15
|
+
'@root/(.*)$': '<rootDir>/node_modules/@plone/volto/src/$1',
|
|
14
16
|
'@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',
|
|
15
19
|
'@eeacms/(.*?)/(.*)$': '<rootDir>/node_modules/@eeacms/$1/src/$2',
|
|
16
|
-
'@plone/volto-slate':
|
|
20
|
+
'@plone/volto-slate$':
|
|
17
21
|
'<rootDir>/node_modules/@plone/volto/packages/volto-slate/src',
|
|
22
|
+
'@plone/volto-slate/(.*)$':
|
|
23
|
+
'<rootDir>/node_modules/@plone/volto/packages/volto-slate/src/$1',
|
|
18
24
|
'~/(.*)$': '<rootDir>/src/$1',
|
|
19
25
|
'load-volto-addons':
|
|
20
26
|
'<rootDir>/node_modules/@plone/volto/jest-addons-loader.js',
|
|
21
27
|
},
|
|
28
|
+
transformIgnorePatterns: [
|
|
29
|
+
'/node_modules/(?!(@plone|@root|@package|@eeacms)/).*/',
|
|
30
|
+
],
|
|
22
31
|
transform: {
|
|
23
32
|
'^.+\\.js(x)?$': 'babel-jest',
|
|
24
33
|
'^.+\\.(png)$': 'jest-file',
|
|
@@ -33,4 +42,9 @@ module.exports = {
|
|
|
33
42
|
statements: 5,
|
|
34
43
|
},
|
|
35
44
|
},
|
|
36
|
-
|
|
45
|
+
...(process.env.JEST_USE_SETUP === 'ON' && {
|
|
46
|
+
setupFilesAfterEnv: [
|
|
47
|
+
'<rootDir>/node_modules/@eeacms/volto-cca-policy/jest.setup.js',
|
|
48
|
+
],
|
|
49
|
+
}),
|
|
50
|
+
}
|
package/jest.setup.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { jest } from '@jest/globals';
|
|
2
|
+
import configureStore from 'redux-mock-store';
|
|
3
|
+
import thunk from 'redux-thunk';
|
|
4
|
+
import { blocksConfig } from '@plone/volto/config/Blocks';
|
|
5
|
+
import installSlate from '@plone/volto-slate/index';
|
|
6
|
+
|
|
7
|
+
var mockSemanticComponents = jest.requireActual('semantic-ui-react');
|
|
8
|
+
var mockComponents = jest.requireActual('@plone/volto/components');
|
|
9
|
+
var config = jest.requireActual('@plone/volto/registry').default;
|
|
10
|
+
|
|
11
|
+
config.blocks.blocksConfig = {
|
|
12
|
+
...blocksConfig,
|
|
13
|
+
...config.blocks.blocksConfig,
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
jest.doMock('semantic-ui-react', () => ({
|
|
17
|
+
__esModule: true,
|
|
18
|
+
...mockSemanticComponents,
|
|
19
|
+
Popup: ({ content, trigger }) => {
|
|
20
|
+
return (
|
|
21
|
+
<div className="popup">
|
|
22
|
+
<div className="trigger">{trigger}</div>
|
|
23
|
+
<div className="content">{content}</div>
|
|
24
|
+
</div>
|
|
25
|
+
);
|
|
26
|
+
},
|
|
27
|
+
}));
|
|
28
|
+
|
|
29
|
+
jest.doMock('@plone/volto/components', () => {
|
|
30
|
+
return {
|
|
31
|
+
__esModule: true,
|
|
32
|
+
...mockComponents,
|
|
33
|
+
SidebarPortal: ({ children }) => <div id="sidebar">{children}</div>,
|
|
34
|
+
};
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
jest.doMock('@plone/volto/registry', () =>
|
|
38
|
+
[installSlate].reduce((acc, apply) => apply(acc), config),
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
const mockStore = configureStore([thunk]);
|
|
42
|
+
|
|
43
|
+
global.fetch = jest.fn(() =>
|
|
44
|
+
Promise.resolve({
|
|
45
|
+
json: () => Promise.resolve({}),
|
|
46
|
+
}),
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
global.store = mockStore({
|
|
50
|
+
intl: {
|
|
51
|
+
locale: 'en',
|
|
52
|
+
messages: {},
|
|
53
|
+
formatMessage: jest.fn(),
|
|
54
|
+
},
|
|
55
|
+
content: {
|
|
56
|
+
create: {},
|
|
57
|
+
subrequests: [],
|
|
58
|
+
},
|
|
59
|
+
connected_data_parameters: {},
|
|
60
|
+
screen: {
|
|
61
|
+
page: {
|
|
62
|
+
width: 768,
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
});
|