@eeacms/volto-widget-toggle 3.1.4 → 5.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/.eslintrc.js +65 -0
- package/CHANGELOG.md +25 -24
- package/DEVELOP.md +19 -17
- package/README.md +33 -19
- package/cypress.config.js +3 -3
- package/docker-compose.yml +1 -1
- package/jest-addon.config.js +27 -5
- package/jest.setup.js +65 -0
- package/locales/volto.pot +2 -2
- package/package.json +4 -3
- package/src/components/manage/Widgets/CheckboxWidget.test.jsx +9 -7
- package/.project.eslintrc.js +0 -48
package/.eslintrc.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
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
|
+
...addonAliases,
|
|
39
|
+
['@package', `${__dirname}/src`],
|
|
40
|
+
['@root', `${__dirname}/src`],
|
|
41
|
+
['~', `${__dirname}/src`],
|
|
42
|
+
],
|
|
43
|
+
extensions: ['.js', '.jsx', '.json'],
|
|
44
|
+
},
|
|
45
|
+
'babel-plugin-root-import': {
|
|
46
|
+
rootPathSuffix: 'src',
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
rules: {
|
|
51
|
+
'react/jsx-no-target-blank': [
|
|
52
|
+
'error',
|
|
53
|
+
{
|
|
54
|
+
allowReferrer: true,
|
|
55
|
+
},
|
|
56
|
+
],
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const config = addonExtenders.reduce(
|
|
61
|
+
(acc, extender) => extender.modify(acc),
|
|
62
|
+
defaultConfig,
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
module.exports = config;
|
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,31 @@ 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
|
+
### [5.0.0](https://github.com/eea/volto-widget-toggle/compare/4.0.0...5.0.0) - 25 March 2026
|
|
8
|
+
|
|
9
|
+
#### :rocket: New Features
|
|
10
|
+
|
|
11
|
+
- feat: Volto 18 support - refs #287700 [Alin Voinea - [`e8d9163`](https://github.com/eea/volto-widget-toggle/commit/e8d9163a2df3e87871914b77b9c04730d686e970)]
|
|
12
|
+
|
|
13
|
+
#### :house: Internal changes
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
#### :hammer_and_wrench: Others
|
|
17
|
+
|
|
18
|
+
- tests: Fix Sonar Qube tags - refs #297339 [Alin Voinea - [`ed169f3`](https://github.com/eea/volto-widget-toggle/commit/ed169f3c6e44d0b109d69440b67db55ad3c09864)]
|
|
19
|
+
## [4.0.0](https://github.com/eea/volto-widget-toggle/compare/3.1.4...4.0.0) - 22 April 2024
|
|
20
|
+
|
|
21
|
+
#### :rocket: New Features
|
|
22
|
+
|
|
23
|
+
- feat: Release 4.0.0 - Volto 17 support [alin - [`b1db508`](https://github.com/eea/volto-widget-toggle/commit/b1db5088cca5e0a580b97a00836365e8b2c39921)]
|
|
24
|
+
- feat: Volto 17 support - refs #264527 [EEA Jenkins - [`06fd934`](https://github.com/eea/volto-widget-toggle/commit/06fd9344ec36b88810c16288030bf91ce1a854a8)]
|
|
25
|
+
|
|
26
|
+
#### :house: Internal changes
|
|
27
|
+
|
|
28
|
+
- chore: husky, lint-staged use fixed versions [valentinab25 - [`78c47fe`](https://github.com/eea/volto-widget-toggle/commit/78c47fea7a704d1addd796ac5f515d262379da92)]
|
|
29
|
+
|
|
30
|
+
#### :hammer_and_wrench: Others
|
|
31
|
+
|
|
7
32
|
### [3.1.4](https://github.com/eea/volto-widget-toggle/compare/3.1.3...3.1.4) - 16 October 2023
|
|
8
33
|
|
|
9
34
|
#### :house: Internal changes
|
|
@@ -28,7 +53,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
28
53
|
|
|
29
54
|
- test: EN locales, pre-commit fix, feature PRs checks Refs #257193 [valentinab25 - [`b2f509e`](https://github.com/eea/volto-widget-toggle/commit/b2f509eb236e0beeccfc8bc89f4c6527a3fca223)]
|
|
30
55
|
- test: Fix package.json scripts to use makefile [Alin Voinea - [`72e8245`](https://github.com/eea/volto-widget-toggle/commit/72e8245a4741988849eaa73e5fd238ff6d340fa9)]
|
|
31
|
-
- test: Fix eslint and yarn i18n [Alin Voinea - [`034eaf8`](https://github.com/eea/volto-widget-toggle/commit/034eaf890faa3a9c09aa6f4ddca1bc04e46782a8)]
|
|
32
56
|
- i18n: Add en [Alin Voinea - [`e60d799`](https://github.com/eea/volto-widget-toggle/commit/e60d799a64230544e37e1f4796dc73bbc0e674c6)]
|
|
33
57
|
- test: Update Makefile and docker-compose to align it with Jenkinsfile [valentinab25 - [`f86b2f7`](https://github.com/eea/volto-widget-toggle/commit/f86b2f7119f24b637e8bc8101effc2c2c3416a65)]
|
|
34
58
|
### [3.1.2](https://github.com/eea/volto-widget-toggle/compare/3.1.1...3.1.2) - 24 July 2023
|
|
@@ -39,20 +63,11 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
39
63
|
|
|
40
64
|
- test: jest should look for addons in node_modules Refs #253277 [valentinab25 - [`da228a9`](https://github.com/eea/volto-widget-toggle/commit/da228a925ea784b4b418f37ea07418de87759670)]
|
|
41
65
|
- test: Fix test config, coverage Refs #253277 [valentinab25 - [`b4f3492`](https://github.com/eea/volto-widget-toggle/commit/b4f3492448826968dfbb979fad00f0b65d644017)]
|
|
42
|
-
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`08bfec1`](https://github.com/eea/volto-widget-toggle/commit/08bfec176ebdf6dff13a7db969a73ca9d8415ee8)]
|
|
43
|
-
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`1324cce`](https://github.com/eea/volto-widget-toggle/commit/1324cceab3305bf02ab2004a4ff77d492f44481e)]
|
|
44
|
-
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`13d684d`](https://github.com/eea/volto-widget-toggle/commit/13d684daf218103723779a470ff3dc7f101e93c1)]
|
|
45
66
|
### [3.1.0](https://github.com/eea/volto-widget-toggle/compare/3.0.1...3.1.0) - 27 March 2023
|
|
46
67
|
|
|
47
68
|
#### :hammer_and_wrench: Others
|
|
48
69
|
|
|
49
|
-
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`11a80c7`](https://github.com/eea/volto-widget-toggle/commit/11a80c7ce1f66aa0c7ec600c626875ab7ac8c1cb)]
|
|
50
|
-
- Add Sonarqube tag using advisory-board-frontend addons list [EEA Jenkins - [`c353ca1`](https://github.com/eea/volto-widget-toggle/commit/c353ca1794b99b2e5f6681ad93ab844ef33e117e)]
|
|
51
|
-
- Add Sonarqube tag using advisory-board-frontend addons list [EEA Jenkins - [`143e5be`](https://github.com/eea/volto-widget-toggle/commit/143e5be8400af60658baa34a7934f707df121f83)]
|
|
52
70
|
- test(Jenkins): Run tests and cypress with latest canary @plone/volto [Alin Voinea - [`c658d9f`](https://github.com/eea/volto-widget-toggle/commit/c658d9f0fc0fc6cc4b26041b79c93c0982b152c5)]
|
|
53
|
-
- Add Sonarqube tag using cca-frontend addons list [EEA Jenkins - [`6f8b43e`](https://github.com/eea/volto-widget-toggle/commit/6f8b43e0fe92d2065725be355b800446fedf2992)]
|
|
54
|
-
- yarn 3 [Alin Voinea - [`02d53da`](https://github.com/eea/volto-widget-toggle/commit/02d53daff4ee2886f5533ce8afd0d4e67cd0a9f1)]
|
|
55
|
-
- Add Sonarqube tag using demo-kitkat-frontend addons list [EEA Jenkins - [`42059ef`](https://github.com/eea/volto-widget-toggle/commit/42059efe39cf11c31b1a48ddf6503aaf9da14db7)]
|
|
56
71
|
### [3.0.1](https://github.com/eea/volto-widget-toggle/compare/3.0.0...3.0.1) - 16 November 2022
|
|
57
72
|
|
|
58
73
|
#### :hammer_and_wrench: Others
|
|
@@ -65,21 +80,15 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
65
80
|
- Cleanup [Alin Voinea - [`f0bfe89`](https://github.com/eea/volto-widget-toggle/commit/f0bfe892db782472d0911b3562346d80bed2fb94)]
|
|
66
81
|
- Typo [Miu Razvan - [`f1faa3d`](https://github.com/eea/volto-widget-toggle/commit/f1faa3d1c0239d377a75b375dcf092cea048c121)]
|
|
67
82
|
- Use latest cypress [Miu Razvan - [`165ef4a`](https://github.com/eea/volto-widget-toggle/commit/165ef4a017833e757a69da734985acd18155228e)]
|
|
68
|
-
- Add Sonarqube tag using marine-frontend addons list [EEA Jenkins - [`45037b0`](https://github.com/eea/volto-widget-toggle/commit/45037b01295d0593929af9ff6f53823e51129f43)]
|
|
69
|
-
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`de17f98`](https://github.com/eea/volto-widget-toggle/commit/de17f983029cda87580f39b6ab7b1a0139e080cd)]
|
|
70
83
|
- update(jest): add @plone/volto-slate resolver refs- #153447 [nileshgulia1 - [`b5e6889`](https://github.com/eea/volto-widget-toggle/commit/b5e6889bc22efaeec2025bd79dfe2a839650e4a6)]
|
|
71
84
|
### [2.2.7](https://github.com/eea/volto-widget-toggle/compare/2.2.6...2.2.7) - 30 June 2022
|
|
72
85
|
|
|
73
86
|
#### :hammer_and_wrench: Others
|
|
74
87
|
|
|
75
|
-
- Add Sonarqube tag using circularity-frontend addons list [EEA Jenkins - [`78e846a`](https://github.com/eea/volto-widget-toggle/commit/78e846a63de32fc42db181a07859a886b10d8b4e)]
|
|
76
|
-
- Add Sonarqube tag using clms-frontend addons list [EEA Jenkins - [`75191c3`](https://github.com/eea/volto-widget-toggle/commit/75191c366506d17db335e2b305e5ea8f058e9dfb)]
|
|
77
|
-
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`3806c6c`](https://github.com/eea/volto-widget-toggle/commit/3806c6c481c069ab939b7603c7d3e102563276dd)]
|
|
78
88
|
### [2.2.6](https://github.com/eea/volto-widget-toggle/compare/2.2.5...2.2.6) - 3 January 2022
|
|
79
89
|
|
|
80
90
|
#### :hammer_and_wrench: Others
|
|
81
91
|
|
|
82
|
-
- Add Sonarqube tag using freshwater-frontend addons list [EEA Jenkins - [`c2e3484`](https://github.com/eea/volto-widget-toggle/commit/c2e3484b3396dbabf38a8b9e8f6df0b89d4aa663)]
|
|
83
92
|
### [2.2.5](https://github.com/eea/volto-widget-toggle/compare/2.2.4...2.2.5) - 16 December 2021
|
|
84
93
|
|
|
85
94
|
### [2.2.4](https://github.com/eea/volto-widget-toggle/compare/2.2.3...2.2.4) - 10 December 2021
|
|
@@ -87,13 +96,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
87
96
|
#### :hammer_and_wrench: Others
|
|
88
97
|
|
|
89
98
|
- Refs #142010 - Optimize Volto-addons gitflow pipelines [valentinab25 - [`2bd2039`](https://github.com/eea/volto-widget-toggle/commit/2bd203979963ee5cb15592470e1d341d1bd65291)]
|
|
90
|
-
- Add Sonarqube tag using industry-frontend addons list [EEA Jenkins - [`af5afe1`](https://github.com/eea/volto-widget-toggle/commit/af5afe1263aff21801bbb8239163ac01644f2a7e)]
|
|
91
|
-
- Add Sonarqube tag using clms-frontend addons list [EEA Jenkins - [`2d60373`](https://github.com/eea/volto-widget-toggle/commit/2d60373b280dcb2f902e4dc6fff0bdb8ea7d7ac7)]
|
|
92
|
-
- Add Sonarqube tag using bise-frontend addons list [EEA Jenkins - [`80527c1`](https://github.com/eea/volto-widget-toggle/commit/80527c1f72bd8cc325ff1c072def18d24c3e99ae)]
|
|
93
|
-
- Add Sonarqube tag using sustainability-frontend addons list [EEA Jenkins - [`bc52e72`](https://github.com/eea/volto-widget-toggle/commit/bc52e72e32197ca82f93bac645f0094bc7db7ab1)]
|
|
94
|
-
- Add Sonarqube tag using climate-energy-frontend addons list [EEA Jenkins - [`30397bd`](https://github.com/eea/volto-widget-toggle/commit/30397bde9a045be3c2e6614af798ce11f18e3039)]
|
|
95
|
-
- Add Sonarqube tag using ims-frontend addons list [EEA Jenkins - [`dd3fb67`](https://github.com/eea/volto-widget-toggle/commit/dd3fb67693900db1ce6d8f631c61a2a5c25d9b70)]
|
|
96
|
-
- Add Sonarqube tag using frontend addons list [EEA Jenkins - [`54d09d1`](https://github.com/eea/volto-widget-toggle/commit/54d09d164591f1cf3d47a69838ccbd9abb8f22b6)]
|
|
97
99
|
### [2.2.3](https://github.com/eea/volto-widget-toggle/compare/2.2.2...2.2.3) - 28 June 2021
|
|
98
100
|
|
|
99
101
|
#### :hammer_and_wrench: Others
|
|
@@ -127,7 +129,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
127
129
|
|
|
128
130
|
- Release 1.0.1 [Alin Voinea - [`454220f`](https://github.com/eea/volto-widget-toggle/commit/454220fa61495427f874fb9b56401fe69689f4fe)]
|
|
129
131
|
- Auto-release npm [Alin Voinea - [`10b31b3`](https://github.com/eea/volto-widget-toggle/commit/10b31b3b64330d41f69a033a45030e49d20c16b5)]
|
|
130
|
-
- yarn prettier [Alin Voinea - [`5136059`](https://github.com/eea/volto-widget-toggle/commit/51360595bf452c815e526ce10f15aa8a84ad186f)]
|
|
131
132
|
## [1.0.0](https://github.com/eea/volto-widget-toggle/compare/0.1.0...1.0.0) - 29 September 2020
|
|
132
133
|
|
|
133
134
|
#### :hammer_and_wrench: Others
|
package/DEVELOP.md
CHANGED
|
@@ -26,21 +26,20 @@
|
|
|
26
26
|
|
|
27
27
|
### Or add @eeacms/volto-widget-toggle to your Volto project
|
|
28
28
|
|
|
29
|
-
Before starting make sure your development environment is properly set. See [Volto
|
|
29
|
+
Before starting make sure your development environment is properly set. See the official Plone documentation for [creating a project with Cookieplone](https://6.docs.plone.org/install/create-project-cookieplone.html) and [installing an add-on in development mode in Volto 18 and 19](https://6.docs.plone.org/volto/development/add-ons/install-an-add-on-dev-18.html).
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
For new Volto 18+ projects, use Cookieplone. It includes `mrs-developer` by default.
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
1. Create a new Volto project with Cookieplone
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
yo @plone/volto my-volto-project --addon @eeacms/volto-widget-toggle --skip-install
|
|
38
|
-
cd my-volto-project
|
|
35
|
+
uvx cookieplone project
|
|
36
|
+
cd project-title
|
|
39
37
|
|
|
40
38
|
1. Add the following to `mrs.developer.json`:
|
|
41
39
|
|
|
42
40
|
{
|
|
43
41
|
"volto-widget-toggle": {
|
|
42
|
+
"output": "packages",
|
|
44
43
|
"url": "https://github.com/eea/volto-widget-toggle.git",
|
|
45
44
|
"package": "@eeacms/volto-widget-toggle",
|
|
46
45
|
"branch": "develop",
|
|
@@ -48,28 +47,31 @@ Before starting make sure your development environment is properly set. See [Vol
|
|
|
48
47
|
}
|
|
49
48
|
}
|
|
50
49
|
|
|
51
|
-
1.
|
|
50
|
+
1. Add `@eeacms/volto-widget-toggle` to the `addons` key in your project `volto.config.js`
|
|
51
|
+
|
|
52
|
+
1. Install or refresh the project setup
|
|
52
53
|
|
|
53
|
-
make
|
|
54
|
-
yarn
|
|
54
|
+
make install
|
|
55
55
|
|
|
56
|
-
1. Start backend
|
|
56
|
+
1. Start backend in one terminal
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
make backend-start
|
|
59
59
|
|
|
60
|
-
...wait for backend to setup and start
|
|
60
|
+
...wait for backend to setup and start, ending with `Ready to handle requests`
|
|
61
61
|
|
|
62
62
|
...you can also check http://localhost:8080/Plone
|
|
63
63
|
|
|
64
|
-
1. Start frontend
|
|
64
|
+
1. Start frontend in a second terminal
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
make frontend-start
|
|
67
67
|
|
|
68
68
|
1. Go to http://localhost:3000
|
|
69
69
|
|
|
70
70
|
1. Happy hacking!
|
|
71
71
|
|
|
72
|
-
cd
|
|
72
|
+
cd packages/volto-widget-toggle
|
|
73
|
+
|
|
74
|
+
For legacy Volto 17 projects, keep using the yarn-based workflow from the Volto 17 documentation.
|
|
73
75
|
|
|
74
76
|
## Cypress
|
|
75
77
|
|
|
@@ -81,7 +83,7 @@ project where you added `volto-widget-toggle` to `mrs.developer.json`
|
|
|
81
83
|
Go to:
|
|
82
84
|
|
|
83
85
|
```BASH
|
|
84
|
-
cd
|
|
86
|
+
cd packages/volto-widget-toggle/
|
|
85
87
|
```
|
|
86
88
|
|
|
87
89
|
Start:
|
package/README.md
CHANGED
|
@@ -3,16 +3,16 @@
|
|
|
3
3
|
[](https://github.com/eea/volto-widget-toggle/releases)
|
|
4
4
|
|
|
5
5
|
[](https://ci.eionet.europa.eu/view/Github/job/volto-addons/job/volto-widget-toggle/job/master/display/redirect)
|
|
6
|
-
[](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-widget-toggle
|
|
6
|
+
[](https://sonarqube.eea.europa.eu/dashboard?id=volto-widget-toggle)
|
|
7
|
+
[](https://sonarqube.eea.europa.eu/dashboard?id=volto-widget-toggle)
|
|
8
|
+
[](https://sonarqube.eea.europa.eu/dashboard?id=volto-widget-toggle)
|
|
9
|
+
[](https://sonarqube.eea.europa.eu/dashboard?id=volto-widget-toggle)
|
|
10
10
|
|
|
11
11
|
[](https://ci.eionet.europa.eu/view/Github/job/volto-addons/job/volto-widget-toggle/job/develop/display/redirect)
|
|
12
|
-
[](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-widget-toggle
|
|
12
|
+
[](https://sonarqube.eea.europa.eu/dashboard?id=volto-widget-toggle&branch=develop)
|
|
13
|
+
[](https://sonarqube.eea.europa.eu/dashboard?id=volto-widget-toggle&branch=develop)
|
|
14
|
+
[](https://sonarqube.eea.europa.eu/dashboard?id=volto-widget-toggle&branch=develop)
|
|
15
|
+
[](https://sonarqube.eea.europa.eu/dashboard?id=volto-widget-toggle&branch=develop)
|
|
16
16
|
|
|
17
17
|
[Volto](https://github.com/plone/volto) add-on: Replace any checkbox with a nice toggle button within edit forms
|
|
18
18
|
|
|
@@ -31,6 +31,11 @@
|
|
|
31
31
|
|
|
32
32
|
Go to http://localhost:3000
|
|
33
33
|
|
|
34
|
+
`make start` now defaults to Volto 18. To run the same setup against Volto 17, use:
|
|
35
|
+
|
|
36
|
+
VOLTO_VERSION=17 make
|
|
37
|
+
VOLTO_VERSION=17 make start
|
|
38
|
+
|
|
34
39
|
### Add volto-widget-toggle to your Volto project
|
|
35
40
|
|
|
36
41
|
1. Make sure you have a [Plone backend](https://plone.org/download) up-and-running at http://localhost:8080/Plone
|
|
@@ -44,30 +49,39 @@ Go to http://localhost:3000
|
|
|
44
49
|
* If you already have a volto project, just update `package.json`:
|
|
45
50
|
|
|
46
51
|
```JSON
|
|
47
|
-
"addons": [
|
|
48
|
-
"@eeacms/volto-widget-toggle"
|
|
49
|
-
],
|
|
50
|
-
|
|
51
52
|
"dependencies": {
|
|
52
53
|
"@eeacms/volto-widget-toggle": "*"
|
|
53
54
|
}
|
|
54
55
|
```
|
|
55
56
|
|
|
56
|
-
|
|
57
|
+
and `volto.config.js`:
|
|
58
|
+
|
|
59
|
+
```JavaScript
|
|
60
|
+
const addons = ['@eeacms/volto-widget-toggle'];
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
* If not, create one with Cookieplone, as recommended by the official Plone documentation for Volto 18+:
|
|
57
64
|
|
|
58
65
|
```
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
cd my-volto-project
|
|
66
|
+
uvx cookieplone project
|
|
67
|
+
cd project-title
|
|
62
68
|
```
|
|
63
69
|
|
|
64
|
-
1. Install
|
|
70
|
+
1. Install or update dependencies, then start the project:
|
|
65
71
|
|
|
66
72
|
```
|
|
67
|
-
|
|
68
|
-
yarn start
|
|
73
|
+
make install
|
|
69
74
|
```
|
|
70
75
|
|
|
76
|
+
For a Cookieplone project, start the backend and frontend in separate terminals:
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
make backend-start
|
|
80
|
+
make frontend-start
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
For a legacy Volto 17 project, install the package with `yarn` and restart the frontend as usual.
|
|
84
|
+
|
|
71
85
|
1. Go to http://localhost:3000
|
|
72
86
|
|
|
73
87
|
1. Happy editing!
|
package/cypress.config.js
CHANGED
|
@@ -2,12 +2,12 @@ const { defineConfig } = require('cypress');
|
|
|
2
2
|
|
|
3
3
|
module.exports = defineConfig({
|
|
4
4
|
viewportWidth: 1280,
|
|
5
|
-
defaultCommandTimeout:
|
|
5
|
+
defaultCommandTimeout: 8888,
|
|
6
6
|
chromeWebSecurity: false,
|
|
7
7
|
reporter: 'junit',
|
|
8
|
-
video:
|
|
8
|
+
video: false,
|
|
9
9
|
retries: {
|
|
10
|
-
runMode:
|
|
10
|
+
runMode: 2,
|
|
11
11
|
openMode: 0,
|
|
12
12
|
},
|
|
13
13
|
reporterOptions: {
|
package/docker-compose.yml
CHANGED
package/jest-addon.config.js
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
require('dotenv').config({ path: __dirname + '/.env' })
|
|
2
|
+
|
|
3
|
+
const fs = require('fs')
|
|
4
|
+
const path = require('path')
|
|
5
|
+
|
|
6
|
+
const voltoSlatePath = fs.existsSync(
|
|
7
|
+
path.join(__dirname, '../../../node_modules/@plone/volto-slate/src'),
|
|
8
|
+
)
|
|
9
|
+
? '<rootDir>/node_modules/@plone/volto-slate/src'
|
|
10
|
+
: '<rootDir>/node_modules/@plone/volto/packages/volto-slate/src'
|
|
11
|
+
|
|
1
12
|
module.exports = {
|
|
2
13
|
testMatch: ['**/src/addons/**/?(*.)+(spec|test).[jt]s?(x)'],
|
|
3
14
|
collectCoverageFrom: [
|
|
@@ -9,18 +20,24 @@ module.exports = {
|
|
|
9
20
|
'@plone/volto/cypress': '<rootDir>/node_modules/@plone/volto/cypress',
|
|
10
21
|
'@plone/volto/babel': '<rootDir>/node_modules/@plone/volto/babel',
|
|
11
22
|
'@plone/volto/(.*)$': '<rootDir>/node_modules/@plone/volto/src/$1',
|
|
12
|
-
'@package/(.*)$': '<rootDir>/src/$1',
|
|
13
|
-
'@root/(.*)$': '<rootDir>/src/$1',
|
|
23
|
+
'@package/(.*)$': '<rootDir>/node_modules/@plone/volto/src/$1',
|
|
24
|
+
'@root/(.*)$': '<rootDir>/node_modules/@plone/volto/src/$1',
|
|
14
25
|
'@plone/volto-quanta/(.*)$': '<rootDir>/src/addons/volto-quanta/src/$1',
|
|
26
|
+
'@eeacms/search/(.*)$': '<rootDir>/src/addons/volto-searchlib/searchlib/$1',
|
|
27
|
+
'@eeacms/search': '<rootDir>/src/addons/volto-searchlib/searchlib',
|
|
15
28
|
'@eeacms/(.*?)/(.*)$': '<rootDir>/node_modules/@eeacms/$1/src/$2',
|
|
16
|
-
'@plone/volto-slate':
|
|
17
|
-
|
|
29
|
+
'@plone/volto-slate$': voltoSlatePath,
|
|
30
|
+
'@plone/volto-slate/(.*)$': `${voltoSlatePath}/$1`,
|
|
18
31
|
'~/(.*)$': '<rootDir>/src/$1',
|
|
19
32
|
'load-volto-addons':
|
|
20
33
|
'<rootDir>/node_modules/@plone/volto/jest-addons-loader.js',
|
|
21
34
|
},
|
|
35
|
+
transformIgnorePatterns: [
|
|
36
|
+
'/node_modules/(?!(@plone|@root|@package|@eeacms)/).*/',
|
|
37
|
+
],
|
|
22
38
|
transform: {
|
|
23
39
|
'^.+\\.js(x)?$': 'babel-jest',
|
|
40
|
+
'^.+\\.ts(x)?$': 'babel-jest',
|
|
24
41
|
'^.+\\.(png)$': 'jest-file',
|
|
25
42
|
'^.+\\.(jpg)$': 'jest-file',
|
|
26
43
|
'^.+\\.(svg)$': './node_modules/@plone/volto/jest-svgsystem-transform.js',
|
|
@@ -33,4 +50,9 @@ module.exports = {
|
|
|
33
50
|
statements: 5,
|
|
34
51
|
},
|
|
35
52
|
},
|
|
36
|
-
|
|
53
|
+
...(process.env.JEST_USE_SETUP === 'ON' && {
|
|
54
|
+
setupFilesAfterEnv: [
|
|
55
|
+
'<rootDir>/node_modules/@eeacms/volto-widget-toggle/jest.setup.js',
|
|
56
|
+
],
|
|
57
|
+
}),
|
|
58
|
+
}
|
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
|
+
});
|
package/locales/volto.pot
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
msgid ""
|
|
2
2
|
msgstr ""
|
|
3
3
|
"Project-Id-Version: Plone\n"
|
|
4
|
-
"POT-Creation-Date:
|
|
4
|
+
"POT-Creation-Date: 2026-03-10T22:14:45.028Z\n"
|
|
5
5
|
"Last-Translator: Plone i18n <plone-i18n@lists.sourceforge.net>\n"
|
|
6
6
|
"Language-Team: Plone i18n <plone-i18n@lists.sourceforge.net>\n"
|
|
7
|
-
"MIME-Version: 1.0\n"
|
|
8
7
|
"Content-Type: text/plain; charset=utf-8\n"
|
|
9
8
|
"Content-Transfer-Encoding: 8bit\n"
|
|
10
9
|
"Plural-Forms: nplurals=1; plural=0;\n"
|
|
10
|
+
"MIME-Version: 1.0\n"
|
|
11
11
|
"Language-Code: en\n"
|
|
12
12
|
"Language-Name: English\n"
|
|
13
13
|
"Preferred-Encodings: utf-8\n"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eeacms/volto-widget-toggle",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"description": "volto-widget-toggle: Volto add-on to replace checkboxes with toggle buttons",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"author": "European Environment Agency: IDM2 A-Team",
|
|
@@ -22,8 +22,9 @@
|
|
|
22
22
|
"@cypress/code-coverage": "^3.10.0",
|
|
23
23
|
"@plone/scripts": "*",
|
|
24
24
|
"babel-plugin-transform-class-properties": "^6.24.1",
|
|
25
|
-
"
|
|
26
|
-
"
|
|
25
|
+
"dotenv": "^16.3.2",
|
|
26
|
+
"husky": "^8.0.3",
|
|
27
|
+
"lint-staged": "^14.0.1",
|
|
27
28
|
"md5": "^2.3.0"
|
|
28
29
|
},
|
|
29
30
|
"lint-staged": {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { render } from '@testing-library/react';
|
|
2
|
+
import { render, waitFor } from '@testing-library/react';
|
|
3
3
|
import { Provider } from 'react-intl-redux';
|
|
4
4
|
import CheckboxWidget from './CheckboxWidget';
|
|
5
5
|
import configureStore from 'redux-mock-store';
|
|
6
|
-
import '@testing-library/jest-dom
|
|
6
|
+
import '@testing-library/jest-dom';
|
|
7
7
|
|
|
8
8
|
const mockStore = configureStore([]);
|
|
9
9
|
const store = mockStore({
|
|
@@ -21,8 +21,8 @@ describe('CheckboxWidget', () => {
|
|
|
21
21
|
jest.clearAllMocks();
|
|
22
22
|
});
|
|
23
23
|
|
|
24
|
-
it('renders a checkbox', () => {
|
|
25
|
-
const {
|
|
24
|
+
it('renders a checkbox', async () => {
|
|
25
|
+
const { findByText } = render(
|
|
26
26
|
<Provider store={store} locale="en">
|
|
27
27
|
<CheckboxWidget
|
|
28
28
|
id="test"
|
|
@@ -31,10 +31,10 @@ describe('CheckboxWidget', () => {
|
|
|
31
31
|
/>
|
|
32
32
|
</Provider>,
|
|
33
33
|
);
|
|
34
|
-
expect(
|
|
34
|
+
expect(await findByText('Test Checkbox')).toBeInTheDocument();
|
|
35
35
|
});
|
|
36
36
|
|
|
37
|
-
it('sets a default value if given', () => {
|
|
37
|
+
it('sets a default value if given', async () => {
|
|
38
38
|
render(
|
|
39
39
|
<Provider store={store} locale="en">
|
|
40
40
|
<CheckboxWidget
|
|
@@ -45,7 +45,9 @@ describe('CheckboxWidget', () => {
|
|
|
45
45
|
/>
|
|
46
46
|
</Provider>,
|
|
47
47
|
);
|
|
48
|
-
|
|
48
|
+
await waitFor(() => {
|
|
49
|
+
expect(mockOnChange).toHaveBeenCalledWith('test', true);
|
|
50
|
+
});
|
|
49
51
|
});
|
|
50
52
|
|
|
51
53
|
it('does not set a default value if already having a value', () => {
|
package/.project.eslintrc.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
|
|
4
|
-
const projectRootPath = fs.existsSync('./project')
|
|
5
|
-
? fs.realpathSync('./project')
|
|
6
|
-
: fs.realpathSync('./../../../');
|
|
7
|
-
const packageJson = require(path.join(projectRootPath, 'package.json'));
|
|
8
|
-
const jsConfig = require(path.join(projectRootPath, 'jsconfig.json')).compilerOptions;
|
|
9
|
-
|
|
10
|
-
const pathsConfig = jsConfig.paths;
|
|
11
|
-
|
|
12
|
-
let voltoPath = path.join(projectRootPath, 'node_modules/@plone/volto');
|
|
13
|
-
|
|
14
|
-
Object.keys(pathsConfig).forEach(pkg => {
|
|
15
|
-
if (pkg === '@plone/volto') {
|
|
16
|
-
voltoPath = `./${jsConfig.baseUrl}/${pathsConfig[pkg][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
|
-
|
|
29
|
-
module.exports = {
|
|
30
|
-
extends: `${projectRootPath}/node_modules/@plone/volto/.eslintrc`,
|
|
31
|
-
settings: {
|
|
32
|
-
'import/resolver': {
|
|
33
|
-
alias: {
|
|
34
|
-
map: [
|
|
35
|
-
['@plone/volto', '@plone/volto/src'],
|
|
36
|
-
...addonAliases,
|
|
37
|
-
['@package', `${__dirname}/src`],
|
|
38
|
-
['~', `${__dirname}/src`],
|
|
39
|
-
],
|
|
40
|
-
extensions: ['.js', '.jsx', '.json'],
|
|
41
|
-
},
|
|
42
|
-
'babel-plugin-root-import': {
|
|
43
|
-
rootPathSuffix: 'src',
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
};
|
|
48
|
-
|