@eeacms/volto-widget-toggle 4.0.0 → 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/CHANGELOG.md CHANGED
@@ -4,7 +4,19 @@ 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
- ### [4.0.0](https://github.com/eea/volto-widget-toggle/compare/3.1.4...4.0.0) - 22 April 2024
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
8
20
 
9
21
  #### :rocket: New Features
10
22
 
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 Developer Documentation](https://docs.voltocms.com/getting-started/install/)
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
- 1. Make sure you have installed `yo`, `@plone/generator-volto` and `mrs-developer`
31
+ For new Volto 18+ projects, use Cookieplone. It includes `mrs-developer` by default.
32
32
 
33
- npm install -g yo @plone/generator-volto mrs-developer
33
+ 1. Create a new Volto project with Cookieplone
34
34
 
35
- 1. Create new volto app
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. Install
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 develop
54
- yarn
54
+ make install
55
55
 
56
- 1. Start backend
56
+ 1. Start backend in one terminal
57
57
 
58
- docker run --pull always -it --rm --name plone -p 8080:8080 -e SITE=Plone plone/plone-backend
58
+ make backend-start
59
59
 
60
- ...wait for backend to setup and start - `Ready to handle requests`:
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
- yarn start
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 src/addons/volto-widget-toggle/
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 src/addons/volto-widget-toggle/
86
+ cd packages/volto-widget-toggle/
85
87
  ```
86
88
 
87
89
  Start:
package/README.md CHANGED
@@ -3,16 +3,16 @@
3
3
  [![Releases](https://img.shields.io/github/v/release/eea/volto-widget-toggle)](https://github.com/eea/volto-widget-toggle/releases)
4
4
 
5
5
  [![Pipeline](https://ci.eionet.europa.eu/buildStatus/icon?job=volto-addons%2Fvolto-widget-toggle%2Fmaster&subject=master)](https://ci.eionet.europa.eu/view/Github/job/volto-addons/job/volto-widget-toggle/job/master/display/redirect)
6
- [![Lines of Code](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-widget-toggle-master&metric=ncloc)](https://sonarqube.eea.europa.eu/dashboard?id=volto-widget-toggle-master)
7
- [![Coverage](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-widget-toggle-master&metric=coverage)](https://sonarqube.eea.europa.eu/dashboard?id=volto-widget-toggle-master)
8
- [![Bugs](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-widget-toggle-master&metric=bugs)](https://sonarqube.eea.europa.eu/dashboard?id=volto-widget-toggle-master)
9
- [![Duplicated Lines (%)](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-widget-toggle-master&metric=duplicated_lines_density)](https://sonarqube.eea.europa.eu/dashboard?id=volto-widget-toggle-master)
6
+ [![Lines of Code](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-widget-toggle&metric=ncloc)](https://sonarqube.eea.europa.eu/dashboard?id=volto-widget-toggle)
7
+ [![Coverage](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-widget-toggle&metric=coverage)](https://sonarqube.eea.europa.eu/dashboard?id=volto-widget-toggle)
8
+ [![Bugs](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-widget-toggle&metric=bugs)](https://sonarqube.eea.europa.eu/dashboard?id=volto-widget-toggle)
9
+ [![Duplicated Lines (%)](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-widget-toggle&metric=duplicated_lines_density)](https://sonarqube.eea.europa.eu/dashboard?id=volto-widget-toggle)
10
10
 
11
11
  [![Pipeline](https://ci.eionet.europa.eu/buildStatus/icon?job=volto-addons%2Fvolto-widget-toggle%2Fdevelop&subject=develop)](https://ci.eionet.europa.eu/view/Github/job/volto-addons/job/volto-widget-toggle/job/develop/display/redirect)
12
- [![Lines of Code](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-widget-toggle-develop&metric=ncloc)](https://sonarqube.eea.europa.eu/dashboard?id=volto-widget-toggle-develop)
13
- [![Coverage](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-widget-toggle-develop&metric=coverage)](https://sonarqube.eea.europa.eu/dashboard?id=volto-widget-toggle-develop)
14
- [![Bugs](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-widget-toggle-develop&metric=bugs)](https://sonarqube.eea.europa.eu/dashboard?id=volto-widget-toggle-develop)
15
- [![Duplicated Lines (%)](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-widget-toggle-develop&metric=duplicated_lines_density)](https://sonarqube.eea.europa.eu/dashboard?id=volto-widget-toggle-develop)
12
+ [![Lines of Code](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-widget-toggle&branch=develop&metric=ncloc)](https://sonarqube.eea.europa.eu/dashboard?id=volto-widget-toggle&branch=develop)
13
+ [![Coverage](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-widget-toggle&branch=develop&metric=coverage)](https://sonarqube.eea.europa.eu/dashboard?id=volto-widget-toggle&branch=develop)
14
+ [![Bugs](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-widget-toggle&branch=develop&metric=bugs)](https://sonarqube.eea.europa.eu/dashboard?id=volto-widget-toggle&branch=develop)
15
+ [![Duplicated Lines (%)](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-widget-toggle&branch=develop&metric=duplicated_lines_density)](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
- * If not, create one:
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
- npm install -g yo @plone/generator-volto
60
- yo @plone/volto my-volto-project --canary --addon @eeacms/volto-widget-toggle
61
- cd my-volto-project
66
+ uvx cookieplone project
67
+ cd project-title
62
68
  ```
63
69
 
64
- 1. Install new add-ons and restart Volto:
70
+ 1. Install or update dependencies, then start the project:
65
71
 
66
72
  ```
67
- yarn
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!
@@ -15,7 +15,7 @@ services:
15
15
  args:
16
16
  ADDON_NAME: "${ADDON_NAME}"
17
17
  ADDON_PATH: "${ADDON_PATH}"
18
- VOLTO_VERSION: ${VOLTO_VERSION:-16}
18
+ VOLTO_VERSION: ${VOLTO_VERSION:-18-yarn}
19
19
  ports:
20
20
  - "3000:3000"
21
21
  - "3001:3001"
@@ -1,5 +1,14 @@
1
1
  require('dotenv').config({ path: __dirname + '/.env' })
2
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
+
3
12
  module.exports = {
4
13
  testMatch: ['**/src/addons/**/?(*.)+(spec|test).[jt]s?(x)'],
5
14
  collectCoverageFrom: [
@@ -17,10 +26,8 @@ module.exports = {
17
26
  '@eeacms/search/(.*)$': '<rootDir>/src/addons/volto-searchlib/searchlib/$1',
18
27
  '@eeacms/search': '<rootDir>/src/addons/volto-searchlib/searchlib',
19
28
  '@eeacms/(.*?)/(.*)$': '<rootDir>/node_modules/@eeacms/$1/src/$2',
20
- '@plone/volto-slate$':
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',
29
+ '@plone/volto-slate$': voltoSlatePath,
30
+ '@plone/volto-slate/(.*)$': `${voltoSlatePath}/$1`,
24
31
  '~/(.*)$': '<rootDir>/src/$1',
25
32
  'load-volto-addons':
26
33
  '<rootDir>/node_modules/@plone/volto/jest-addons-loader.js',
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: 2023-06-28T10:48:22.678Z\n"
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": "4.0.0",
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",
@@ -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/extend-expect';
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 { getByText } = render(
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(getByText('Test Checkbox')).toBeInTheDocument();
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
- expect(mockOnChange).toHaveBeenCalledWith('test', true);
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', () => {