@eeacms/volto-group-block 10.0.0 → 10.0.1
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 +6 -6
- package/CHANGELOG.md +49 -1
- package/package.json +1 -1
- package/src/components/manage/Blocks/Group/CounterComponent.jsx +5 -5
- package/src/components/manage/Blocks/Group/DefaultBody.jsx +2 -1
- package/src/components/manage/Blocks/Group/DefaultBody.test.jsx +8 -5
- package/src/components/manage/Blocks/Group/Edit.jsx +7 -8
- package/src/components/manage/Blocks/Group/Edit.test.jsx +27 -10
- package/src/components/manage/Blocks/Group/View.jsx +1 -1
- package/src/components/manage/Blocks/Group/View.test.jsx +17 -10
- package/src/index.js +1 -1
package/.eslintrc.js
CHANGED
|
@@ -7,7 +7,7 @@ const voltoSlatePath = fs.existsSync(
|
|
|
7
7
|
path.join(projectRootPath, 'node_modules/@plone/volto-slate/src'),
|
|
8
8
|
)
|
|
9
9
|
? '@plone/volto-slate/src'
|
|
10
|
-
: '@plone/volto
|
|
10
|
+
: '@plone/volto-slate/src';
|
|
11
11
|
let configFile;
|
|
12
12
|
if (fs.existsSync(`${projectRootPath}/tsconfig.json`))
|
|
13
13
|
configFile = `${projectRootPath}/tsconfig.json`;
|
|
@@ -21,16 +21,16 @@ if (configFile) {
|
|
|
21
21
|
voltoPath = `./${jsConfig.baseUrl}/${pathsConfig['@plone/volto'][0]}`;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
const
|
|
25
|
-
const
|
|
24
|
+
const { AddonRegistry } = require('@plone/registry/addon-registry');
|
|
25
|
+
const { registry } = AddonRegistry.init(projectRootPath);
|
|
26
26
|
|
|
27
27
|
// Extends ESlint configuration for adding the aliases to `src` directories in Volto addons
|
|
28
|
-
const addonAliases = Object.keys(
|
|
28
|
+
const addonAliases = Object.keys(registry.packages).map((o) => [
|
|
29
29
|
o,
|
|
30
|
-
|
|
30
|
+
registry.packages[o].modulePath,
|
|
31
31
|
]);
|
|
32
32
|
|
|
33
|
-
const addonExtenders =
|
|
33
|
+
const addonExtenders = registry.getEslintExtenders().map((m) => require(m));
|
|
34
34
|
|
|
35
35
|
const defaultConfig = {
|
|
36
36
|
extends: `${voltoPath}/.eslintrc`,
|
package/CHANGELOG.md
CHANGED
|
@@ -4,7 +4,13 @@ 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
|
-
### [10.0.
|
|
7
|
+
### [10.0.1](https://github.com/eea/volto-group-block/compare/10.0.0...10.0.1) - 8 April 2026
|
|
8
|
+
|
|
9
|
+
#### :bug: Bug Fixes
|
|
10
|
+
|
|
11
|
+
- fix: make test [Alin V. (Claudiu) - [`1af7fd8`](https://github.com/eea/volto-group-block/commit/1af7fd894df993e7651f009a599040f763354630)]
|
|
12
|
+
|
|
13
|
+
## [10.0.0](https://github.com/eea/volto-group-block/compare/9.0.0...10.0.0) - 27 March 2026
|
|
8
14
|
|
|
9
15
|
#### :rocket: New Features
|
|
10
16
|
|
|
@@ -12,6 +18,8 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
12
18
|
|
|
13
19
|
#### :house: Internal changes
|
|
14
20
|
|
|
21
|
+
- chore: [JENKINSFILE] add package version in sonarqube [valentinab25 - [`d21ab95`](https://github.com/eea/volto-group-block/commit/d21ab953c0e5b6e265419de4e2ce5bcdc31e04b6)]
|
|
22
|
+
- chore: [JENKINSFILE] use sonarqube branches [EEA Jenkins - [`0b919c4`](https://github.com/eea/volto-group-block/commit/0b919c40b87d52d416e14fda7a2ee816dc74c3d9)]
|
|
15
23
|
|
|
16
24
|
#### :hammer_and_wrench: Others
|
|
17
25
|
|
|
@@ -41,9 +49,16 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
41
49
|
|
|
42
50
|
#### :house: Internal changes
|
|
43
51
|
|
|
52
|
+
- chore: [JENKINS] fix sonarqube tags [valentinab25 - [`6dbeeb3`](https://github.com/eea/volto-group-block/commit/6dbeeb3b42ee1e69692dcb466bbff921a54ddabb)]
|
|
44
53
|
|
|
45
54
|
#### :hammer_and_wrench: Others
|
|
46
55
|
|
|
56
|
+
- Add Sonarqube tag using clms-frontend addons list [EEA Jenkins - [`8e153d3`](https://github.com/eea/volto-group-block/commit/8e153d34ef330adeb5b1ef7d96b2ff433ecec5ff)]
|
|
57
|
+
- Add Sonarqube tag using clms-frontend addons list [EEA Jenkins - [`405738f`](https://github.com/eea/volto-group-block/commit/405738f8f13a236ad89f5f9870316322b1522518)]
|
|
58
|
+
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`84d6509`](https://github.com/eea/volto-group-block/commit/84d6509edf1b0821bd8709cf603f1025f99d18ff)]
|
|
59
|
+
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`ffb8602`](https://github.com/eea/volto-group-block/commit/ffb860257444d9ca05412111081a1320def9ee78)]
|
|
60
|
+
- Add Sonarqube tag using clms-frontend addons list [EEA Jenkins - [`4bd723a`](https://github.com/eea/volto-group-block/commit/4bd723a108b4c9d6e78cc7c1ceec58573c57abf2)]
|
|
61
|
+
- Add Sonarqube tag using ied-frontend addons list [EEA Jenkins - [`4f803d3`](https://github.com/eea/volto-group-block/commit/4f803d38efffcdc87f0dc0173b4142d9398bd2db)]
|
|
47
62
|
### [7.1.1](https://github.com/eea/volto-group-block/compare/7.1.0...7.1.1) - 30 January 2025
|
|
48
63
|
|
|
49
64
|
#### :house: Internal changes
|
|
@@ -71,6 +86,9 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
71
86
|
|
|
72
87
|
#### :hammer_and_wrench: Others
|
|
73
88
|
|
|
89
|
+
- Add Sonarqube tag using insitu-frontend addons list [EEA Jenkins - [`e727ac6`](https://github.com/eea/volto-group-block/commit/e727ac6a8c1882b4e77a08fd0c5bb0a401cd3bdb)]
|
|
90
|
+
- Add Sonarqube tag using clms-frontend addons list [EEA Jenkins - [`75c2946`](https://github.com/eea/volto-group-block/commit/75c29460dc6c42bbb799c13a5a6ef2bb8f26ed5a)]
|
|
91
|
+
- Add Sonarqube tag using insitu-frontend addons list [EEA Jenkins - [`96f3133`](https://github.com/eea/volto-group-block/commit/96f31335cdda925daf3e5824f0a23121b0c9b3ef)]
|
|
74
92
|
### [6.4.0](https://github.com/eea/volto-group-block/compare/6.3.5...6.4.0) - 17 January 2024
|
|
75
93
|
|
|
76
94
|
#### :rocket: New Features
|
|
@@ -85,6 +103,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
85
103
|
|
|
86
104
|
#### :house: Internal changes
|
|
87
105
|
|
|
106
|
+
- chore: [JENKINS] Refactor automated testing [valentinab25 - [`616f6eb`](https://github.com/eea/volto-group-block/commit/616f6ebe0385d82a827c6679eabdcf4e92a18c11)]
|
|
88
107
|
|
|
89
108
|
#### :hammer_and_wrench: Others
|
|
90
109
|
|
|
@@ -97,6 +116,11 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
97
116
|
- Prettier [kreafox - [`0c5d2d1`](https://github.com/eea/volto-group-block/commit/0c5d2d1a494489663cc97c5dc0f4ad13c4b67c8d)]
|
|
98
117
|
- test: mock useLocation [kreafox - [`746887f`](https://github.com/eea/volto-group-block/commit/746887fa0e778f2d4cbe86661fc8c38c8a4bafb5)]
|
|
99
118
|
- test: mock useLocation [kreafox - [`a360401`](https://github.com/eea/volto-group-block/commit/a360401b8ee05e9cb54b253b0e605d0a040c8f78)]
|
|
119
|
+
- test: [JENKINS] Use java17 for sonarqube scanner [valentinab25 - [`25030fb`](https://github.com/eea/volto-group-block/commit/25030fbd69108f90df02130e5010e56398941ad2)]
|
|
120
|
+
- test: [JENKINS] Run cypress in started frontend container [valentinab25 - [`1517dbb`](https://github.com/eea/volto-group-block/commit/1517dbb81cf9128752d835ae59dc22b251f4b035)]
|
|
121
|
+
- test: [JENKINS] Add cpu limit on cypress docker [valentinab25 - [`b0ba5f9`](https://github.com/eea/volto-group-block/commit/b0ba5f9c6d37526411a7a984595ac624401f8ac5)]
|
|
122
|
+
- test: [JENKINS] Increase shm-size to cypress docker [valentinab25 - [`8dbdfeb`](https://github.com/eea/volto-group-block/commit/8dbdfeb89fe53c6dc2f476b183a53c9266ab2bdf)]
|
|
123
|
+
- test: [JENKINS] Improve cypress time [valentinab25 - [`d0324f4`](https://github.com/eea/volto-group-block/commit/d0324f4aad6d94233ca8ce3645ca5162f39d9834)]
|
|
100
124
|
### [6.3.4](https://github.com/eea/volto-group-block/compare/6.3.3...6.3.4) - 22 October 2023
|
|
101
125
|
|
|
102
126
|
### [6.3.3](https://github.com/eea/volto-group-block/compare/6.3.2...6.3.3) - 17 October 2023
|
|
@@ -144,6 +168,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
144
168
|
|
|
145
169
|
- Release #39 from eea/develop [ichim-david - [`283e1e8`](https://github.com/eea/volto-group-block/commit/283e1e8dd1047415bae054cfd502d1691deaeb59)]
|
|
146
170
|
- Release 6.3.0 [Alin Voinea - [`3d74bb5`](https://github.com/eea/volto-group-block/commit/3d74bb5342e3882e0ddee1aa8edab7e90949def6)]
|
|
171
|
+
- test: Fix eslint and yarn i18n [Alin Voinea - [`763f764`](https://github.com/eea/volto-group-block/commit/763f76448625e05b53a2bde86ca48dda0cb263cb)]
|
|
147
172
|
- i18n: Add en [Alin Voinea - [`f3385cd`](https://github.com/eea/volto-group-block/commit/f3385cd33bfbe3efe514fd82fd140d17e33051e1)]
|
|
148
173
|
- test: Update Makefile and docker-compose to align it with Jenkinsfile [valentinab25 - [`3aa996b`](https://github.com/eea/volto-group-block/commit/3aa996b4c115da6f37ca771f07f10d58fbfa33e8)]
|
|
149
174
|
- fix eslint warnings [nileshgulia1 - [`cfdf2e9`](https://github.com/eea/volto-group-block/commit/cfdf2e900bcc456fa5a24ce7b03859170ad024ba)]
|
|
@@ -174,6 +199,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
174
199
|
|
|
175
200
|
#### :house: Internal changes
|
|
176
201
|
|
|
202
|
+
- chore: [JENKINS] Deprecate circularity website [valentinab25 - [`ad30e83`](https://github.com/eea/volto-group-block/commit/ad30e832bb869b67dc4e64ed99590b51cb80ab75)]
|
|
177
203
|
|
|
178
204
|
#### :hammer_and_wrench: Others
|
|
179
205
|
|
|
@@ -190,12 +216,19 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
190
216
|
|
|
191
217
|
#### :hammer_and_wrench: Others
|
|
192
218
|
|
|
219
|
+
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`37ffae5`](https://github.com/eea/volto-group-block/commit/37ffae512967b36af22cbed208a3ec9e1ddc392b)]
|
|
193
220
|
## [6.0.0](https://github.com/eea/volto-group-block/compare/5.0.1...6.0.0) - 24 March 2023
|
|
194
221
|
|
|
195
222
|
#### :hammer_and_wrench: Others
|
|
196
223
|
|
|
197
224
|
- (feat): Possibility to copy/cut/paste blocks within section group block - refs #157469 [dobri1408 - [`e9fc098`](https://github.com/eea/volto-group-block/commit/e9fc09825ba2ae258feb77864491d97d94c585b4)]
|
|
225
|
+
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`db4b09a`](https://github.com/eea/volto-group-block/commit/db4b09a6c14a8b271dec0c766886ffbcc3fe205e)]
|
|
226
|
+
- Add Sonarqube tag using advisory-board-frontend addons list [EEA Jenkins - [`b8c2bf4`](https://github.com/eea/volto-group-block/commit/b8c2bf471868bb0394b2dbbf75ccb7917a9ef0bf)]
|
|
227
|
+
- Add Sonarqube tag using advisory-board-frontend addons list [EEA Jenkins - [`b343119`](https://github.com/eea/volto-group-block/commit/b3431196931fd568476fa8bf6fbc508e086229ae)]
|
|
198
228
|
- test(Jenkins): Run tests and cypress with latest canary @plone/volto [Alin Voinea - [`2f42e7c`](https://github.com/eea/volto-group-block/commit/2f42e7c19a1da5a9c6a883cb4f101e8fa224ff94)]
|
|
229
|
+
- Add Sonarqube tag using cca-frontend addons list [EEA Jenkins - [`73afcc2`](https://github.com/eea/volto-group-block/commit/73afcc2f417797cedaa78cceefb007001d6c2406)]
|
|
230
|
+
- yarn 3 [Alin Voinea - [`3c00ccc`](https://github.com/eea/volto-group-block/commit/3c00ccc7110bbf12a4d268182313418fb46b1a5d)]
|
|
231
|
+
- Add Sonarqube tag using demo-kitkat-frontend addons list [EEA Jenkins - [`9b9662b`](https://github.com/eea/volto-group-block/commit/9b9662bda1da70ba0c3a7b4b05cebf130ed89e9e)]
|
|
199
232
|
### [5.0.1](https://github.com/eea/volto-group-block/compare/5.0.0...5.0.1) - 16 November 2022
|
|
200
233
|
|
|
201
234
|
#### :nail_care: Enhancements
|
|
@@ -212,6 +245,8 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
212
245
|
|
|
213
246
|
- Prepare 5.0.0 release [Miu Razvan - [`88c0ddd`](https://github.com/eea/volto-group-block/commit/88c0ddd569aeda7ee34d1eadea6a087f4e7dc257)]
|
|
214
247
|
- Update dependencies [Alin Voinea - [`c8405af`](https://github.com/eea/volto-group-block/commit/c8405afb830cdf62e7877bf30b619933519e1d71)]
|
|
248
|
+
- Add Sonarqube tag using marine-frontend addons list [EEA Jenkins - [`18e26c6`](https://github.com/eea/volto-group-block/commit/18e26c6939706d572ab8574e9b1826b9abc76314)]
|
|
249
|
+
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`8ed6d21`](https://github.com/eea/volto-group-block/commit/8ed6d21d8489911cc4cb471e3f8823c35f4adc50)]
|
|
215
250
|
### [4.3.8](https://github.com/eea/volto-group-block/compare/4.3.7...4.3.8) - 26 August 2022
|
|
216
251
|
|
|
217
252
|
### [4.3.7](https://github.com/eea/volto-group-block/compare/4.3.6...4.3.7) - 22 August 2022
|
|
@@ -224,6 +259,9 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
224
259
|
|
|
225
260
|
#### :hammer_and_wrench: Others
|
|
226
261
|
|
|
262
|
+
- Add Sonarqube tag using circularity-frontend addons list [EEA Jenkins - [`4e73f8b`](https://github.com/eea/volto-group-block/commit/4e73f8be3c73559557efadc410cb56abc055d82d)]
|
|
263
|
+
- Add Sonarqube tag using clms-frontend addons list [EEA Jenkins - [`3040335`](https://github.com/eea/volto-group-block/commit/3040335002c63b50208c95918413bc958150e7a9)]
|
|
264
|
+
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`386f730`](https://github.com/eea/volto-group-block/commit/386f730ed65f73fe1468b9b77351c97fb70edcc5)]
|
|
227
265
|
### [4.3.5](https://github.com/eea/volto-group-block/compare/4.3.4...4.3.5) - 4 January 2022
|
|
228
266
|
|
|
229
267
|
### [4.3.4](https://github.com/eea/volto-group-block/compare/4.3.3...4.3.4) - 3 January 2022
|
|
@@ -232,15 +270,23 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
232
270
|
|
|
233
271
|
#### :hammer_and_wrench: Others
|
|
234
272
|
|
|
273
|
+
- Add Sonarqube tag using freshwater-frontend addons list [EEA Jenkins - [`3e62d79`](https://github.com/eea/volto-group-block/commit/3e62d79a7ed37d10d623bc845d43e1144f8080f7)]
|
|
235
274
|
### [4.3.2](https://github.com/eea/volto-group-block/compare/4.3.1...4.3.2) - 10 December 2021
|
|
236
275
|
|
|
237
276
|
#### :hammer_and_wrench: Others
|
|
238
277
|
|
|
239
278
|
- Refs #142010 - Optimize Volto-addons gitflow pipelines [valentinab25 - [`bc36cf5`](https://github.com/eea/volto-group-block/commit/bc36cf58c39e2b43c2fbf5189df6ddefc1260857)]
|
|
279
|
+
- Add Sonarqube tag using industry-frontend addons list [EEA Jenkins - [`8038e78`](https://github.com/eea/volto-group-block/commit/8038e783c1e8ddd71e21f72070fdfa8e7e098993)]
|
|
280
|
+
- Add Sonarqube tag using clms-frontend addons list [EEA Jenkins - [`daccdbc`](https://github.com/eea/volto-group-block/commit/daccdbc733e47be7d6536eb67f8f2eea038dc94b)]
|
|
240
281
|
### [4.3.1](https://github.com/eea/volto-group-block/compare/4.3.0...4.3.1) - 11 October 2021
|
|
241
282
|
|
|
242
283
|
#### :hammer_and_wrench: Others
|
|
243
284
|
|
|
285
|
+
- Add Sonarqube tag using bise-frontend addons list [EEA Jenkins - [`b0092e4`](https://github.com/eea/volto-group-block/commit/b0092e4f78a1a0184e22e32bb9806cd57417dfb2)]
|
|
286
|
+
- Add Sonarqube tag using sustainability-frontend addons list [EEA Jenkins - [`ff8889c`](https://github.com/eea/volto-group-block/commit/ff8889cb7b0761b1df43b201984ce40b14e1561b)]
|
|
287
|
+
- Add Sonarqube tag using climate-energy-frontend addons list [EEA Jenkins - [`0375c28`](https://github.com/eea/volto-group-block/commit/0375c28ed1ffe9186a4790b454795c0ca8039f72)]
|
|
288
|
+
- Add Sonarqube tag using ims-frontend addons list [EEA Jenkins - [`c392190`](https://github.com/eea/volto-group-block/commit/c392190f044f5d9397bd2fb8c3d6a357f84960d0)]
|
|
289
|
+
- Add Sonarqube tag using frontend addons list [EEA Jenkins - [`9694501`](https://github.com/eea/volto-group-block/commit/9694501141e6780eba89464d36406e3c93629fd8)]
|
|
244
290
|
### [4.3.0](https://github.com/eea/volto-group-block/compare/4.2.3...4.3.0) - 24 June 2021
|
|
245
291
|
|
|
246
292
|
#### :hammer_and_wrench: Others
|
|
@@ -356,6 +402,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
356
402
|
- Release 1.0.0 [Alin Voinea - [`b6ef873`](https://github.com/eea/volto-group-block/commit/b6ef873cb6f61e17db66fdd4de1d9d4902a66fc6)]
|
|
357
403
|
- Update package meta info [Alin Voinea - [`143b7d4`](https://github.com/eea/volto-group-block/commit/143b7d44438d7afa5e346a9d21a85352df4e925f)]
|
|
358
404
|
- Add Jenkinkins pipeline [Alin Voinea - [`866a4e1`](https://github.com/eea/volto-group-block/commit/866a4e14ea1eb8f5adb01222e576e5ab6dc73a70)]
|
|
405
|
+
- yarn prettier [Alin Voinea - [`e3fe0a3`](https://github.com/eea/volto-group-block/commit/e3fe0a36b89878769341b45198d6c9e2f2584d15)]
|
|
359
406
|
### [0.1.3](https://github.com/eea/volto-group-block/compare/0.1.2...0.1.3) - 9 November 2020
|
|
360
407
|
|
|
361
408
|
#### :hammer_and_wrench: Others
|
|
@@ -395,4 +442,5 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
395
442
|
- Render meta block [Alin Voinea - [`0d44560`](https://github.com/eea/volto-group-block/commit/0d4456011ca56454068a54c610250b02df4ccb3b)]
|
|
396
443
|
- Implement meta block allowedBlocks settings [Alin Voinea - [`f24feb1`](https://github.com/eea/volto-group-block/commit/f24feb1a1751f04841c21c7cd52a517fb02074ba)]
|
|
397
444
|
- Edit meta block [Alin Voinea - [`236d291`](https://github.com/eea/volto-group-block/commit/236d29156fa835a7aa54eecdb4f120de0d64b271)]
|
|
445
|
+
- yarn bootstrap [Alin Voinea - [`e009dfb`](https://github.com/eea/volto-group-block/commit/e009dfb6b9b74d101a6722f0982a5359fc522b6b)]
|
|
398
446
|
- Initial commit [Alin Voinea - [`6a7b0de`](https://github.com/eea/volto-group-block/commit/6a7b0deb8f873d1462fd6a9c61edfc1562b3aace)]
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import cx from 'classnames';
|
|
2
2
|
import isString from 'lodash/isString';
|
|
3
3
|
import isArray from 'lodash/isArray';
|
|
4
|
-
import
|
|
4
|
+
import Icon from '@plone/volto/components/theme/Icon/Icon';
|
|
5
5
|
import config from '@plone/volto/registry';
|
|
6
6
|
import { visitBlocks } from '@plone/volto/helpers/Blocks/Blocks';
|
|
7
7
|
import { serializeNodesToText } from '@plone/volto-slate/editor/render';
|
|
@@ -47,8 +47,8 @@ const countTextInEachBlock =
|
|
|
47
47
|
? isString(blockData?.plaintext)
|
|
48
48
|
? blockData?.plaintext
|
|
49
49
|
: isArray(blockData?.value) && blockData?.value !== null
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
? serializeNodesToText(blockData?.value)
|
|
51
|
+
: ''
|
|
52
52
|
: '';
|
|
53
53
|
|
|
54
54
|
groupCharCount.value += ignoreSpaces
|
|
@@ -97,8 +97,8 @@ const CounterComponent = ({ data, setSidebarTab, setSelectedBlock }) => {
|
|
|
97
97
|
charCount < Math.ceil(maxChars / 1.05)
|
|
98
98
|
? 'info'
|
|
99
99
|
: charCount <= overflowLimit
|
|
100
|
-
|
|
101
|
-
|
|
100
|
+
? 'warning'
|
|
101
|
+
: 'danger';
|
|
102
102
|
|
|
103
103
|
return (
|
|
104
104
|
<p
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import BlocksForm from '@plone/volto/components/manage/Blocks/Block/BlocksForm';
|
|
2
|
+
import RenderBlocks from '@plone/volto/components/theme/View/RenderBlocks';
|
|
2
3
|
import { countTextInBlocks } from './CounterComponent';
|
|
3
4
|
import { useLocation } from 'react-router-dom';
|
|
4
5
|
|
|
@@ -16,13 +16,16 @@ jest.mock('react-router-dom', () => ({
|
|
|
16
16
|
}),
|
|
17
17
|
}));
|
|
18
18
|
|
|
19
|
-
jest.mock('@plone/volto/components', () =>
|
|
20
|
-
|
|
19
|
+
jest.mock('@plone/volto/components/manage/Blocks/Block/BlocksForm', () => {
|
|
20
|
+
return jest.fn((props) => {
|
|
21
21
|
mockBlocksForm(props);
|
|
22
22
|
return <div className="blocks-form">RenderBlocks</div>;
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
jest.mock('@plone/volto/components/theme/View/RenderBlocks', () =>
|
|
27
|
+
jest.fn(() => <div>RenderBlocks</div>),
|
|
28
|
+
);
|
|
26
29
|
|
|
27
30
|
const mockStore = configureStore();
|
|
28
31
|
const store = mockStore({
|
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
import React, { useState, useCallback } from 'react';
|
|
2
2
|
import cx from 'classnames';
|
|
3
|
-
import
|
|
3
|
+
import isEmpty from 'lodash/isEmpty';
|
|
4
|
+
import without from 'lodash/without';
|
|
4
5
|
import {
|
|
5
6
|
emptyBlocksForm,
|
|
6
|
-
withBlockExtensions,
|
|
7
7
|
getBlocksLayoutFieldname,
|
|
8
|
-
} from '@plone/volto/helpers';
|
|
8
|
+
} from '@plone/volto/helpers/Blocks/Blocks';
|
|
9
|
+
import { withBlockExtensions } from '@plone/volto/helpers//Extensions';
|
|
9
10
|
import BodyComponent from './Body';
|
|
10
11
|
|
|
11
12
|
import config from '@plone/volto/registry';
|
|
12
|
-
import
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
BlocksToolbar,
|
|
16
|
-
} from '@plone/volto/components';
|
|
13
|
+
import SidebarPortal from '@plone/volto/components/manage/Sidebar/SidebarPortal';
|
|
14
|
+
import BlockDataForm from '@plone/volto/components/manage/Form/BlockDataForm';
|
|
15
|
+
import BlocksToolbar from '@plone/volto/components/manage/Form/BlocksToolbar';
|
|
17
16
|
import PropTypes from 'prop-types';
|
|
18
17
|
import { Segment } from 'semantic-ui-react';
|
|
19
18
|
import EditSchema from './EditSchema';
|
|
@@ -13,20 +13,37 @@ const store = mockStore({
|
|
|
13
13
|
messages: {},
|
|
14
14
|
},
|
|
15
15
|
});
|
|
16
|
+
const mockBlocksForm = jest.fn();
|
|
16
17
|
|
|
17
|
-
jest.mock('@plone/volto/components', () =>
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
jest.mock('@plone/volto/components/manage/Form/BlocksToolbar', () => {
|
|
19
|
+
return () => <div>BlocksToolbar</div>;
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
jest.mock('@plone/volto/components/manage/Form/BlockDataForm', () => {
|
|
23
|
+
return () => <div>BlockDataForm</div>;
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
jest.mock('@plone/volto/components/manage/Blocks/Block/BlocksForm', () => {
|
|
27
|
+
return jest.fn((props) => {
|
|
28
|
+
mockBlocksForm(props);
|
|
29
|
+
return <div className="blocks-form">RenderBlocks</div>;
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
jest.mock('@plone/volto/components/manage/Sidebar/SidebarPortal', () => () => (
|
|
34
|
+
<div>SidebarPortal</div>
|
|
35
|
+
));
|
|
36
|
+
|
|
37
|
+
jest.mock('@plone/volto/helpers/Blocks/Blocks', () => ({
|
|
38
|
+
emptyBlocksForm: jest.fn(() => ({
|
|
39
|
+
blocks: {},
|
|
40
|
+
blocks_layout: { items: [] },
|
|
41
|
+
})),
|
|
42
|
+
getBlocksLayoutFieldname: jest.fn(() => 'blocks_layout'),
|
|
24
43
|
}));
|
|
25
44
|
|
|
26
|
-
jest.mock('@plone/volto/helpers', () => ({
|
|
45
|
+
jest.mock('@plone/volto/helpers/Extensions', () => ({
|
|
27
46
|
withBlockExtensions: jest.fn((Component) => Component),
|
|
28
|
-
emptyBlocksForm: jest.fn(),
|
|
29
|
-
getBlocksLayoutFieldname: jest.fn(),
|
|
30
47
|
}));
|
|
31
48
|
|
|
32
49
|
jest.mock('react-router-dom', () => ({
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import View from './View';
|
|
3
3
|
import { render, screen } from '@testing-library/react';
|
|
4
|
-
import { RenderBlocks } from '@plone/volto/components';
|
|
5
4
|
import '@testing-library/jest-dom';
|
|
6
5
|
|
|
7
|
-
jest.
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
const mockGroupBlockDefaultBody = jest.fn(() => (
|
|
7
|
+
<div>GroupBlockDefaultBody</div>
|
|
8
|
+
));
|
|
9
|
+
|
|
10
|
+
jest.mock('@eeacms/volto-group-block/components', () => ({
|
|
11
|
+
GroupBlockDefaultBody: (props) => mockGroupBlockDefaultBody(props),
|
|
10
12
|
}));
|
|
11
13
|
|
|
12
|
-
jest.mock('@plone/volto/helpers', () => ({
|
|
14
|
+
jest.mock('@plone/volto/helpers/Extensions', () => ({
|
|
13
15
|
withBlockExtensions: jest.fn((Component) => Component),
|
|
14
16
|
}));
|
|
15
17
|
|
|
@@ -23,6 +25,10 @@ jest.mock('react-router-dom', () => ({
|
|
|
23
25
|
}));
|
|
24
26
|
|
|
25
27
|
describe('View', () => {
|
|
28
|
+
beforeEach(() => {
|
|
29
|
+
mockGroupBlockDefaultBody.mockClear();
|
|
30
|
+
});
|
|
31
|
+
|
|
26
32
|
it('should render without crashing', () => {
|
|
27
33
|
const props = {
|
|
28
34
|
data: {},
|
|
@@ -31,7 +37,7 @@ describe('View', () => {
|
|
|
31
37
|
variation: {},
|
|
32
38
|
};
|
|
33
39
|
render(<View {...props} />);
|
|
34
|
-
expect(screen.getByText('
|
|
40
|
+
expect(screen.getByText('GroupBlockDefaultBody')).toBeInTheDocument();
|
|
35
41
|
});
|
|
36
42
|
|
|
37
43
|
it('renders with default tag and without crashing', () => {
|
|
@@ -62,7 +68,7 @@ describe('View', () => {
|
|
|
62
68
|
expect(container.querySelector('#test-title')).toBeInTheDocument();
|
|
63
69
|
});
|
|
64
70
|
|
|
65
|
-
it('renders
|
|
71
|
+
it('renders GroupBlockDefaultBody with correct props', () => {
|
|
66
72
|
const props = {
|
|
67
73
|
data: {
|
|
68
74
|
as: 'section',
|
|
@@ -79,13 +85,14 @@ describe('View', () => {
|
|
|
79
85
|
},
|
|
80
86
|
};
|
|
81
87
|
render(<View {...props} />);
|
|
82
|
-
expect(
|
|
88
|
+
expect(mockGroupBlockDefaultBody).toHaveBeenCalled();
|
|
89
|
+
const bodyProps = mockGroupBlockDefaultBody.mock.calls.at(-1)[0];
|
|
90
|
+
expect(bodyProps).toEqual(
|
|
83
91
|
expect.objectContaining({
|
|
84
92
|
metadata: props.metadata,
|
|
85
|
-
|
|
93
|
+
data: props.data,
|
|
86
94
|
location: props.location,
|
|
87
95
|
}),
|
|
88
|
-
{},
|
|
89
96
|
);
|
|
90
97
|
});
|
|
91
98
|
});
|
package/src/index.js
CHANGED