@eeacms/volto-slate-footnote 7.2.6 → 8.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,6 +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
+ ### [8.0.0](https://github.com/eea/volto-slate-footnote/compare/7.2.6...8.0.0) - 30 March 2026
8
+
9
+ #### :rocket: New Features
10
+
11
+ - feat: Volto 18 support - refs #287700 [Alin Voinea - [`eccfeda`](https://github.com/eea/volto-slate-footnote/commit/eccfeda667fdb89fb4f5521ed8f8d77b9f04acda)]
12
+
13
+ #### :house: Internal changes
14
+
15
+
16
+ #### :hammer_and_wrench: Others
17
+
18
+ - test: Fix make test [Alin V. (Claudiu) - [`8a54d4a`](https://github.com/eea/volto-slate-footnote/commit/8a54d4a16496c92a9c25d42102e0176cb3dc56ab)]
19
+ - tests: Fix Sonar Qube tags - refs #297339 [Alin Voinea - [`d2287d1`](https://github.com/eea/volto-slate-footnote/commit/d2287d1eacf022e59896cabe529ff6d80134dded)]
7
20
  ### [7.2.6](https://github.com/eea/volto-slate-footnote/compare/7.2.5...7.2.6) - 22 September 2025
8
21
 
9
22
  #### :bug: Bug Fixes
@@ -28,12 +41,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
28
41
 
29
42
  #### :hammer_and_wrench: Others
30
43
 
31
- - Add Sonarqube tag using clms-frontend addons list [EEA Jenkins - [`0f74fe1`](https://github.com/eea/volto-slate-footnote/commit/0f74fe1d9d2d0707e1ef88b969e1248b09e95ad0)]
32
- - Add Sonarqube tag using clms-frontend addons list [EEA Jenkins - [`23f6e17`](https://github.com/eea/volto-slate-footnote/commit/23f6e173ec8b17cfa354c635ed17c733d42568eb)]
33
- - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`967eaa9`](https://github.com/eea/volto-slate-footnote/commit/967eaa96d27f410c6c3dfc7471e887f4a2c04af5)]
34
- - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`c20a5a6`](https://github.com/eea/volto-slate-footnote/commit/c20a5a68fe75d6f6dc8d9b7b0ee4628470d2459e)]
35
- - Add Sonarqube tag using clms-frontend addons list [EEA Jenkins - [`2408868`](https://github.com/eea/volto-slate-footnote/commit/2408868886b25627e9b398ba55e2fdb3ef79d252)]
36
- - Add Sonarqube tag using ied-frontend addons list [EEA Jenkins - [`23eb21d`](https://github.com/eea/volto-slate-footnote/commit/23eb21d1dfb69a56a37aa9d2da58922b87cbe873)]
37
44
  ### [7.2.3](https://github.com/eea/volto-slate-footnote/compare/7.2.2...7.2.3) - 31 January 2025
38
45
 
39
46
  #### :bug: Bug Fixes
@@ -82,8 +89,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
82
89
 
83
90
  #### :hammer_and_wrench: Others
84
91
 
85
- - Add Sonarqube tag using insitu-frontend addons list [EEA Jenkins - [`1258c37`](https://github.com/eea/volto-slate-footnote/commit/1258c370d2ce42ddff78d6b749ab8c45897991d3)]
86
- - Add Sonarqube tag using freshwater-frontend addons list [EEA Jenkins - [`e1031b1`](https://github.com/eea/volto-slate-footnote/commit/e1031b1db0a34679e0bb312e8f0db9433bf08498)]
87
92
  ### [6.3.0](https://github.com/eea/volto-slate-footnote/compare/6.2.3...6.3.0) - 28 March 2024
88
93
 
89
94
  #### :hammer_and_wrench: Others
@@ -103,7 +108,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
103
108
 
104
109
  #### :hammer_and_wrench: Others
105
110
 
106
- - Add Sonarqube tag using insitu-frontend addons list [EEA Jenkins - [`aa335f9`](https://github.com/eea/volto-slate-footnote/commit/aa335f9eedd9d994b6fbceb57102d848dbdbae15)]
107
111
  ### [6.2.2](https://github.com/eea/volto-slate-footnote/compare/6.2.1...6.2.2) - 20 January 2024
108
112
 
109
113
  #### :hammer_and_wrench: Others
@@ -128,15 +132,9 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
128
132
 
129
133
  #### :house: Internal changes
130
134
 
131
- - chore: [JENKINS] Refactor automated testing [valentinab25 - [`5a5e1ad`](https://github.com/eea/volto-slate-footnote/commit/5a5e1adf997af84e93a4015dc66b7299abba0874)]
132
135
 
133
136
  #### :hammer_and_wrench: Others
134
137
 
135
- - test: [JENKINS] Use java17 for sonarqube scanner [valentinab25 - [`af6d78f`](https://github.com/eea/volto-slate-footnote/commit/af6d78f60dd040fe61ebb225f4a689ac21ffb55c)]
136
- - test: [JENKINS] Run cypress in started frontend container [valentinab25 - [`7f4c07f`](https://github.com/eea/volto-slate-footnote/commit/7f4c07f1fc2e9893d1f925152a473855a7e0f064)]
137
- - test: [JENKINS] Add cpu limit on cypress docker [valentinab25 - [`0670217`](https://github.com/eea/volto-slate-footnote/commit/0670217cca01571e8a3bd64ee3d85bb53ce447be)]
138
- - test: [JENKINS] Increase shm-size to cypress docker [valentinab25 - [`ec08749`](https://github.com/eea/volto-slate-footnote/commit/ec08749f9547d2c133b2174ab8d60cf2bdb1b23a)]
139
- - test: [JENKINS] Improve cypress time [valentinab25 - [`237e6a3`](https://github.com/eea/volto-slate-footnote/commit/237e6a331e3608aa35d1c93a03c435daf330c2bd)]
140
138
  ### [6.1.8](https://github.com/eea/volto-slate-footnote/compare/6.1.7...6.1.8) - 22 October 2023
141
139
 
142
140
  #### :house: Internal changes
@@ -206,25 +204,17 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
206
204
 
207
205
  #### :house: Internal changes
208
206
 
209
- - chore: [JENKINS] Deprecate circularity website [valentinab25 - [`ded882a`](https://github.com/eea/volto-slate-footnote/commit/ded882a1ca1183c2ba74ff4246111123ee36e6cb)]
210
207
 
211
208
  #### :hammer_and_wrench: Others
212
209
 
213
210
  - test: jest should look for addons in node_modules Refs #253277 [valentinab25 - [`3e0749c`](https://github.com/eea/volto-slate-footnote/commit/3e0749cc5bd7f5810ac6fd7a3feee4df0435ee0a)]
214
211
  - test: Add unit tests for utils - refs #253277 [ana-oprea - [`a709895`](https://github.com/eea/volto-slate-footnote/commit/a709895d9953742ef6d39f8d9673c06b2efe6a64)]
215
212
  - test: Fix test config, coverage Refs #253277 [valentinab25 - [`dc4d6dc`](https://github.com/eea/volto-slate-footnote/commit/dc4d6dc9b39bfe2c892156f32c764153d1366486)]
216
- - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`4f0ecee`](https://github.com/eea/volto-slate-footnote/commit/4f0ecee224d5d6604dfbb562556e45437edbb8ec)]
217
213
  ### [6.1.0](https://github.com/eea/volto-slate-footnote/compare/6.0.2...6.1.0) - 27 March 2023
218
214
 
219
215
  #### :hammer_and_wrench: Others
220
216
 
221
- - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`23959ee`](https://github.com/eea/volto-slate-footnote/commit/23959ee43d45ec5eaa483590415a75fc58faae03)]
222
- - Add Sonarqube tag using advisory-board-frontend addons list [EEA Jenkins - [`7aa6f34`](https://github.com/eea/volto-slate-footnote/commit/7aa6f3439953cc3d8f28875eff9fbcc24084cbc7)]
223
- - Add Sonarqube tag using advisory-board-frontend addons list [EEA Jenkins - [`b117d15`](https://github.com/eea/volto-slate-footnote/commit/b117d15e51b3cf10717b9dd9dfef8304d46ad556)]
224
217
  - test(Jenkins): Run tests and cypress with latest canary @plone/volto [Alin Voinea - [`97ed8fb`](https://github.com/eea/volto-slate-footnote/commit/97ed8fbd92f76c2b3128b62cdc1a77611e79410a)]
225
- - Add Sonarqube tag using cca-frontend addons list [EEA Jenkins - [`cb22f5e`](https://github.com/eea/volto-slate-footnote/commit/cb22f5e8e9d3aed0a3b4374b6d4d80c8c2bb66e1)]
226
- - yarn 3 [Alin Voinea - [`f5bb904`](https://github.com/eea/volto-slate-footnote/commit/f5bb904eecf740ffd57dbccf9a597c99ea2dfc0c)]
227
- - Add Sonarqube tag using demo-kitkat-frontend addons list [EEA Jenkins - [`59cf6d3`](https://github.com/eea/volto-slate-footnote/commit/59cf6d334a460e373dda3e2e28754fcdd9fb0281)]
228
218
  ### [6.0.2](https://github.com/eea/volto-slate-footnote/compare/6.0.1...6.0.2) - 16 November 2022
229
219
 
230
220
  #### :hammer_and_wrench: Others
@@ -240,37 +230,27 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
240
230
 
241
231
  #### :hammer_and_wrench: Others
242
232
 
243
- - Add Sonarqube tag using marine-frontend addons list [EEA Jenkins - [`dc3c7de`](https://github.com/eea/volto-slate-footnote/commit/dc3c7deaa8c692689ea0cec66cf019f05f9c4e22)]
244
- - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`133969a`](https://github.com/eea/volto-slate-footnote/commit/133969a37a6153a19af121d2f6031a70bc67cc9d)]
245
233
  ### [5.0.1](https://github.com/eea/volto-slate-footnote/compare/5.0.0...5.0.1) - 30 June 2022
246
234
 
247
235
  #### :hammer_and_wrench: Others
248
236
 
249
- - Add Sonarqube tag using circularity-frontend addons list [EEA Jenkins - [`4d5af13`](https://github.com/eea/volto-slate-footnote/commit/4d5af1345aad9071c031f7f00efd6bc5da04541f)]
250
237
  ## [5.0.0](https://github.com/eea/volto-slate-footnote/compare/4.0.5...5.0.0) - 19 May 2022
251
238
 
252
239
  ### [4.0.5](https://github.com/eea/volto-slate-footnote/compare/4.0.4...4.0.5) - 17 May 2022
253
240
 
254
241
  #### :hammer_and_wrench: Others
255
242
 
256
- - Add Sonarqube tag using clms-frontend addons list [EEA Jenkins - [`85a16ee`](https://github.com/eea/volto-slate-footnote/commit/85a16ee73d21d696282dc24933169d3c31383027)]
257
- - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`418349c`](https://github.com/eea/volto-slate-footnote/commit/418349ce22d98bf5dee58130d6f1cb9f45bbaa46)]
258
243
  ### [4.0.4](https://github.com/eea/volto-slate-footnote/compare/4.0.3...4.0.4) - 3 January 2022
259
244
 
260
245
  ### [4.0.3](https://github.com/eea/volto-slate-footnote/compare/4.0.2...4.0.3) - 18 December 2021
261
246
 
262
247
  #### :hammer_and_wrench: Others
263
248
 
264
- - Add Sonarqube tag using freshwater-frontend addons list [EEA Jenkins - [`ad06940`](https://github.com/eea/volto-slate-footnote/commit/ad0694074a06eb56ec1891256b262e9854c0303d)]
265
249
  - Refs #142010 - Optimize Volto-addons gitflow pipelines [valentinab25 - [`1081079`](https://github.com/eea/volto-slate-footnote/commit/1081079444f5ac806e9d56765c4ccf0b9e415a73)]
266
- - Add Sonarqube tag using industry-frontend addons list [EEA Jenkins - [`307687b`](https://github.com/eea/volto-slate-footnote/commit/307687b93d966e0df5c4a3f813dbb19442d2e169)]
267
- - Add Sonarqube tag using clms-frontend addons list [EEA Jenkins - [`0460e2a`](https://github.com/eea/volto-slate-footnote/commit/0460e2a73a4c8ede00b0c1fc3f05624eaa345a33)]
268
- - Add Sonarqube tag using forests-frontend addons list [EEA Jenkins - [`8aecee9`](https://github.com/eea/volto-slate-footnote/commit/8aecee99f11387e4ce31825209798772d7fee060)]
269
250
  ### [4.0.2](https://github.com/eea/volto-slate-footnote/compare/4.0.1...4.0.2) - 30 September 2021
270
251
 
271
252
  #### :hammer_and_wrench: Others
272
253
 
273
- - Add Sonarqube tag using sustainability-frontend addons list [EEA Jenkins - [`cf33efe`](https://github.com/eea/volto-slate-footnote/commit/cf33efec91b4b8d13562b8c8f660e7a78191d9e0)]
274
254
  - Remove :asDefault dependency from volto-slate [Alin Voinea - [`13dad5e`](https://github.com/eea/volto-slate-footnote/commit/13dad5ed23043fa7a24682e1ac6addc86632bfe0)]
275
255
  ### [4.0.1](https://github.com/eea/volto-slate-footnote/compare/4.0.0...4.0.1) - 29 September 2021
276
256
 
@@ -278,7 +258,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
278
258
 
279
259
  #### :hammer_and_wrench: Others
280
260
 
281
- - Add Sonarqube tag using climate-energy-frontend addons list [EEA Jenkins - [`80a159b`](https://github.com/eea/volto-slate-footnote/commit/80a159bb67698cddedadc494e7ae2da32a96faea)]
282
261
  ### [3.2.0](https://github.com/eea/volto-slate-footnote/compare/3.1.1...3.2.0) - 13 September 2021
283
262
 
284
263
  #### :hammer_and_wrench: Others
@@ -291,7 +270,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
291
270
  - Remove console.log [Alin Voinea - [`b5d83e7`](https://github.com/eea/volto-slate-footnote/commit/b5d83e7c13240151f602d122ecf09ba9b8e335f3)]
292
271
  - Fix slate json field default value in DX layout [Alin Voinea - [`f2805bb`](https://github.com/eea/volto-slate-footnote/commit/f2805bbc15c51ebd914ee5f4eb9dd34ef32e095b)]
293
272
  - Fix cypress api_url [Alin Voinea - [`6a4966a`](https://github.com/eea/volto-slate-footnote/commit/6a4966a2f92e932e1d0df35351989cda535f15c8)]
294
- - Add Sonarqube tag using ims-frontend addons list [EEA Jenkins - [`aed3984`](https://github.com/eea/volto-slate-footnote/commit/aed39840ecd467689eaf0adb352bd00ce95bdbbe)]
295
273
  ### [3.1.0](https://github.com/eea/volto-slate-footnote/compare/3.0.0...3.1.0) - 9 September 2021
296
274
 
297
275
  #### :hammer_and_wrench: Others
@@ -312,7 +290,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
312
290
  - Bump version to 2.4.0 [Alin Voinea - [`bef0d34`](https://github.com/eea/volto-slate-footnote/commit/bef0d34c2b9c20915578ffaefb4fd30cbf42f0a1)]
313
291
  - Fix Slate point from DOM crash [Alin Voinea - [`c852f79`](https://github.com/eea/volto-slate-footnote/commit/c852f7987ffe8db433235b70792002d40ade690f)]
314
292
  - Fix crash on copy&paste beforeInsert condition [Alin Voinea - [`85172cf`](https://github.com/eea/volto-slate-footnote/commit/85172cff3e2ea95a86d4b4fb452f3c0287b80e8f)]
315
- - Add Sonarqube tag using frontend addons list [EEA Jenkins - [`b471c41`](https://github.com/eea/volto-slate-footnote/commit/b471c418d198b1bde95acfe0b256f642bacc6865)]
316
293
  ### [2.3.1](https://github.com/eea/volto-slate-footnote/compare/2.3.0...2.3.1) - 25 June 2021
317
294
 
318
295
  ### [2.3.0](https://github.com/eea/volto-slate-footnote/compare/2.2.2...2.3.0) - 12 June 2021
package/DEVELOP.md CHANGED
@@ -26,21 +26,20 @@
26
26
 
27
27
  ### Or add @eeacms/volto-slate-footnote 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-slate-footnote --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-slate-footnote": {
42
+ "output": "packages",
44
43
  "url": "https://github.com/eea/volto-slate-footnote.git",
45
44
  "package": "@eeacms/volto-slate-footnote",
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-slate-footnote` 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-slate-footnote/
72
+ cd packages/volto-slate-footnote
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-slate-footnote` to `mrs.developer.json`
81
83
  Go to:
82
84
 
83
85
  ```BASH
84
- cd src/addons/volto-slate-footnote/
86
+ cd packages/volto-slate-footnote/
85
87
  ```
86
88
 
87
89
  Start:
package/Dockerfile CHANGED
@@ -1,13 +1,22 @@
1
1
  # syntax=docker/dockerfile:1
2
2
  ARG VOLTO_VERSION
3
- FROM eeacms/frontend-builder:${VOLTO_VERSION}
3
+ FROM plone/frontend-builder:${VOLTO_VERSION}
4
4
 
5
5
  ARG ADDON_NAME
6
6
  ARG ADDON_PATH
7
+ ENV HOST="0.0.0.0"
8
+
9
+ USER root
10
+ RUN apt-get update -q \
11
+ && apt-get install -qy --no-install-recommends \
12
+ chromium libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb \
13
+ && rm -rf /var/lib/apt/lists/*
14
+ USER node
7
15
 
8
16
  COPY --chown=node:node ./ /app/src/addons/${ADDON_PATH}/
9
17
 
10
18
  RUN /setupAddon
19
+ RUN yarn add jest-junit
11
20
  RUN yarn install
12
21
 
13
22
  ENTRYPOINT ["yarn"]
package/Jenkinsfile CHANGED
@@ -1,7 +1,4 @@
1
1
  pipeline {
2
- tools {
3
- jdk 'Java17'
4
- }
5
2
  agent {
6
3
  node { label 'docker-host' }
7
4
  }
@@ -9,12 +6,12 @@ pipeline {
9
6
  environment {
10
7
  GIT_NAME = "volto-slate-footnote"
11
8
  NAMESPACE = "@eeacms"
12
- SONARQUBE_TAGS = "volto.eea.europa.eu,biodiversity.europa.eu,www.eea.europa.eu-ims,climate-energy.eea.europa.eu,forest.eea.europa.eu,industry.eea.europa.eu,water.europa.eu-freshwater,demo-www.eea.europa.eu,clmsdemo.devel6cph.eea.europa.eu,water.europa.eu-marine,climate-adapt.eea.europa.eu,climate-advisory-board.devel4cph.eea.europa.eu,climate-advisory-board.europa.eu,www.eea.europa.eu-en,insitu.copernicus.eu,ask.copernicus.eu,land.copernicus.eu"
9
+ SONARQUBE_TAGS = "volto.eea.europa.eu,biodiversity.europa.eu,climate-energy.eea.europa.eu,forest.eea.europa.eu,industry.eea.europa.eu,water.europa.eu-freshwater,demo-www.eea.europa.eu,clmsdemo.devel6cph.eea.europa.eu,water.europa.eu-marine,climate-adapt.eea.europa.eu,climate-advisory-board.devel4cph.eea.europa.eu,climate-advisory-board.europa.eu,www.eea.europa.eu-en,www.eea.europa.eu,insitu.copernicus.eu,ask.copernicus.eu,land.copernicus.eu"
13
10
  DEPENDENCIES = ""
14
11
  BACKEND_PROFILES = "eea.kitkat:testing"
15
12
  BACKEND_ADDONS = ""
16
13
  VOLTO = "17"
17
- VOLTO16_BREAKING_CHANGES = "no"
14
+ VOLTO18_BREAKING_CHANGES = "no"
18
15
  IMAGE_NAME = BUILD_TAG.toLowerCase()
19
16
  }
20
17
 
@@ -242,11 +239,17 @@ pipeline {
242
239
  script {
243
240
  def scannerHome = tool 'SonarQubeScanner'
244
241
  def nodeJS = tool 'NodeJS'
242
+ if (env.CHANGE_ID) {
243
+ env.sonarParams = " -Dsonar.pullrequest.base=${env.CHANGE_TARGET} -Dsonar.pullrequest.branch=${env.CHANGE_BRANCH} -Dsonar.pullrequest.key=${env.CHANGE_ID} "
244
+ }
245
+ else {
246
+ env.sonarParams = " -Dsonar.branch.name=${env.BRANCH_NAME}"
247
+ }
245
248
  withSonarQubeEnv('Sonarqube') {
246
249
  sh '''sed -i "s#/app/src/addons/${GIT_NAME}/##g" xunit-reports/coverage/lcov.info'''
247
250
  sh '''sed -i "s#src/addons/${GIT_NAME}/##g" xunit-reports/coverage/lcov.info'''
248
- sh "export PATH=${scannerHome}/bin:${nodeJS}/bin:$PATH; sonar-scanner -Dsonar.javascript.lcov.reportPaths=./xunit-reports/coverage/lcov.info,./cypress-coverage/coverage/lcov.info -Dsonar.sources=./src -Dsonar.projectKey=$GIT_NAME-$BRANCH_NAME -Dsonar.projectVersion=$BRANCH_NAME-$BUILD_NUMBER"
249
- sh '''try=5; while [ \$try -gt 0 ]; do curl -s -XPOST -u "${SONAR_AUTH_TOKEN}:" "${SONAR_HOST_URL}api/project_tags/set?project=${GIT_NAME}-${BRANCH_NAME}&tags=${SONARQUBE_TAGS},${BRANCH_NAME}" > set_tags_result; if [ \$(grep -ic error set_tags_result ) -eq 0 ]; then try=0; else cat set_tags_result; echo "... Will retry"; sleep 15; try=\$(( \$try - 1 )); fi; done'''
251
+ sh "export PATH=${scannerHome}/bin:${nodeJS}/bin:$PATH; sonar-scanner -Dsonar.javascript.lcov.reportPaths=./xunit-reports/coverage/lcov.info,./cypress-coverage/coverage/lcov.info -Dsonar.sources=./src -Dsonar.projectKey=$GIT_NAME -Dsonar.projectName=$GIT_NAME -Dsonar.projectVersion=\$(jq -r '.version' package.json) ${env.sonarParams}"
252
+ sh '''try=5; while [ \$try -gt 0 ]; do curl -s -XPOST -u "${SONAR_AUTH_TOKEN}:" "${SONAR_HOST_URL}api/project_tags/set?project=${GIT_NAME}&tags=${SONARQUBE_TAGS}" > set_tags_result; if [ \$(grep -ic error set_tags_result ) -eq 0 ]; then try=0; else cat set_tags_result; echo "... Will retry"; sleep 15; try=\$(( \$try - 1 )); fi; done'''
250
253
  }
251
254
  }
252
255
  }
@@ -256,75 +259,75 @@ pipeline {
256
259
  }
257
260
  }
258
261
 
259
- stage('Volto 16') {
262
+ stage('Volto 18') {
260
263
  agent { node { label 'integration'} }
261
264
  when {
262
265
  environment name: 'SKIP_TESTS', value: ''
263
- not { environment name: 'VOLTO16_BREAKING_CHANGES', value: 'yes' }
266
+ not { environment name: 'VOLTO18_BREAKING_CHANGES', value: 'yes' }
264
267
  }
265
268
  stages {
266
269
  stage('Build test image') {
267
270
  steps {
268
- sh '''docker build --pull --build-arg="VOLTO_VERSION=16" --build-arg="ADDON_NAME=$NAMESPACE/$GIT_NAME" --build-arg="ADDON_PATH=$GIT_NAME" . -t $IMAGE_NAME-frontend16'''
271
+ sh '''docker build --pull --build-arg="VOLTO_VERSION=18-yarn" --build-arg="ADDON_NAME=$NAMESPACE/$GIT_NAME" --build-arg="ADDON_PATH=$GIT_NAME" . -t $IMAGE_NAME-frontend18'''
269
272
  }
270
273
  }
271
274
 
272
- stage('Unit tests Volto 16') {
275
+ stage('Unit tests Volto 18') {
273
276
  steps {
274
277
  script {
275
278
  try {
276
- sh '''docker run --name="$IMAGE_NAME-volto16" --entrypoint=make --workdir=/app/src/addons/$GIT_NAME $IMAGE_NAME-frontend16 test-ci'''
277
- sh '''rm -rf xunit-reports16'''
278
- sh '''mkdir -p xunit-reports16'''
279
- sh '''docker cp $IMAGE_NAME-volto16:/app/junit.xml xunit-reports16/'''
279
+ sh '''docker run --name="$IMAGE_NAME-volto18" --entrypoint=make --workdir=/app/src/addons/$GIT_NAME $IMAGE_NAME-frontend18 test-ci'''
280
+ sh '''rm -rf xunit-reports18'''
281
+ sh '''mkdir -p xunit-reports18'''
282
+ sh '''docker cp $IMAGE_NAME-volto18:/app/junit.xml xunit-reports18/'''
280
283
  } finally {
281
284
  catchError(buildResult: 'SUCCESS', stageResult: 'SUCCESS') {
282
- junit testResults: 'xunit-reports16/junit.xml', allowEmptyResults: true
285
+ junit testResults: 'xunit-reports18/junit.xml', allowEmptyResults: true
283
286
  }
284
- sh script: '''docker rm -v $IMAGE_NAME-volto16''', returnStatus: true
287
+ sh script: '''docker rm -v $IMAGE_NAME-volto18''', returnStatus: true
285
288
  }
286
289
  }
287
290
  }
288
291
  }
289
292
 
290
- stage('Integration tests Volto 16') {
293
+ stage('Integration tests Volto 18') {
291
294
  steps {
292
295
  script {
293
296
  try {
294
- sh '''docker run --pull always --rm -d --name="$IMAGE_NAME-plone16" -e SITE="Plone" -e PROFILES="$BACKEND_PROFILES" -e ADDONS="$BACKEND_ADDONS" eeacms/plone-backend'''
295
- sh '''docker run -d --shm-size=4g --link $IMAGE_NAME-plone16:plone --name="$IMAGE_NAME-cypress16" -e "RAZZLE_INTERNAL_API_PATH=http://plone:8080/Plone" --entrypoint=make --workdir=/app/src/addons/$GIT_NAME $IMAGE_NAME-frontend16 start-ci'''
296
- frontend = sh script:'''docker exec --workdir=/app/src/addons/${GIT_NAME} $IMAGE_NAME-cypress16 make check-ci''', returnStatus: true
297
+ sh '''docker run --pull always --rm -d --name="$IMAGE_NAME-plone18" -e SITE="Plone" -e PROFILES="$BACKEND_PROFILES" -e ADDONS="$BACKEND_ADDONS" eeacms/plone-backend'''
298
+ sh '''docker run -d --shm-size=4g --link $IMAGE_NAME-plone18:plone --name="$IMAGE_NAME-cypress18" -e "RAZZLE_INTERNAL_API_PATH=http://plone:8080/Plone" --entrypoint=make --workdir=/app/src/addons/$GIT_NAME $IMAGE_NAME-frontend18 start-ci'''
299
+ frontend = sh script:'''docker exec --workdir=/app/src/addons/${GIT_NAME} $IMAGE_NAME-cypress18 make check-ci''', returnStatus: true
297
300
  if ( frontend != 0 ) {
298
- sh '''docker logs $IMAGE_NAME-cypress16; exit 1'''
301
+ sh '''docker logs $IMAGE_NAME-cypress18; exit 1'''
299
302
  }
300
- sh '''timeout -s 9 1800 docker exec --workdir=/app/src/addons/${GIT_NAME} $IMAGE_NAME-cypress16 make cypress-ci'''
303
+ sh '''timeout -s 9 1800 docker exec --workdir=/app/src/addons/${GIT_NAME} $IMAGE_NAME-cypress18 make cypress-ci'''
301
304
  } finally {
302
305
  try {
303
306
  if ( frontend == 0 ) {
304
- sh '''rm -rf cypress-videos16 cypress-results16 cypress-coverage16 cypress-screenshots16'''
305
- sh '''mkdir -p cypress-videos16 cypress-results16 cypress-coverage16 cypress-screenshots16'''
306
- videos = sh script: '''docker cp $IMAGE_NAME-cypress16:/app/src/addons/$GIT_NAME/cypress/videos cypress-videos16/''', returnStatus: true
307
- sh '''docker cp $IMAGE_NAME-cypress16:/app/src/addons/$GIT_NAME/cypress/reports cypress-results16/'''
308
- screenshots = sh script: '''docker cp $IMAGE_NAME-cypress16:/app/src/addons/$GIT_NAME/cypress/screenshots cypress-screenshots16''', returnStatus: true
307
+ sh '''rm -rf cypress-videos18 cypress-results18 cypress-coverage18 cypress-screenshots18'''
308
+ sh '''mkdir -p cypress-videos18 cypress-results18 cypress-coverage18 cypress-screenshots18'''
309
+ videos = sh script: '''docker cp $IMAGE_NAME-cypress18:/app/src/addons/$GIT_NAME/cypress/videos cypress-videos18/''', returnStatus: true
310
+ sh '''docker cp $IMAGE_NAME-cypress18:/app/src/addons/$GIT_NAME/cypress/reports cypress-results18/'''
311
+ screenshots = sh script: '''docker cp $IMAGE_NAME-cypress18:/app/src/addons/$GIT_NAME/cypress/screenshots cypress-screenshots18''', returnStatus: true
309
312
 
310
- archiveArtifacts artifacts: 'cypress-screenshots16/**', fingerprint: true, allowEmptyArchive: true
313
+ archiveArtifacts artifacts: 'cypress-screenshots18/**', fingerprint: true, allowEmptyArchive: true
311
314
 
312
315
  if ( videos == 0 ) {
313
- sh '''for file in $(find cypress-results16 -name *.xml); do if [ $(grep -E 'failures="[1-9].*"' $file | wc -l) -eq 0 ]; then testname=$(grep -E 'file=.*failures="0"' $file | sed 's#.* file=".*\\/\\(.*\\.[jsxt]\\+\\)" time.*#\\1#' ); rm -f cypress-videos16/videos/$testname.mp4; fi; done'''
314
- archiveArtifacts artifacts: 'cypress-videos16/**/*.mp4', fingerprint: true, allowEmptyArchive: true
316
+ sh '''for file in $(find cypress-results18 -name *.xml); do if [ $(grep -E 'failures="[1-9].*"' $file | wc -l) -eq 0 ]; then testname=$(grep -E 'file=.*failures="0"' $file | sed 's#.* file=".*\\/\\(.*\\.[jsxt]\\+\\)" time.*#\\1#' ); rm -f cypress-videos18/videos/$testname.mp4; fi; done'''
317
+ archiveArtifacts artifacts: 'cypress-videos18/**/*.mp4', fingerprint: true, allowEmptyArchive: true
315
318
  }
316
319
  }
317
320
  } finally {
318
321
  catchError(buildResult: 'SUCCESS', stageResult: 'SUCCESS') {
319
- junit testResults: 'cypress-results16/**/*.xml', allowEmptyResults: true
322
+ junit testResults: 'cypress-results18/**/*.xml', allowEmptyResults: true
320
323
  }
321
324
  catchError(buildResult: 'SUCCESS', stageResult: 'SUCCESS') {
322
- sh '''docker logs $IMAGE_NAME-cypress16'''
325
+ sh '''docker logs $IMAGE_NAME-cypress18'''
323
326
  }
324
- sh script: "docker stop $IMAGE_NAME-cypress16", returnStatus: true
325
- sh script: "docker stop $IMAGE_NAME-plone16", returnStatus: true
326
- sh script: "docker rm -v $IMAGE_NAME-plone16", returnStatus: true
327
- sh script: "docker rm -v $IMAGE_NAME-cypress16", returnStatus: true
327
+ sh script: "docker stop $IMAGE_NAME-cypress18", returnStatus: true
328
+ sh script: "docker stop $IMAGE_NAME-plone18", returnStatus: true
329
+ sh script: "docker rm -v $IMAGE_NAME-plone18", returnStatus: true
330
+ sh script: "docker rm -v $IMAGE_NAME-cypress18", returnStatus: true
328
331
  }
329
332
  }
330
333
  }
@@ -337,7 +340,7 @@ pipeline {
337
340
  post {
338
341
  always {
339
342
  sh script: "docker rmi $IMAGE_NAME-frontend", returnStatus: true
340
- sh script: "docker rmi $IMAGE_NAME-frontend16", returnStatus: true
343
+ sh script: "docker rmi $IMAGE_NAME-frontend18", returnStatus: true
341
344
  }
342
345
  }
343
346
  }
@@ -363,7 +366,7 @@ pipeline {
363
366
  script {
364
367
  sh '''echo "Error" > checkresult.txt'''
365
368
  catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
366
- sh '''set -o pipefail; docker run -i --rm --pull always --name="$IMAGE_NAME-gitflow-sn" -e GIT_BRANCH="$BRANCH_NAME" -e GIT_NAME="$GIT_NAME" eeacms/gitflow /checkSonarqubemaster.sh | grep -v "Found script" | tee checkresult.txt'''
369
+ sh '''set -o pipefail; docker run -i --rm --pull always --name="$IMAGE_NAME-gitflow-sn" -e GIT_BRANCH="$BRANCH_NAME" -e GIT_NAME="$GIT_NAME" eeacms/gitflow /checkSonarqubemasterV2.sh | grep -v "Found script" | tee checkresult.txt'''
367
370
  }
368
371
 
369
372
  publishChecks name: 'SonarQube', title: 'Sonarqube Code Quality Check', summary: 'Quality check on the SonarQube metrics from branch develop, comparing it with the ones from master branch. No bugs are allowed',
package/Makefile CHANGED
@@ -23,10 +23,12 @@ SHELL:=bash
23
23
  .DELETE_ON_ERROR:
24
24
  MAKEFLAGS+=--warn-undefined-variables
25
25
  MAKEFLAGS+=--no-builtin-rules
26
+ TERM?=dumb
27
+ export TERM
26
28
 
27
29
  # Colors
28
30
  # OK=Green, warn=yellow, error=red
29
- ifeq ($(TERM),)
31
+ ifneq ($(shell test -n "$$TERM" && command -v tput >/dev/null 2>&1 && echo yes),yes)
30
32
  # no colors if not in terminal
31
33
  MARK_COLOR=
32
34
  OK_COLOR=
@@ -34,11 +36,11 @@ ifeq ($(TERM),)
34
36
  ERROR_COLOR=
35
37
  NO_COLOR=
36
38
  else
37
- MARK_COLOR=`tput setaf 6`
38
- OK_COLOR=`tput setaf 2`
39
- WARN_COLOR=`tput setaf 3`
40
- ERROR_COLOR=`tput setaf 1`
41
- NO_COLOR=`tput sgr0`
39
+ MARK_COLOR:=$(shell tput setaf 6 2>/dev/null || true)
40
+ OK_COLOR:=$(shell tput setaf 2 2>/dev/null || true)
41
+ WARN_COLOR:=$(shell tput setaf 3 2>/dev/null || true)
42
+ ERROR_COLOR:=$(shell tput setaf 1 2>/dev/null || true)
43
+ NO_COLOR:=$(shell tput sgr0 2>/dev/null || true)
42
44
  endif
43
45
 
44
46
  ##############################################################################
@@ -46,7 +48,7 @@ endif
46
48
  DIR=$(shell basename $$(pwd))
47
49
  NODE_MODULES?="../../../node_modules"
48
50
  PLONE_VERSION?=6
49
- VOLTO_VERSION?=17
51
+ VOLTO_VERSION?=18-yarn
50
52
  ADDON_PATH="${DIR}"
51
53
  ADDON_NAME="@eeacms/${ADDON_PATH}"
52
54
  DOCKER_COMPOSE=PLONE_VERSION=${PLONE_VERSION} VOLTO_VERSION=${VOLTO_VERSION} ADDON_NAME=${ADDON_NAME} ADDON_PATH=${ADDON_PATH} docker compose
@@ -82,19 +84,19 @@ shell: ## Start a shell in the frontend container
82
84
 
83
85
  .PHONY: cypress-open
84
86
  cypress-open: ## Open cypress integration tests
85
- CYPRESS_API_PATH="${RAZZLE_DEV_PROXY_API_PATH}" NODE_ENV=development $(NODE_MODULES)/cypress/bin/cypress open
87
+ TERM="$${TERM:-dumb}" CYPRESS_API_PATH="${RAZZLE_DEV_PROXY_API_PATH}" NODE_ENV=development $(NODE_MODULES)/cypress/bin/cypress open
86
88
 
87
89
  .PHONY: cypress-run
88
90
  cypress-run: ## Run cypress integration tests
89
- CYPRESS_API_PATH="${RAZZLE_DEV_PROXY_API_PATH}" NODE_ENV=development $(NODE_MODULES)/cypress/bin/cypress run
91
+ TERM="$${TERM:-dumb}" CYPRESS_API_PATH="${RAZZLE_DEV_PROXY_API_PATH}" NODE_ENV=development $(NODE_MODULES)/cypress/bin/cypress run
90
92
 
91
93
  .PHONY: test
92
94
  test: ## Run jest tests
93
- ${DOCKER_COMPOSE} run -e CI=1 frontend test
95
+ ${DOCKER_COMPOSE} run --no-deps -e CI=1 frontend test
94
96
 
95
97
  .PHONY: test-update
96
98
  test-update: ## Update jest tests snapshots
97
- ${DOCKER_COMPOSE} run -e CI=1 frontend test -u
99
+ ${DOCKER_COMPOSE} run --no-deps -e CI=1 frontend test -u
98
100
 
99
101
  .PHONY: stylelint
100
102
  stylelint: ## Stylelint
@@ -162,4 +164,4 @@ check-ci:
162
164
  .PHONY: cypress-ci
163
165
  cypress-ci:
164
166
  $(NODE_MODULES)/.bin/wait-on -t 240000 http://localhost:3000
165
- CYPRESS_API_PATH="${RAZZLE_DEV_PROXY_API_PATH}" NODE_ENV=development $(NODE_MODULES)/cypress/bin/cypress run --browser chromium
167
+ TERM="$${TERM:-dumb}" CYPRESS_API_PATH="${RAZZLE_DEV_PROXY_API_PATH}" NODE_ENV=development $(NODE_MODULES)/cypress/bin/cypress run --browser chromium
package/README.md CHANGED
@@ -3,16 +3,16 @@
3
3
  [![Releases](https://img.shields.io/github/v/release/eea/volto-slate-footnote)](https://github.com/eea/volto-slate-footnote/releases)
4
4
 
5
5
  [![Pipeline](https://ci.eionet.europa.eu/buildStatus/icon?job=volto-addons%2Fvolto-slate-footnote%2Fmaster&subject=master)](https://ci.eionet.europa.eu/view/Github/job/volto-addons/job/volto-slate-footnote/job/master/display/redirect)
6
- [![Lines of Code](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-slate-footnote-master&metric=ncloc)](https://sonarqube.eea.europa.eu/dashboard?id=volto-slate-footnote-master)
7
- [![Coverage](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-slate-footnote-master&metric=coverage)](https://sonarqube.eea.europa.eu/dashboard?id=volto-slate-footnote-master)
8
- [![Bugs](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-slate-footnote-master&metric=bugs)](https://sonarqube.eea.europa.eu/dashboard?id=volto-slate-footnote-master)
9
- [![Duplicated Lines (%)](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-slate-footnote-master&metric=duplicated_lines_density)](https://sonarqube.eea.europa.eu/dashboard?id=volto-slate-footnote-master)
6
+ [![Lines of Code](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-slate-footnote&metric=ncloc)](https://sonarqube.eea.europa.eu/dashboard?id=volto-slate-footnote)
7
+ [![Coverage](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-slate-footnote&metric=coverage)](https://sonarqube.eea.europa.eu/dashboard?id=volto-slate-footnote)
8
+ [![Bugs](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-slate-footnote&metric=bugs)](https://sonarqube.eea.europa.eu/dashboard?id=volto-slate-footnote)
9
+ [![Duplicated Lines (%)](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-slate-footnote&metric=duplicated_lines_density)](https://sonarqube.eea.europa.eu/dashboard?id=volto-slate-footnote)
10
10
 
11
11
  [![Pipeline](https://ci.eionet.europa.eu/buildStatus/icon?job=volto-addons%2Fvolto-slate-footnote%2Fdevelop&subject=develop)](https://ci.eionet.europa.eu/view/Github/job/volto-addons/job/volto-slate-footnote/job/develop/display/redirect)
12
- [![Lines of Code](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-slate-footnote-develop&metric=ncloc)](https://sonarqube.eea.europa.eu/dashboard?id=volto-slate-footnote-develop)
13
- [![Coverage](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-slate-footnote-develop&metric=coverage)](https://sonarqube.eea.europa.eu/dashboard?id=volto-slate-footnote-develop)
14
- [![Bugs](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-slate-footnote-develop&metric=bugs)](https://sonarqube.eea.europa.eu/dashboard?id=volto-slate-footnote-develop)
15
- [![Duplicated Lines (%)](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-slate-footnote-develop&metric=duplicated_lines_density)](https://sonarqube.eea.europa.eu/dashboard?id=volto-slate-footnote-develop)
12
+ [![Lines of Code](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-slate-footnote&branch=develop&metric=ncloc)](https://sonarqube.eea.europa.eu/dashboard?id=volto-slate-footnote&branch=develop)
13
+ [![Coverage](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-slate-footnote&branch=develop&metric=coverage)](https://sonarqube.eea.europa.eu/dashboard?id=volto-slate-footnote&branch=develop)
14
+ [![Bugs](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-slate-footnote&branch=develop&metric=bugs)](https://sonarqube.eea.europa.eu/dashboard?id=volto-slate-footnote&branch=develop)
15
+ [![Duplicated Lines (%)](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-slate-footnote&branch=develop&metric=duplicated_lines_density)](https://sonarqube.eea.europa.eu/dashboard?id=volto-slate-footnote&branch=develop)
16
16
 
17
17
 
18
18
  [Volto Slate](hhttps://6.dev-docs.plone.org/volto/configuration/volto-slate/) Footnotes
@@ -40,6 +40,11 @@ This version requires: `@plone/volto >= 16.0.0.alpha.15` (`volto-slate` part of
40
40
 
41
41
  Go to http://localhost:3000
42
42
 
43
+ `make start` now defaults to Volto 18. To run the same setup against Volto 17, use:
44
+
45
+ VOLTO_VERSION=17 make
46
+ VOLTO_VERSION=17 make start
47
+
43
48
  ### Add volto-slate-footnote to your Volto project
44
49
 
45
50
  1. Make sure you have a [Plone backend](https://plone.org/download) up-and-running at http://localhost:8080/Plone
@@ -53,30 +58,39 @@ Go to http://localhost:3000
53
58
  * If you already have a volto project, just update `package.json`:
54
59
 
55
60
  ```JSON
56
- "addons": [
57
- "@eeacms/volto-slate-footnote"
58
- ],
59
-
60
61
  "dependencies": {
61
62
  "@eeacms/volto-slate-footnote": "*"
62
63
  }
63
64
  ```
64
65
 
65
- * If not, create one:
66
+ and `volto.config.js`:
67
+
68
+ ```JavaScript
69
+ const addons = ['@eeacms/volto-slate-footnote'];
70
+ ```
71
+
72
+ * If not, create one with Cookieplone, as recommended by the official Plone documentation for Volto 18+:
66
73
 
67
74
  ```
68
- npm install -g yo @plone/generator-volto
69
- yo @plone/volto my-volto-project --canary --addon @eeacms/volto-slate-footnote
70
- cd my-volto-project
75
+ uvx cookieplone project
76
+ cd project-title
71
77
  ```
72
78
 
73
- 1. Install new add-ons and restart Volto:
79
+ 1. Install or update dependencies, then start the project:
74
80
 
75
81
  ```
76
- yarn
77
- yarn start
82
+ make install
78
83
  ```
79
84
 
85
+ For a Cookieplone project, start the backend and frontend in separate terminals:
86
+
87
+ ```
88
+ make backend-start
89
+ make frontend-start
90
+ ```
91
+
92
+ For a legacy Volto 17 project, install the package with `yarn` and restart the frontend as usual.
93
+
80
94
  1. Go to http://localhost:3000
81
95
 
82
96
  1. Happy editing!
@@ -1,109 +1,176 @@
1
1
  import { slateBeforeEach, slateAfterEach } from '../support/e2e';
2
2
 
3
+ const getVisibleSlateToolbarButton = (title) =>
4
+ cy.get('body').then(($body) => {
5
+ const buttons = $body
6
+ .find(`.slate-inline-toolbar .button-wrapper a[title="${title}"]`)
7
+ .filter(':visible');
8
+
9
+ expect(
10
+ buttons.length,
11
+ `visible "${title}" slate toolbar button`,
12
+ ).to.be.greaterThan(0);
13
+
14
+ return cy.wrap(buttons.last());
15
+ });
16
+
17
+ const triggerVisibleSlateToolbarButton = (title) =>
18
+ getVisibleSlateToolbarButton(title).trigger('mousedown', { force: true });
19
+
20
+ const getFootnotePopup = () =>
21
+ cy.contains('h2', 'Footnote entry').closest('header');
22
+
23
+ const openFootnotePopup = () => {
24
+ triggerVisibleSlateToolbarButton('Footnote');
25
+ cy.wait(300);
26
+ cy.get('body').then(($body) => {
27
+ if ($body.text().includes('Footnote entry')) {
28
+ return;
29
+ }
30
+
31
+ const editButton = $body.find(
32
+ '.slate-inline-toolbar:visible .button-wrapper a[title="Edit footnote"]',
33
+ );
34
+
35
+ if (editButton.length) {
36
+ cy.wrap(editButton.last()).trigger('mousedown', { force: true });
37
+ }
38
+ });
39
+ getFootnotePopup().should('exist');
40
+ };
41
+
42
+ const setFootnoteReferences = (references) => {
43
+ cy.get(
44
+ '#blockform-fieldset-default .field-wrapper-footnote .react-select-container',
45
+ )
46
+ .last()
47
+ .click();
48
+
49
+ references.forEach((reference, index) => {
50
+ if (index > 0) {
51
+ cy.get(
52
+ '#blockform-fieldset-default .field-wrapper-footnote .react-select-container',
53
+ )
54
+ .last()
55
+ .click();
56
+ }
57
+
58
+ cy.focused().type(`${reference}{enter}`, { force: true });
59
+ });
60
+ };
61
+
62
+ const saveFootnotePopup = () => {
63
+ getFootnotePopup().find('button').first().click();
64
+ };
65
+
66
+ const cancelFootnotePopup = () => {
67
+ getFootnotePopup().find('button').last().click();
68
+ };
69
+
70
+ const addFootnotesBlock = ({ title = 'Footnotes', global = true } = {}) => {
71
+ cy.getSlateEditorAndType('{enter}');
72
+ cy.get('.ui.basic.icon.button.block-add-button').first().click();
73
+ cy.get('.blocks-chooser .title').contains('Text').click();
74
+ cy.get('.blocks-chooser .content.active .button')
75
+ .contains('Footnotes')
76
+ .click();
77
+
78
+ cy.contains('Footnote block').should('exist');
79
+ cy.get('input[name="title"]').last().clear().type(title);
80
+
81
+ if (global) {
82
+ cy.get('#field-global').last().click({ force: true });
83
+ }
84
+ };
85
+
86
+ const visitPageEdit = () => {
87
+ cy.navigate('/cypress/my-page/edit');
88
+ cy.get('.block.title h1').should('exist');
89
+ };
90
+
3
91
  describe('Slate citations', () => {
4
92
  beforeEach(slateBeforeEach);
5
93
  afterEach(slateAfterEach);
6
94
 
7
- it('Add Footnotes block and create citation', () => {
8
- // Complete chained commands
95
+ it('allows adding a footnote and footnotes block', () => {
9
96
  cy.getSlateEditorAndType('Colorless green ideas sleep furiously.')
10
97
  .type('{selectAll}')
11
98
  .dblclick();
12
99
 
13
- // Footnote
14
100
  cy.setSlateCursor('Colorless').dblclick();
15
101
  cy.setSlateSelection('Colorless', 'green');
16
- cy.clickSlateButton('Footnote');
17
-
18
- cy.get('.sidebar-container .field-wrapper-footnote .react-select-container')
19
- .click()
20
- .type('Citation{enter}');
21
- cy.get('.sidebar-container .form .header button:first-of-type').click();
22
-
23
- // Add block
24
- cy.getSlateEditorAndType('{enter}');
25
-
26
- cy.get('.ui.basic.icon.button.block-add-button').first().click();
27
- cy.get('.blocks-chooser .title').contains('Text').click();
28
- cy.get('.content.active.text .button.slateFootnotes')
29
- .contains('Footnotes')
30
- .click();
102
+ openFootnotePopup();
103
+ setFootnoteReferences(['Citation']);
104
+ saveFootnotePopup();
31
105
 
32
- // Configure block
33
- cy.get('[id=sidebar-properties] [name=title]').click().type('Footnotes');
34
- cy.get('[id=sidebar-properties] label[for=field-global]').click();
106
+ addFootnotesBlock();
107
+ cy.toolbarSave();
35
108
 
36
- // Save
37
- cy.get('#toolbar-save').click();
38
- cy.url().should('eq', Cypress.config().baseUrl + '/cypress/my-page');
39
-
40
- // then the page view should contain our changes
41
109
  cy.get('span.citation-item').contains('Colorless green');
42
110
  cy.contains('Footnotes');
43
111
  cy.contains('Citation');
44
112
  cy.get('[aria-label="Back to content"]').first().click();
45
113
  });
46
114
 
47
- it('Test cancel Button', () => {
115
+ it('allows canceling a footnote edit', () => {
48
116
  cy.getSlateEditorAndType('Colorless green ideas sleep furiously.')
49
117
  .type('{selectAll}')
50
118
  .dblclick();
51
119
 
52
- // Footnote
53
120
  cy.setSlateCursor('Colorless').dblclick();
54
121
  cy.setSlateSelection('Colorless', 'green');
55
- cy.clickSlateButton('Footnote');
122
+ openFootnotePopup();
123
+ setFootnoteReferences(['Citation']);
124
+ cancelFootnotePopup();
125
+
126
+ cy.toolbarSave();
127
+ cy.contains('My Page');
128
+ cy.get('span.citation-item').should('not.exist');
129
+ cy.contains('Footnotes').should('not.exist');
130
+ });
56
131
 
57
- cy.get('.sidebar-container .field-wrapper-footnote .react-select-container')
58
- .click()
59
- .type('Citation{enter}');
132
+ it('allows adding multiple citations for the same footnote', () => {
133
+ cy.getSlateEditorAndType('Colorless green ideas sleep furiously.')
134
+ .type('{selectAll}')
135
+ .dblclick();
60
136
 
61
- //click on the cancel button
62
- cy.get('.sidebar-container .form .header button').first().next().click();
137
+ cy.setSlateCursor('Colorless').dblclick();
138
+ cy.setSlateSelection('Colorless', 'green');
139
+ openFootnotePopup();
140
+ setFootnoteReferences(['Citation', 'Yet another citation']);
141
+ saveFootnotePopup();
63
142
 
64
- // Save
65
- cy.get('#toolbar-save').click();
66
- cy.url().should('eq', Cypress.config().baseUrl + '/cypress/my-page');
143
+ addFootnotesBlock();
144
+ cy.toolbarSave();
145
+
146
+ cy.get('span.citation-item').contains('Colorless green');
147
+ cy.contains('Footnotes');
148
+ cy.contains('Citation');
149
+ cy.contains('Yet another citation');
67
150
  });
68
151
 
69
- it('Add Footnotes block and create multiple citations', () => {
70
- // Complete chained commands
152
+ it('renders an existing citation node in edit mode through the UI', () => {
71
153
  cy.getSlateEditorAndType('Colorless green ideas sleep furiously.')
72
154
  .type('{selectAll}')
73
155
  .dblclick();
74
156
 
75
- // Footnote
76
157
  cy.setSlateCursor('Colorless').dblclick();
77
158
  cy.setSlateSelection('Colorless', 'green');
78
- cy.clickSlateButton('Footnote');
79
-
80
- cy.get('.sidebar-container .field-wrapper-footnote .react-select-container')
81
- .click()
82
- .type('Citation{enter}')
83
- .type('Yet another citation{enter}');
84
- cy.get('.sidebar-container .form .header button:first-of-type').click();
159
+ openFootnotePopup();
160
+ setFootnoteReferences(['Citation']);
161
+ saveFootnotePopup();
85
162
 
86
- // Add block
87
- cy.getSlateEditorAndType('{enter}');
163
+ addFootnotesBlock();
164
+ cy.toolbarSave();
88
165
 
89
- cy.get('.ui.basic.icon.button.block-add-button').first().click();
90
- cy.get('.blocks-chooser .title').contains('Text').click();
91
- cy.get('.content.active.text .button.slateFootnotes')
92
- .contains('Footnotes')
93
- .click();
166
+ visitPageEdit();
94
167
 
95
- // Configure block
96
- cy.get('[id=sidebar-properties] [name=title]').click().type('Footnotes');
97
- cy.get('[id=sidebar-properties] label[for=field-global]').click();
168
+ cy.get('[id^="cite_ref-"]').should('exist');
169
+ cy.contains('Colorless green').should('exist');
170
+ cy.contains('Footnotes').should('exist');
171
+ cy.contains('Citation').should('exist');
98
172
 
99
- // Save
100
- cy.get('#toolbar-save').click();
101
- cy.url().should('eq', Cypress.config().baseUrl + '/cypress/my-page');
102
-
103
- // then the page view should contain our changes
104
- cy.get('span.citation-item').contains('Colorless green');
105
- cy.contains('Footnotes');
173
+ cy.toolbarSave();
106
174
  cy.contains('Citation');
107
- cy.contains('Yet another citation');
108
175
  });
109
176
  });
@@ -68,8 +68,7 @@ Cypress.Commands.add(
68
68
  id: contentId,
69
69
  title: contentTitle,
70
70
  image: {
71
- data:
72
- 'iVBORw0KGgoAAAANSUhEUgAAANcAAAA4CAMAAABZsZ3QAAAAM1BMVEX29fK42OU+oMvn7u9drtIPisHI4OhstdWZyt4fkcXX5+sAg74umMhNp86p0eJ7vNiKw9v/UV4wAAAAAXRSTlMAQObYZgAABBxJREFUeF7tmuty4yAMhZG4X2zn/Z92J5tsBJwWXG/i3XR6frW2Y/SBLIRAfaQUDNt8E5tLUt9BycfcKfq3R6Mlfyimtx4rzp+K3dtibXkor99zsEqLYZltblTecciogoh+TXfY1Ve4dn07rCDGG9dHSEEOg/GmXl0U1XDxTKxNK5De7BxsyyBr6gGm2/vPxKJ8F6f7BXKfRMp1xIWK9A+5ks25alSb353dWnDJN1k35EL5f8dVGifTf/4tjUuuFq7u4srmXC60yAmldLXIWbg65RKU87lcGxJCFqUPv0IacW0PmSivOZFLE908inPToMmii/roG+MRV/O8FU88i8tFsxV3a06MFUw0Qu7RmAtdV5/HVVaOVMTWNOWSwMljLhzhcB6XIS7OK5V6AvRDNN7t5VJWQs1J40UmalbK56usBG/CuCHSYuc+rkUGeMCViNRARPrzW52N3oQLe6WifNliSuuGaH3czbVNudI9s7ZLUCLHVwWlyES522o1t14uvmbblmVTKqFjaZYJFSTPP4dLL1kU1z7p0lzdbRulmEWLxoQX+z9ce7A8GqEEucllLxePuZwdJl1Lezu0hoswvTPt61DrFcRuujV/2cmlxaGBC7Aw6cpovGANwRiSdOAWJ5AGy4gLL64dl0QhUEAuEUNws+XxV+OKGPdw/hESGYF9XEGaFC7sNLMSXWJjHsnanYi87VK428N2uxpOjOFANcagLM5l+7mSycM8KknZpKLcGi6jmzWGr/vLurZ/0g4u9AZuAoeb5r1ceQhyiTPY1E4wUR6u/F3H2ojSpXMMriBPT9cezTto8Cx+MsglHL4fv1Rxrb1LVw9yvyQpJ3AhFnLZfuRLH2QsOG3FGGD20X/th/u5bFAt16Bt308KjF+MNOXgl/SquIEySX3GhaZvc67KZbDxcCDORz2N8yCWPaY5lyQZO7lQ29fnZbt3Xu6qoge4+DjXl/MocySPOp9rlvdyznahRyHEYd77v3LhugOXDv4J65QXfl803BDAdaWBEDhfVx7nKofjoVCgxnUAqw/UAUDPn788BDvQuG4TDtdtUPvzjSlXAB8DvaDOhhrmhwbywylXAm8CvaouikJTL93gs3y7Yy4VYbIxOHrcMizPqWOjqO9l3Uz52kibQy4xxOgqhJvD+w5rvokOcAlGvNCfeqCv1ste1stzLm0f71Iq3ZfTrPfuE5nhPtF+LvQE2lffQC7pYtQy3tdzdrKvd5TLVVzDetScS3nEKmmwDyt1Cev1kX3YfbvzNK4fzrlw+cB6vm+uiUgf2zdXI62241LawCb7Pi5FXFPF8KpzDoF/Sw2lg+GrHNbno1mhPu+VCF/vfMnw06PnUl6j48dVHD3jHNHPua+fc3o/5yp/zsGi0vYtzi3Pz5mHd4T6BWMIlewacd63AAAAAElFTkSuQmCC',
71
+ data: 'iVBORw0KGgoAAAANSUhEUgAAANcAAAA4CAMAAABZsZ3QAAAAM1BMVEX29fK42OU+oMvn7u9drtIPisHI4OhstdWZyt4fkcXX5+sAg74umMhNp86p0eJ7vNiKw9v/UV4wAAAAAXRSTlMAQObYZgAABBxJREFUeF7tmuty4yAMhZG4X2zn/Z92J5tsBJwWXG/i3XR6frW2Y/SBLIRAfaQUDNt8E5tLUt9BycfcKfq3R6Mlfyimtx4rzp+K3dtibXkor99zsEqLYZltblTecciogoh+TXfY1Ve4dn07rCDGG9dHSEEOg/GmXl0U1XDxTKxNK5De7BxsyyBr6gGm2/vPxKJ8F6f7BXKfRMp1xIWK9A+5ks25alSb353dWnDJN1k35EL5f8dVGifTf/4tjUuuFq7u4srmXC60yAmldLXIWbg65RKU87lcGxJCFqUPv0IacW0PmSivOZFLE908inPToMmii/roG+MRV/O8FU88i8tFsxV3a06MFUw0Qu7RmAtdV5/HVVaOVMTWNOWSwMljLhzhcB6XIS7OK5V6AvRDNN7t5VJWQs1J40UmalbK56usBG/CuCHSYuc+rkUGeMCViNRARPrzW52N3oQLe6WifNliSuuGaH3czbVNudI9s7ZLUCLHVwWlyES522o1t14uvmbblmVTKqFjaZYJFSTPP4dLL1kU1z7p0lzdbRulmEWLxoQX+z9ce7A8GqEEucllLxePuZwdJl1Lezu0hoswvTPt61DrFcRuujV/2cmlxaGBC7Aw6cpovGANwRiSdOAWJ5AGy4gLL64dl0QhUEAuEUNws+XxV+OKGPdw/hESGYF9XEGaFC7sNLMSXWJjHsnanYi87VK428N2uxpOjOFANcagLM5l+7mSycM8KknZpKLcGi6jmzWGr/vLurZ/0g4u9AZuAoeb5r1ceQhyiTPY1E4wUR6u/F3H2ojSpXMMriBPT9cezTto8Cx+MsglHL4fv1Rxrb1LVw9yvyQpJ3AhFnLZfuRLH2QsOG3FGGD20X/th/u5bFAt16Bt308KjF+MNOXgl/SquIEySX3GhaZvc67KZbDxcCDORz2N8yCWPaY5lyQZO7lQ29fnZbt3Xu6qoge4+DjXl/MocySPOp9rlvdyznahRyHEYd77v3LhugOXDv4J65QXfl803BDAdaWBEDhfVx7nKofjoVCgxnUAqw/UAUDPn788BDvQuG4TDtdtUPvzjSlXAB8DvaDOhhrmhwbywylXAm8CvaouikJTL93gs3y7Yy4VYbIxOHrcMizPqWOjqO9l3Uz52kibQy4xxOgqhJvD+w5rvokOcAlGvNCfeqCv1ste1stzLm0f71Iq3ZfTrPfuE5nhPtF+LvQE2lffQC7pYtQy3tdzdrKvd5TLVVzDetScS3nEKmmwDyt1Cev1kX3YfbvzNK4fzrlw+cB6vm+uiUgf2zdXI62241LawCb7Pi5FXFPF8KpzDoF/Sw2lg+GrHNbno1mhPu+VCF/vfMnw06PnUl6j48dVHD3jHNHPua+fc3o/5yp/zsGi0vYtzi3Pz5mHd4T6BWMIlewacd63AAAAAElFTkSuQmCC',
73
72
  encoding: 'base64',
74
73
  filename: 'image.png',
75
74
  'content-type': 'image/png',
@@ -319,6 +318,8 @@ Cypress.Commands.add(
319
318
  // --- waitForResourceToLoad ----------------------------------------------------------
320
319
  Cypress.Commands.add('waitForResourceToLoad', (fileName, type) => {
321
320
  const resourceCheckInterval = 40;
321
+ const maxChecks = 50;
322
+ const count = [0];
322
323
 
323
324
  return new Cypress.Promise((resolve) => {
324
325
  const checkIfResourceHasBeenLoaded = () => {
@@ -334,7 +335,18 @@ Cypress.Commands.add('waitForResourceToLoad', (fileName, type) => {
334
335
  return;
335
336
  }
336
337
 
337
- setTimeout(checkIfResourceHasBeenLoaded, resourceCheckInterval);
338
+ count[0] += 1;
339
+ const tid = setTimeout(
340
+ checkIfResourceHasBeenLoaded,
341
+ resourceCheckInterval,
342
+ );
343
+
344
+ if (count[0] > maxChecks) {
345
+ clearTimeout(tid);
346
+ throw new Error(
347
+ `Timeout resolving resource: ${fileName} (type ${type})`,
348
+ );
349
+ }
338
350
  };
339
351
 
340
352
  checkIfResourceHasBeenLoaded();
@@ -378,6 +390,7 @@ Cypress.Commands.add(
378
390
 
379
391
  Cypress.Commands.add('getSlateEditorAndType', (type) => {
380
392
  cy.get('.content-area .slate-editor [contenteditable=true]')
393
+ .last()
381
394
  .focus()
382
395
  .click()
383
396
  .wait(1000)
@@ -408,12 +421,7 @@ Cypress.Commands.add('toolbarSave', () => {
408
421
  cy.wait(1000);
409
422
 
410
423
  // Save
411
- cy.get('#toolbar-save').click();
412
- cy.waitForResourceToLoad('@navigation');
413
- cy.waitForResourceToLoad('@breadcrumbs');
414
- cy.waitForResourceToLoad('@actions');
415
- cy.waitForResourceToLoad('@types');
416
- cy.waitForResourceToLoad('my-page');
424
+ cy.get('#toolbar-save', { timeout: 10000 }).click();
417
425
  cy.url().should('eq', Cypress.config().baseUrl + '/cypress/my-page');
418
426
  });
419
427
 
@@ -37,6 +37,7 @@ export const slateBeforeEach = (contentType = 'Document') => {
37
37
  cy.visit('/cypress/my-page');
38
38
  cy.waitForResourceToLoad('my-page');
39
39
  cy.navigate('/cypress/my-page/edit');
40
+ cy.get('.block.title h1').should('exist');
40
41
  };
41
42
 
42
43
  export const slateAfterEach = () => {
@@ -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,24 @@
1
1
  require('dotenv').config({ path: __dirname + '/.env' })
2
2
 
3
+ const fs = require('fs')
4
+ const path = require('path')
5
+
6
+ // Volto 18 exposes @plone/volto-slate as a top-level package.
7
+ const voltoSlatePath = fs.existsSync(
8
+ path.join(
9
+ __dirname,
10
+ '..',
11
+ '..',
12
+ '..',
13
+ 'node_modules',
14
+ '@plone',
15
+ 'volto-slate',
16
+ 'src',
17
+ ),
18
+ )
19
+ ? '<rootDir>/node_modules/@plone/volto-slate/src'
20
+ : '<rootDir>/node_modules/@plone/volto/packages/volto-slate/src'
21
+
3
22
  module.exports = {
4
23
  testMatch: ['**/src/addons/**/?(*.)+(spec|test).[jt]s?(x)'],
5
24
  collectCoverageFrom: [
@@ -17,10 +36,8 @@ module.exports = {
17
36
  '@eeacms/search/(.*)$': '<rootDir>/src/addons/volto-searchlib/searchlib/$1',
18
37
  '@eeacms/search': '<rootDir>/src/addons/volto-searchlib/searchlib',
19
38
  '@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',
39
+ '@plone/volto-slate$': voltoSlatePath,
40
+ '@plone/volto-slate/(.*)$': `${voltoSlatePath}/$1`,
24
41
  '~/(.*)$': '<rootDir>/src/$1',
25
42
  'load-volto-addons':
26
43
  '<rootDir>/node_modules/@plone/volto/jest-addons-loader.js',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-slate-footnote",
3
- "version": "7.2.6",
3
+ "version": "8.0.0",
4
4
  "description": "volto-slate-footnote: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -31,7 +31,7 @@ const FootnoteEditor = (props) => {
31
31
 
32
32
  if (!active) {
33
33
  /* eslint no-console: 0 */
34
- console.error('Active element not found, this will crash');
34
+ console.error('Active element not found, this will crash'); // NOSONAR
35
35
  }
36
36
  const [elementNode] = active;
37
37
  const isElement = isActiveElement(editor);
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { render, screen, fireEvent } from '@testing-library/react';
3
3
  import SearchWidget from './SearchWidget';
4
- import '@testing-library/jest-dom/extend-expect';
4
+ import '@testing-library/jest-dom';
5
5
 
6
6
  jest.mock('semantic-ui-react', () => {
7
7
  const Card = ({ children }) => <div>{children}</div>;
@@ -6,7 +6,7 @@ export const withFootnote = (editor) => {
6
6
  const { normalizeNode, isInline } = editor;
7
7
 
8
8
  editor.isInline = (element) => {
9
- return element && element.type === FOOTNOTE ? true : isInline(element);
9
+ return (element && element.type === FOOTNOTE) || isInline(element);
10
10
  };
11
11
 
12
12
  editor.normalizeNode = (entry) => {