@eeacms/volto-embed 9.1.1 → 10.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +65 -0
- package/CHANGELOG.md +7 -18
- package/jest-addon.config.js +13 -8
- package/package.json +2 -2
- package/src/Blocks/EmbedMaps/Edit.test.js +112 -41
- package/src/Blocks/EmbedMaps/View.test.js +107 -60
- package/src/Blocks/EmbedMaps/schema.js +3 -1
- package/src/Blocks/Maps/Edit.test.js +34 -23
- package/src/Blocks/Maps/View.test.js +20 -17
- package/src/EmbedMap/EmbedMap.test.js +63 -25
- package/src/PrivacyProtection/schema.js +2 -4
- package/src/PrivacyProtection/styles.less +1 -1
- package/src/Toolbar/Toolbar.test.js +36 -4
- package/src/Views/MapView.test.js +26 -6
- package/.project.eslintrc.js +0 -48
package/.eslintrc.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const projectRootPath = fs.realpathSync(__dirname + '/../../../');
|
|
4
|
+
|
|
5
|
+
let voltoPath = path.join(projectRootPath, 'node_modules/@plone/volto');
|
|
6
|
+
let configFile;
|
|
7
|
+
if (fs.existsSync(`${projectRootPath}/tsconfig.json`))
|
|
8
|
+
configFile = `${projectRootPath}/tsconfig.json`;
|
|
9
|
+
else if (fs.existsSync(`${projectRootPath}/jsconfig.json`))
|
|
10
|
+
configFile = `${projectRootPath}/jsconfig.json`;
|
|
11
|
+
|
|
12
|
+
if (configFile) {
|
|
13
|
+
const jsConfig = require(configFile).compilerOptions;
|
|
14
|
+
const pathsConfig = jsConfig.paths;
|
|
15
|
+
if (pathsConfig['@plone/volto'])
|
|
16
|
+
voltoPath = `./${jsConfig.baseUrl}/${pathsConfig['@plone/volto'][0]}`;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const AddonConfigurationRegistry = require(`${voltoPath}/addon-registry.js`);
|
|
20
|
+
const reg = new AddonConfigurationRegistry(projectRootPath);
|
|
21
|
+
|
|
22
|
+
// Extends ESlint configuration for adding the aliases to `src` directories in Volto addons
|
|
23
|
+
const addonAliases = Object.keys(reg.packages).map((o) => [
|
|
24
|
+
o,
|
|
25
|
+
reg.packages[o].modulePath,
|
|
26
|
+
]);
|
|
27
|
+
|
|
28
|
+
const addonExtenders = reg.getEslintExtenders().map((m) => require(m));
|
|
29
|
+
|
|
30
|
+
const defaultConfig = {
|
|
31
|
+
extends: `${voltoPath}/.eslintrc`,
|
|
32
|
+
settings: {
|
|
33
|
+
'import/resolver': {
|
|
34
|
+
alias: {
|
|
35
|
+
map: [
|
|
36
|
+
['@plone/volto', '@plone/volto/src'],
|
|
37
|
+
['@plone/volto-slate', '@plone/volto/packages/volto-slate/src'],
|
|
38
|
+
...addonAliases,
|
|
39
|
+
['@package', `${__dirname}/src`],
|
|
40
|
+
['@root', `${__dirname}/src`],
|
|
41
|
+
['~', `${__dirname}/src`],
|
|
42
|
+
],
|
|
43
|
+
extensions: ['.js', '.jsx', '.json'],
|
|
44
|
+
},
|
|
45
|
+
'babel-plugin-root-import': {
|
|
46
|
+
rootPathSuffix: 'src',
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
rules: {
|
|
51
|
+
'react/jsx-no-target-blank': [
|
|
52
|
+
'error',
|
|
53
|
+
{
|
|
54
|
+
allowReferrer: true,
|
|
55
|
+
},
|
|
56
|
+
],
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const config = addonExtenders.reduce(
|
|
61
|
+
(acc, extender) => extender.modify(acc),
|
|
62
|
+
defaultConfig,
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
module.exports = config;
|
package/CHANGELOG.md
CHANGED
|
@@ -4,11 +4,17 @@ 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.0](https://github.com/eea/volto-embed/compare/9.1.1...10.0.0) - 23 April 2024
|
|
8
|
+
|
|
9
|
+
#### :rocket: New Features
|
|
10
|
+
|
|
11
|
+
- feat: Release 10.0.0 - Volto 17 support [alin - [`bea6fba`](https://github.com/eea/volto-embed/commit/bea6fba260bf0551ac17f7c2e30ddd5717756733)]
|
|
12
|
+
- feat: Volto 17 support - refs #264527 [EEA Jenkins - [`fd4b412`](https://github.com/eea/volto-embed/commit/fd4b412405a32abfb680383c2769013974184371)]
|
|
13
|
+
|
|
7
14
|
### [9.1.1](https://github.com/eea/volto-embed/compare/9.1.0...9.1.1) - 6 February 2024
|
|
8
15
|
|
|
9
16
|
#### :hammer_and_wrench: Others
|
|
10
17
|
|
|
11
|
-
- make sure url is valid [Razvan - [`807f833`](https://github.com/eea/volto-embed/commit/807f833caf8fd5e040b874d043cba0818e5b836f)]
|
|
12
18
|
- fallbacks [Razvan - [`53441ff`](https://github.com/eea/volto-embed/commit/53441ffa005800032ceb7577d20b6f29c30905dd)]
|
|
13
19
|
### [9.1.0](https://github.com/eea/volto-embed/compare/9.0.7...9.1.0) - 17 January 2024
|
|
14
20
|
|
|
@@ -42,7 +48,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
42
48
|
|
|
43
49
|
- test: increase coverage [kreafox - [`2d8e43c`](https://github.com/eea/volto-embed/commit/2d8e43cf3988564306b6aa7b885b0ff398043ce0)]
|
|
44
50
|
- test: increase coverage [kreafox - [`1fa9052`](https://github.com/eea/volto-embed/commit/1fa9052a3c015361e3a7eae043c418b696262fbe)]
|
|
45
|
-
- test: [JENKINS] fail with logs on coverage [valentinab25 - [`eaabce8`](https://github.com/eea/volto-embed/commit/eaabce87f1ed4b88a25bfc59a75285e858413d6a)]
|
|
46
51
|
- test: increase cypress timeout [kreafox - [`9bb40a5`](https://github.com/eea/volto-embed/commit/9bb40a5df2b29a55edec24a57fcd6e65f270f13c)]
|
|
47
52
|
- test: updates [kreafox - [`5b54d02`](https://github.com/eea/volto-embed/commit/5b54d02c6b6392e25f07ef1e286bdbced999592e)]
|
|
48
53
|
- test: update snapshot [kreafox - [`338f23e`](https://github.com/eea/volto-embed/commit/338f23ee5c6c75ccb6ee2d8d474298553fe3bd53)]
|
|
@@ -99,13 +104,11 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
99
104
|
- update [Miu Razvan - [`926beb8`](https://github.com/eea/volto-embed/commit/926beb87d2c44907aebe57369312eea7bf22d656)]
|
|
100
105
|
- update [Miu Razvan - [`da351ae`](https://github.com/eea/volto-embed/commit/da351ae9ffaaef756f7a665618a03fd04cb9b01d)]
|
|
101
106
|
- use volto-datablocks@develop dependency [Miu Razvan - [`b379d84`](https://github.com/eea/volto-embed/commit/b379d8478657dd39dad066181b349cee7ac2531d)]
|
|
102
|
-
- test: [JENKINS] Use java17 for sonarqube scanner [valentinab25 - [`ddf685a`](https://github.com/eea/volto-embed/commit/ddf685a9481d780a1df2e4f991f93676478c3e05)]
|
|
103
107
|
## [8.0.0](https://github.com/eea/volto-embed/compare/7.0.2...8.0.0) - 17 November 2023
|
|
104
108
|
|
|
105
109
|
#### :hammer_and_wrench: Others
|
|
106
110
|
|
|
107
111
|
- tests: add cypress tests [nileshgulia1 - [`e4b2803`](https://github.com/eea/volto-embed/commit/e4b28033114170639787d77976dc13b7f697f704)]
|
|
108
|
-
- test: [JENKINS] Run cypress in started frontend container [valentinab25 - [`83d91d5`](https://github.com/eea/volto-embed/commit/83d91d5716a9ce8ebbbff01a7838711298684be4)]
|
|
109
112
|
- fix error [Claudia Ifrim - [`553f3af`](https://github.com/eea/volto-embed/commit/553f3af004af034c721dcd6b01de55c258a88c49)]
|
|
110
113
|
- bump version [Miu Razvan - [`363694a`](https://github.com/eea/volto-embed/commit/363694ae50cdec941fb53b396b75e9a4554d44fb)]
|
|
111
114
|
### [7.0.2](https://github.com/eea/volto-embed/compare/7.0.1...7.0.2) - 10 November 2023
|
|
@@ -115,7 +118,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
115
118
|
#### :hammer_and_wrench: Others
|
|
116
119
|
|
|
117
120
|
- add missing less variable [Miu Razvan - [`47683a7`](https://github.com/eea/volto-embed/commit/47683a7816581d117bb88f16e3087864aaa52f5e)]
|
|
118
|
-
- test: [JENKINS] Add cpu limit on cypress docker [valentinab25 - [`ba168e4`](https://github.com/eea/volto-embed/commit/ba168e49554a51a6015a98a77dc0ceab76320218)]
|
|
119
121
|
## [7.0.0](https://github.com/eea/volto-embed/compare/6.0.1...7.0.0) - 6 November 2023
|
|
120
122
|
|
|
121
123
|
#### :rocket: New Features
|
|
@@ -125,15 +127,12 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
125
127
|
#### :house: Internal changes
|
|
126
128
|
|
|
127
129
|
- style: Automated code fix [eea-jenkins - [`c34d6f4`](https://github.com/eea/volto-embed/commit/c34d6f47fd33f728d40254a12c05fe385b27f2e9)]
|
|
128
|
-
- chore: [JENKINS] Refactor automated testing [valentinab25 - [`673f3ff`](https://github.com/eea/volto-embed/commit/673f3ff355baa8d3646e4558ff2be00f36b5a45a)]
|
|
129
130
|
- chore: husky, lint-staged use fixed versions [valentinab25 - [`31169f7`](https://github.com/eea/volto-embed/commit/31169f73887837463daee76d63b6516046ad49aa)]
|
|
130
131
|
|
|
131
132
|
#### :hammer_and_wrench: Others
|
|
132
133
|
|
|
133
134
|
- update tests [Miu Razvan - [`c906b79`](https://github.com/eea/volto-embed/commit/c906b79149e853f718d924871ce2e633e5e427c8)]
|
|
134
135
|
- update tests [Miu Razvan - [`11625b6`](https://github.com/eea/volto-embed/commit/11625b65846388a846d1bdf7ebb2e1f8bd103c91)]
|
|
135
|
-
- test: [JENKINS] Increase shm-size to cypress docker [valentinab25 - [`5e7a155`](https://github.com/eea/volto-embed/commit/5e7a15505334c9b81f07172116b49eaefc692ebf)]
|
|
136
|
-
- test: [JENKINS] Improve cypress time [valentinab25 - [`eeb6dcb`](https://github.com/eea/volto-embed/commit/eeb6dcb4b0f8af07496450e6e7783932ebe88bf7)]
|
|
137
136
|
- Release 7.0.0 [Alin Voinea - [`cbc5c79`](https://github.com/eea/volto-embed/commit/cbc5c79f1b66daf0d599d9de5a1bc7d137bafed8)]
|
|
138
137
|
- add act in unit tests [Miu Razvan - [`ecf5b2f`](https://github.com/eea/volto-embed/commit/ecf5b2fe553d99ad6a11570d3d34852d557fbe85)]
|
|
139
138
|
- update [Miu Razvan - [`049cc14`](https://github.com/eea/volto-embed/commit/049cc140bb6ffea4eb3f1555e693e9973ef63d0e)]
|
|
@@ -156,7 +155,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
156
155
|
|
|
157
156
|
- test: EN locales, pre-commit fix, feature PRs checks Refs #257193 [valentinab25 - [`dc2de20`](https://github.com/eea/volto-embed/commit/dc2de2084b53043f240ee1efa2588b5037326ed7)]
|
|
158
157
|
- test: Fix package.json scripts to use makefile [Alin Voinea - [`b4ffca2`](https://github.com/eea/volto-embed/commit/b4ffca24bb8cc4ba2007cc1040cc7b55dc7cc779)]
|
|
159
|
-
- test: Fix eslint and yarn i18n [Alin Voinea - [`1563d0a`](https://github.com/eea/volto-embed/commit/1563d0ab1f54e775a16705bfd3d267303eb2a526)]
|
|
160
158
|
- i18n: Add en [Alin Voinea - [`b4e0694`](https://github.com/eea/volto-embed/commit/b4e0694ee40ecc195536fd1826adfab8876c5061)]
|
|
161
159
|
- test: Update Makefile and docker-compose to align it with Jenkinsfile [valentinab25 - [`8f228ca`](https://github.com/eea/volto-embed/commit/8f228ca0644cee0f777a01114895583f387a395c)]
|
|
162
160
|
- test: increase test coverage - refs #254313 [ana-oprea - [`30354d8`](https://github.com/eea/volto-embed/commit/30354d8a10a78e4fc322e37f4be20ff85cd00bbc)]
|
|
@@ -185,9 +183,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
185
183
|
|
|
186
184
|
- Add react-countup to resolutions [kreafox - [`36eb637`](https://github.com/eea/volto-embed/commit/36eb637c0cb9413b0b0e0ce53e621b2289929d65)]
|
|
187
185
|
- Move generic classes to privacy-protection [kreafox - [`715d559`](https://github.com/eea/volto-embed/commit/715d559e370bf7a3489b64d357b0a6cd7b1a3af2)]
|
|
188
|
-
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`5715b4d`](https://github.com/eea/volto-embed/commit/5715b4d3fcc14a34e031c383275c685d88f4db44)]
|
|
189
|
-
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`ef24ac0`](https://github.com/eea/volto-embed/commit/ef24ac05b17f4f4dbf05ceafbee677012a7f28f5)]
|
|
190
|
-
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`81f957b`](https://github.com/eea/volto-embed/commit/81f957b51aef7be59214530b774de8547bee3f5f)]
|
|
191
186
|
### [5.0.2](https://github.com/eea/volto-embed/compare/5.0.1...5.0.2) - 20 March 2023
|
|
192
187
|
|
|
193
188
|
#### :hammer_and_wrench: Others
|
|
@@ -202,7 +197,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
202
197
|
- update .project.eslintrc.js [Miu Razvan - [`628fd40`](https://github.com/eea/volto-embed/commit/628fd402b00d075ce319b9be92ff5f0e4d0ca2c4)]
|
|
203
198
|
- rename schema.jsx [Miu Razvan - [`62794e3`](https://github.com/eea/volto-embed/commit/62794e398eab5117132e5622cab735f6cf4f79fd)]
|
|
204
199
|
- improving code quality as per sonarqube reported issues [tedw87 - [`c7842f7`](https://github.com/eea/volto-embed/commit/c7842f7795f344e9d30538ddf2da04e97e319ebe)]
|
|
205
|
-
- Add Sonarqube tag using cca-frontend addons list [EEA Jenkins - [`fe3a2de`](https://github.com/eea/volto-embed/commit/fe3a2de6180796c3d6b569733d2b9365a669c23e)]
|
|
206
200
|
## [5.0.0](https://github.com/eea/volto-embed/compare/4.0.4...5.0.0) - 31 October 2022
|
|
207
201
|
|
|
208
202
|
#### :hammer_and_wrench: Others
|
|
@@ -222,8 +216,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
222
216
|
|
|
223
217
|
- use specific alpha for addon test [andreiggr - [`e6df633`](https://github.com/eea/volto-embed/commit/e6df633aa4d2b0ee7eeb6b5aafa21528f14cd1df)]
|
|
224
218
|
- add optional height to privacy container [andreiggr - [`e2ac711`](https://github.com/eea/volto-embed/commit/e2ac711db4e461b474cade42109346a73bb8ecbd)]
|
|
225
|
-
- Add Sonarqube tag using marine-frontend addons list [EEA Jenkins - [`9f3f358`](https://github.com/eea/volto-embed/commit/9f3f35882fb367d72c7916abe7cbf366dbd8d5b6)]
|
|
226
|
-
- Add Sonarqube tag using bise-frontend addons list [EEA Jenkins - [`7677140`](https://github.com/eea/volto-embed/commit/767714006abf7cbe336c5ab00d76c7232d5bc798)]
|
|
227
219
|
### [4.0.2](https://github.com/eea/volto-embed/compare/4.0.1...4.0.2) - 15 July 2022
|
|
228
220
|
|
|
229
221
|
#### :hammer_and_wrench: Others
|
|
@@ -263,7 +255,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
263
255
|
|
|
264
256
|
- Update package.json [Nilesh - [`0ec673a`](https://github.com/eea/volto-embed/commit/0ec673a8178731b8c1e010101caee2a3c9fafaca)]
|
|
265
257
|
- Update package.json [Nilesh - [`b8b94ec`](https://github.com/eea/volto-embed/commit/b8b94ec64672229f464b9108b4ac01a848827c00)]
|
|
266
|
-
- Add Sonarqube tag using freshwater-frontend addons list [EEA Jenkins - [`cfe04d8`](https://github.com/eea/volto-embed/commit/cfe04d885255bb8e472a3b268b98e3d7b9022437)]
|
|
267
258
|
- Refs #142010 - Optimize Volto-addons gitflow pipelines [valentinab25 - [`bf197dd`](https://github.com/eea/volto-embed/commit/bf197dd6516f9c18994add19b1141e061a96e2b6)]
|
|
268
259
|
- no hardcoded text [Daniela Mormocea - [`4001bb4`](https://github.com/eea/volto-embed/commit/4001bb414df05c1516f95e4dcec4a328406dc63f)]
|
|
269
260
|
- fix [Daniela Mormocea - [`a41ca9a`](https://github.com/eea/volto-embed/commit/a41ca9a2795a59f2633fb97938244e335dca8c43)]
|
|
@@ -337,8 +328,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
337
328
|
- revert use of custom bg image [nileshgulia1 - [`63a74b7`](https://github.com/eea/volto-embed/commit/63a74b7e671d85b602b0190c7a18e6d6ad71341b)]
|
|
338
329
|
- PrivacyProtection update & accept bg image [Andrei Grigore - [`f3f05d1`](https://github.com/eea/volto-embed/commit/f3f05d1d21fc88b90de3f68a995242b6c359e03a)]
|
|
339
330
|
- fix loading of cookies [nileshgulia1 - [`46348d8`](https://github.com/eea/volto-embed/commit/46348d8321b4633a3d5fdcbfb2c4f01912d7ed2a)]
|
|
340
|
-
- Add Sonarqube tag using frontend addons list [EEA Jenkins - [`a1e1f50`](https://github.com/eea/volto-embed/commit/a1e1f50db8a1ebc11261c3a24c39687c00ca7eea)]
|
|
341
|
-
- Add Sonarqube tag using frontend addons list [EEA Jenkins - [`1e1471e`](https://github.com/eea/volto-embed/commit/1e1471ebab5ba6e5bf0c231ddd0de94d8fe6c846)]
|
|
342
331
|
### [2.0.1](https://github.com/eea/volto-embed/compare/2.0.0...2.0.1) - 28 May 2021
|
|
343
332
|
|
|
344
333
|
#### :hammer_and_wrench: Others
|
package/jest-addon.config.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
require('dotenv').config({ path: __dirname + '/.env' })
|
|
1
|
+
require('dotenv').config({ path: __dirname + '/.env' })
|
|
2
2
|
|
|
3
3
|
module.exports = {
|
|
4
4
|
testMatch: ['**/src/addons/**/?(*.)+(spec|test).[jt]s?(x)'],
|
|
@@ -11,25 +11,30 @@ module.exports = {
|
|
|
11
11
|
'@plone/volto/cypress': '<rootDir>/node_modules/@plone/volto/cypress',
|
|
12
12
|
'@plone/volto/babel': '<rootDir>/node_modules/@plone/volto/babel',
|
|
13
13
|
'@plone/volto/(.*)$': '<rootDir>/node_modules/@plone/volto/src/$1',
|
|
14
|
-
'@package/(.*)$': '<rootDir>/src/$1',
|
|
15
|
-
'@root/(.*)$': '<rootDir>/src/$1',
|
|
14
|
+
'@package/(.*)$': '<rootDir>/node_modules/@plone/volto/src/$1',
|
|
15
|
+
'@root/(.*)$': '<rootDir>/node_modules/@plone/volto/src/$1',
|
|
16
16
|
'@plone/volto-quanta/(.*)$': '<rootDir>/src/addons/volto-quanta/src/$1',
|
|
17
|
+
'@eeacms/search/(.*)$': '<rootDir>/src/addons/volto-searchlib/searchlib/$1',
|
|
18
|
+
'@eeacms/search': '<rootDir>/src/addons/volto-searchlib/searchlib',
|
|
17
19
|
'@eeacms/(.*?)/(.*)$': '<rootDir>/node_modules/@eeacms/$1/src/$2',
|
|
18
|
-
'@plone/volto-slate':
|
|
20
|
+
'@plone/volto-slate$':
|
|
19
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',
|
|
20
24
|
'~/(.*)$': '<rootDir>/src/$1',
|
|
21
25
|
'load-volto-addons':
|
|
22
26
|
'<rootDir>/node_modules/@plone/volto/jest-addons-loader.js',
|
|
23
27
|
},
|
|
28
|
+
transformIgnorePatterns: [
|
|
29
|
+
'/node_modules/(?!(@plone|@root|@package|@eeacms)/).*/',
|
|
30
|
+
],
|
|
24
31
|
transform: {
|
|
25
32
|
'^.+\\.js(x)?$': 'babel-jest',
|
|
33
|
+
'^.+\\.ts(x)?$': 'babel-jest',
|
|
26
34
|
'^.+\\.(png)$': 'jest-file',
|
|
27
35
|
'^.+\\.(jpg)$': 'jest-file',
|
|
28
36
|
'^.+\\.(svg)$': './node_modules/@plone/volto/jest-svgsystem-transform.js',
|
|
29
37
|
},
|
|
30
|
-
transformIgnorePatterns: [
|
|
31
|
-
'node_modules/(?!@eeacms)/volto-datablocks/helpers',
|
|
32
|
-
],
|
|
33
38
|
coverageThreshold: {
|
|
34
39
|
global: {
|
|
35
40
|
branches: 5,
|
|
@@ -43,4 +48,4 @@ module.exports = {
|
|
|
43
48
|
'<rootDir>/node_modules/@eeacms/volto-embed/jest.setup.js',
|
|
44
49
|
],
|
|
45
50
|
}),
|
|
46
|
-
}
|
|
51
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eeacms/volto-embed",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "10.0.0",
|
|
4
4
|
"description": "Embed external content",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"author": "European Environment Agency: IDM2 A-Team",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"@plone/scripts": "*",
|
|
28
28
|
"babel-plugin-transform-class-properties": "^6.24.1",
|
|
29
29
|
"cypress-fail-fast": "^5.0.1",
|
|
30
|
-
"dotenv": "16.3.2",
|
|
30
|
+
"dotenv": "^16.3.2",
|
|
31
31
|
"husky": "^8.0.3",
|
|
32
32
|
"lint-staged": "^14.0.1",
|
|
33
33
|
"md5": "^2.3.0"
|
|
@@ -1,51 +1,122 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import { render, fireEvent } from '@testing-library/react';
|
|
3
3
|
import { Provider } from 'react-intl-redux';
|
|
4
4
|
import config from '@plone/volto/registry';
|
|
5
5
|
|
|
6
6
|
import Edit from './Edit';
|
|
7
7
|
import installEmbedMaps from '.';
|
|
8
|
+
import '@testing-library/jest-dom/extend-expect';
|
|
8
9
|
|
|
9
10
|
installEmbedMaps(config);
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
<
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
12
|
+
jest.mock('@plone/volto/components', () => ({
|
|
13
|
+
SidebarPortal: ({ children }) => (
|
|
14
|
+
<div data-testid="sidebar-portal">{children}</div>
|
|
15
|
+
),
|
|
16
|
+
UniversalLink: ({ children, href }) => <a href={href}>{children}</a>,
|
|
17
|
+
}));
|
|
18
|
+
|
|
19
|
+
jest.mock(
|
|
20
|
+
'@plone/volto/components/manage/Form/BlockDataForm',
|
|
21
|
+
() => (props) => (
|
|
22
|
+
<div data-testid="block-data-form">
|
|
23
|
+
<p>Mocked BlockDataForm</p>
|
|
24
|
+
<input data-testid="block-data-input" onChange={props.onChangeField} />
|
|
25
|
+
</div>
|
|
26
|
+
),
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
jest.mock('./View', () =>
|
|
30
|
+
jest.fn((props) => (
|
|
31
|
+
<div>
|
|
32
|
+
<div data-testid="view-component" mode={props.mode}>
|
|
33
|
+
Mocked View Component
|
|
34
|
+
</div>
|
|
35
|
+
{props.children}
|
|
36
|
+
</div>
|
|
37
|
+
)),
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
describe('Edit component', () => {
|
|
41
|
+
const mockOnChangeBlock = jest.fn();
|
|
42
|
+
const props = {
|
|
43
|
+
id: 'my-map',
|
|
44
|
+
data: {
|
|
45
|
+
'@type': 'embed_maps',
|
|
46
|
+
with_notes: false,
|
|
47
|
+
with_sources: false,
|
|
48
|
+
with_more_info: true,
|
|
49
|
+
with_share: true,
|
|
50
|
+
with_enlarge: true,
|
|
51
|
+
url: '/path/to/map',
|
|
52
|
+
maps: {
|
|
53
|
+
'@id': '/path/to/map',
|
|
54
|
+
title: 'My map',
|
|
55
|
+
url: 'https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3027.7835278268726!2d14.38842915203974!3d40.634655679238854!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x133b994881d943cb%3A0x6ab93db57d3272f0!2sHotel+Mediterraneo+Sorrento!5e0!3m2!1sen!2ses!4v1550168740166',
|
|
56
|
+
},
|
|
57
|
+
dataprotection: {
|
|
58
|
+
enabled: false,
|
|
59
|
+
},
|
|
60
|
+
useVisibilitySensor: false,
|
|
61
|
+
},
|
|
62
|
+
pathname: '/news',
|
|
63
|
+
selected: true,
|
|
64
|
+
block: '1234',
|
|
65
|
+
index: 1,
|
|
66
|
+
onChangeBlock: jest.fn(),
|
|
67
|
+
onSelectBlock: jest.fn(),
|
|
68
|
+
onDeleteBlock: jest.fn(),
|
|
69
|
+
onFocusPreviousBlock: jest.fn(),
|
|
70
|
+
onFocusNextBlock: jest.fn(),
|
|
71
|
+
handleKeyDown: jest.fn(),
|
|
72
|
+
content: {},
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
it('should render View component with mode set to edit', () => {
|
|
76
|
+
const { getByTestId } = render(
|
|
77
|
+
<Provider store={global.store}>
|
|
78
|
+
<Edit {...props} />
|
|
79
|
+
</Provider>,
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
const viewComponent = getByTestId('view-component');
|
|
83
|
+
expect(viewComponent).toBeInTheDocument();
|
|
84
|
+
expect(viewComponent).toHaveAttribute('mode', 'edit');
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
it('should render SidebarPortal when selected is true', () => {
|
|
88
|
+
const { getByTestId } = render(
|
|
89
|
+
<Provider store={global.store}>
|
|
90
|
+
<Edit {...props} />
|
|
91
|
+
</Provider>,
|
|
92
|
+
);
|
|
93
|
+
const sidebarPortal = getByTestId('sidebar-portal');
|
|
94
|
+
expect(sidebarPortal).toBeInTheDocument();
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
it('should render SidebarPortal and BlockDataForm', () => {
|
|
98
|
+
const { getByTestId } = render(
|
|
99
|
+
<Provider store={global.store}>
|
|
100
|
+
<Edit {...props} />
|
|
101
|
+
</Provider>,
|
|
102
|
+
);
|
|
103
|
+
|
|
104
|
+
const sidebarPortal = getByTestId('sidebar-portal');
|
|
105
|
+
const blockDataForm = getByTestId('block-data-form');
|
|
106
|
+
expect(sidebarPortal).toBeInTheDocument();
|
|
107
|
+
expect(blockDataForm).toBeInTheDocument();
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
it('should call onChangeBlock when onChangeField is triggered', () => {
|
|
111
|
+
const { getByTestId } = render(
|
|
112
|
+
<Provider store={global.store}>
|
|
113
|
+
<Edit {...props} onChangeBlock={mockOnChangeBlock} />
|
|
114
|
+
</Provider>,
|
|
115
|
+
);
|
|
116
|
+
|
|
117
|
+
const inputField = getByTestId('block-data-input');
|
|
118
|
+
fireEvent.change(inputField, { target: { value: 'new value' } });
|
|
119
|
+
|
|
120
|
+
expect(mockOnChangeBlock).toHaveBeenCalled();
|
|
121
|
+
});
|
|
51
122
|
});
|
|
@@ -1,71 +1,118 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import renderer from 'react-test-renderer';
|
|
3
2
|
import { Provider } from 'react-intl-redux';
|
|
4
3
|
import config from '@plone/volto/registry';
|
|
4
|
+
import { render, screen, fireEvent } from '@testing-library/react';
|
|
5
|
+
import '@testing-library/jest-dom/extend-expect';
|
|
5
6
|
|
|
6
7
|
import View from './View';
|
|
7
8
|
import installEmbedMaps from '.';
|
|
8
9
|
|
|
9
10
|
installEmbedMaps(config);
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
<
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
'https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3027.7835278268726!2d14.38842915203974!3d40.634655679238854!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x133b994881d943cb%3A0x6ab93db57d3272f0!2sHotel+Mediterraneo+Sorrento!5e0!3m2!1sen!2ses!4v1550168740166',
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
12
|
+
describe('EmbedMaps Block View', () => {
|
|
13
|
+
it('renders a view embed map block component', () => {
|
|
14
|
+
render(
|
|
15
|
+
<Provider store={global.store}>
|
|
16
|
+
<View
|
|
17
|
+
id="my-map"
|
|
18
|
+
data={{
|
|
19
|
+
'@type': 'embed_maps',
|
|
20
|
+
with_notes: false,
|
|
21
|
+
with_sources: false,
|
|
22
|
+
with_more_info: true,
|
|
23
|
+
with_share: true,
|
|
24
|
+
with_enlarge: true,
|
|
25
|
+
url: '/path/to/map',
|
|
26
|
+
maps: {
|
|
27
|
+
'@id': '/path/to/map',
|
|
28
|
+
title: 'My map',
|
|
29
|
+
url: 'https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3027.7835278268726!2d14.38842915203974!3d40.634655679238854!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x133b994881d943cb%3A0x6ab93db57d3272f0!2sHotel+Mediterraneo+Sorrento!5e0!3m2!1sen!2ses!4v1550168740166',
|
|
30
|
+
},
|
|
31
|
+
dataprotection: {
|
|
32
|
+
enabled: false,
|
|
33
|
+
},
|
|
34
|
+
useVisibilitySensor: false,
|
|
35
|
+
parameters: {
|
|
36
|
+
'@id': '647e4a0f-d4a0-4b8a-9965-0a016f017ebd',
|
|
37
|
+
field: 'zoomtocountry',
|
|
38
|
+
value: 'RO',
|
|
39
|
+
},
|
|
40
|
+
height: '800',
|
|
41
|
+
}}
|
|
42
|
+
data_query={[
|
|
43
|
+
{
|
|
44
|
+
i: 'Country',
|
|
45
|
+
o: 'plone.app.querystring.operation.selection.is',
|
|
46
|
+
v: ['RO'],
|
|
47
|
+
},
|
|
48
|
+
]}
|
|
49
|
+
/>
|
|
50
|
+
</Provider>,
|
|
51
|
+
);
|
|
52
|
+
expect(screen.getByTitle('Embeded ESRI Maps')).toBeInTheDocument();
|
|
53
|
+
expect(screen.getByText('Sources')).toBeInTheDocument();
|
|
54
|
+
expect(screen.getByText('More info')).toBeInTheDocument();
|
|
55
|
+
expect(screen.getByText('Share')).toBeInTheDocument();
|
|
56
|
+
expect(screen.getByText('Enlarge')).toBeInTheDocument();
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it('renders an edit view embed map block component', () => {
|
|
60
|
+
render(
|
|
61
|
+
<Provider store={global.store}>
|
|
62
|
+
<View
|
|
63
|
+
id="my-map"
|
|
64
|
+
mode="edit"
|
|
65
|
+
data={{
|
|
66
|
+
'@type': 'embed_maps',
|
|
67
|
+
url: '',
|
|
68
|
+
maps: {},
|
|
69
|
+
}}
|
|
70
|
+
/>
|
|
71
|
+
</Provider>,
|
|
72
|
+
);
|
|
73
|
+
expect(
|
|
74
|
+
screen.getByText('Please select a map from block editor.'),
|
|
75
|
+
).toBeInTheDocument();
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
it('handles map error', () => {
|
|
79
|
+
render(
|
|
80
|
+
<Provider store={global.store}>
|
|
81
|
+
<View
|
|
82
|
+
id="my-map"
|
|
83
|
+
data={{
|
|
84
|
+
'@type': 'embed_maps',
|
|
85
|
+
maps: {
|
|
86
|
+
error: 'Error message',
|
|
87
|
+
},
|
|
88
|
+
}}
|
|
89
|
+
/>
|
|
90
|
+
</Provider>,
|
|
91
|
+
);
|
|
92
|
+
|
|
93
|
+
expect(screen.getByText('Error message')).toBeInTheDocument();
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
it('handles share button click', () => {
|
|
97
|
+
render(
|
|
98
|
+
<Provider store={global.store}>
|
|
99
|
+
<View
|
|
100
|
+
id="my-map"
|
|
101
|
+
data={{
|
|
102
|
+
'@type': 'embed_maps',
|
|
103
|
+
with_share: true,
|
|
104
|
+
url: '/path/to/map',
|
|
105
|
+
maps: {
|
|
106
|
+
'@id': '/path/to/map',
|
|
107
|
+
title: 'My map',
|
|
108
|
+
url: 'https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3027.7835278268726!2d14.38842915203974!3d40.634655679238854!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x133b994881d943cb%3A0x6ab93db57d3272f0!2sHotel+Mediterraneo+Sorrento!5e0!3m2!1sen!2ses!4v1550168740166',
|
|
109
|
+
},
|
|
110
|
+
}}
|
|
111
|
+
/>
|
|
112
|
+
</Provider>,
|
|
113
|
+
);
|
|
54
114
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
<View
|
|
59
|
-
id="my-map"
|
|
60
|
-
mode="edit"
|
|
61
|
-
data={{
|
|
62
|
-
'@type': 'embed_maps',
|
|
63
|
-
url: '',
|
|
64
|
-
maps: {},
|
|
65
|
-
}}
|
|
66
|
-
/>
|
|
67
|
-
</Provider>,
|
|
68
|
-
);
|
|
69
|
-
const json = component.toJSON();
|
|
70
|
-
expect(json).toMatchSnapshot();
|
|
115
|
+
fireEvent.click(screen.getByText('Share'));
|
|
116
|
+
expect(screen.getByDisplayValue('/path/to/map')).toBeInTheDocument();
|
|
117
|
+
});
|
|
71
118
|
});
|
|
@@ -27,7 +27,7 @@ const parameters = {
|
|
|
27
27
|
required: [],
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
const getSchema = (props) => {
|
|
31
31
|
return {
|
|
32
32
|
title: 'Embed interactive Map',
|
|
33
33
|
fieldsets: [
|
|
@@ -101,3 +101,5 @@ export default (props) => {
|
|
|
101
101
|
required: [],
|
|
102
102
|
};
|
|
103
103
|
};
|
|
104
|
+
|
|
105
|
+
export default getSchema;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import { render, screen, fireEvent } from '@testing-library/react';
|
|
3
3
|
import { Provider } from 'react-intl-redux';
|
|
4
4
|
import config from '@plone/volto/registry';
|
|
5
|
+
import '@testing-library/jest-dom/extend-expect';
|
|
5
6
|
|
|
6
7
|
import Edit from './Edit';
|
|
7
8
|
|
|
@@ -26,8 +27,7 @@ describe('Test Maps Block editing', () => {
|
|
|
26
27
|
|
|
27
28
|
const data = {
|
|
28
29
|
'@type': 'maps',
|
|
29
|
-
url:
|
|
30
|
-
'<iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d11255.043736345397!2d24.6862147!3d45.15143895!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x474d3248f30cd7b5%3A0x307c5acf21ded9e3!2sHotel%20Posada!5e0!3m2!1sro!2sro!4v1701254795494!5m2!1sro!2sro" width="600" height="450" style="border:0;" allowfullscreen="" loading="lazy" referrerpolicy="no-referrer-when-downgrade"></iframe>',
|
|
30
|
+
url: '<iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d11255.043736345397!2d24.6862147!3d45.15143895!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x474d3248f30cd7b5%3A0x307c5acf21ded9e3!2sHotel%20Posada!5e0!3m2!1sro!2sro!4v1701254795494!5m2!1sro!2sro" width="600" height="450" style="border:0;" allowfullscreen="" loading="lazy" referrerpolicy="no-referrer-when-downgrade"></iframe>',
|
|
31
31
|
dataprotection: {
|
|
32
32
|
enabled: false,
|
|
33
33
|
privacy_statement: 'This is a privacy statement',
|
|
@@ -35,8 +35,8 @@ describe('Test Maps Block editing', () => {
|
|
|
35
35
|
useVisibilitySensor: false,
|
|
36
36
|
};
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
const
|
|
38
|
+
it('renders the edit form with a map', () => {
|
|
39
|
+
const { container } = render(
|
|
40
40
|
<Provider store={global.store}>
|
|
41
41
|
<Edit
|
|
42
42
|
data={data}
|
|
@@ -54,15 +54,18 @@ describe('Test Maps Block editing', () => {
|
|
|
54
54
|
/>
|
|
55
55
|
</Provider>,
|
|
56
56
|
);
|
|
57
|
-
|
|
58
|
-
expect(
|
|
57
|
+
expect(screen.getByTitle('ESRI Maps Embedded Block')).toBeInTheDocument();
|
|
58
|
+
expect(container.querySelector('iframe')).toBeInTheDocument();
|
|
59
59
|
});
|
|
60
60
|
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
it('renders the edit form without a map', () => {
|
|
62
|
+
render(
|
|
63
63
|
<Provider store={global.store}>
|
|
64
64
|
<Edit
|
|
65
|
-
data={
|
|
65
|
+
data={{
|
|
66
|
+
'@type': 'maps',
|
|
67
|
+
url: '',
|
|
68
|
+
}}
|
|
66
69
|
pathname="/news"
|
|
67
70
|
selected={true}
|
|
68
71
|
block="1234"
|
|
@@ -77,12 +80,15 @@ describe('Test Maps Block editing', () => {
|
|
|
77
80
|
/>
|
|
78
81
|
</Provider>,
|
|
79
82
|
);
|
|
80
|
-
|
|
81
|
-
|
|
83
|
+
expect(
|
|
84
|
+
screen.getByText(
|
|
85
|
+
'Please enter the embed code or URL for the ESRI webmap.',
|
|
86
|
+
),
|
|
87
|
+
).toBeInTheDocument();
|
|
82
88
|
});
|
|
83
89
|
|
|
84
|
-
|
|
85
|
-
const
|
|
90
|
+
it('handles URL input', () => {
|
|
91
|
+
const { container } = render(
|
|
86
92
|
<Provider store={global.store}>
|
|
87
93
|
<Edit
|
|
88
94
|
data={{
|
|
@@ -93,17 +99,22 @@ describe('Test Maps Block editing', () => {
|
|
|
93
99
|
selected={true}
|
|
94
100
|
block="1234"
|
|
95
101
|
index={1}
|
|
96
|
-
onChangeBlock={()
|
|
97
|
-
onSelectBlock={()
|
|
98
|
-
onDeleteBlock={()
|
|
99
|
-
onFocusPreviousBlock={()
|
|
100
|
-
onFocusNextBlock={()
|
|
101
|
-
handleKeyDown={()
|
|
102
|
-
content={{}}
|
|
102
|
+
onChangeBlock={jest.fn()}
|
|
103
|
+
onSelectBlock={jest.fn()}
|
|
104
|
+
onDeleteBlock={jest.fn()}
|
|
105
|
+
onFocusPreviousBlock={jest.fn()}
|
|
106
|
+
onFocusNextBlock={jest.fn()}
|
|
107
|
+
handleKeyDown={jest.fn()}
|
|
103
108
|
/>
|
|
104
109
|
</Provider>,
|
|
105
110
|
);
|
|
106
|
-
|
|
107
|
-
|
|
111
|
+
|
|
112
|
+
const input = screen.getByPlaceholderText('Enter map Embed Code');
|
|
113
|
+
fireEvent.change(input, { target: { value: 'https://example.com/map' } });
|
|
114
|
+
fireEvent.click(container.querySelector('button.primary.button'));
|
|
115
|
+
|
|
116
|
+
expect(
|
|
117
|
+
screen.getByDisplayValue('https://example.com/map'),
|
|
118
|
+
).toBeInTheDocument();
|
|
108
119
|
});
|
|
109
120
|
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { render } from '@testing-library/react';
|
|
3
|
-
import renderer from 'react-test-renderer';
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
4
3
|
import { Provider } from 'react-intl-redux';
|
|
5
4
|
import config from '@plone/volto/registry';
|
|
5
|
+
import '@testing-library/jest-dom/extend-expect';
|
|
6
6
|
|
|
7
7
|
import View from './View';
|
|
8
8
|
import installEmbedMaps from '.';
|
|
@@ -32,29 +32,32 @@ config.blocks.blocksConfig = {
|
|
|
32
32
|
},
|
|
33
33
|
};
|
|
34
34
|
|
|
35
|
-
describe('
|
|
35
|
+
describe('Maps Block View', () => {
|
|
36
36
|
const data = {
|
|
37
37
|
'@type': 'maps',
|
|
38
|
-
url:
|
|
39
|
-
'https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3027.7835278268726!2d14.38842915203974!3d40.634655679238854!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x133b994881d943cb%3A0x6ab93db57d3272f0!2sHotel+Mediterraneo+Sorrento!5e0!3m2!1sen!2ses!4v1550168740166',
|
|
38
|
+
url: 'https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3027.7835278268726!2d14.38842915203974!3d40.634655679238854!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x133b994881d943cb%3A0x6ab93db57d3272f0!2sHotel+Mediterraneo+Sorrento!5e0!3m2!1sen!2ses!4v1550168740166',
|
|
40
39
|
useVisibilitySensor: false,
|
|
41
40
|
dataprotection: {
|
|
42
41
|
enabled: false,
|
|
43
42
|
},
|
|
44
43
|
};
|
|
45
44
|
|
|
46
|
-
|
|
47
|
-
const
|
|
45
|
+
it('test-1', () => {
|
|
46
|
+
const { container } = render(
|
|
48
47
|
<Provider store={global.store}>
|
|
49
48
|
<View data={data} />
|
|
50
49
|
</Provider>,
|
|
51
50
|
);
|
|
52
|
-
|
|
53
|
-
expect(
|
|
51
|
+
|
|
52
|
+
expect(screen.getByTitle('Embeded ESRI Maps')).toBeInTheDocument();
|
|
53
|
+
expect(container.querySelector('iframe')).toHaveAttribute(
|
|
54
|
+
'src',
|
|
55
|
+
'https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3027.7835278268726!2d14.38842915203974!3d40.634655679238854!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x133b994881d943cb%3A0x6ab93db57d3272f0!2sHotel+Mediterraneo+Sorrento!5e0!3m2!1sen!2ses!4v1550168740166',
|
|
56
|
+
);
|
|
54
57
|
});
|
|
55
58
|
|
|
56
|
-
|
|
57
|
-
const
|
|
59
|
+
it('test-2', () => {
|
|
60
|
+
const { container } = render(
|
|
58
61
|
<Provider store={global.store}>
|
|
59
62
|
<View
|
|
60
63
|
data={{
|
|
@@ -64,11 +67,14 @@ describe('Test Maps Block rendering', () => {
|
|
|
64
67
|
/>
|
|
65
68
|
</Provider>,
|
|
66
69
|
);
|
|
67
|
-
|
|
68
|
-
expect(
|
|
70
|
+
|
|
71
|
+
expect(container.querySelector('iframe')).toHaveAttribute(
|
|
72
|
+
'style',
|
|
73
|
+
'height: 100vh;',
|
|
74
|
+
);
|
|
69
75
|
});
|
|
70
76
|
|
|
71
|
-
|
|
77
|
+
it('test-3', () => {
|
|
72
78
|
const Component = (props) => (
|
|
73
79
|
<Provider store={global.store}>
|
|
74
80
|
<View
|
|
@@ -86,11 +92,8 @@ describe('Test Maps Block rendering', () => {
|
|
|
86
92
|
);
|
|
87
93
|
const { container, rerender } = render(<Component />);
|
|
88
94
|
|
|
89
|
-
expect(container).toMatchSnapshot();
|
|
90
|
-
|
|
91
95
|
container.querySelector('.privacy-button button').click();
|
|
92
96
|
|
|
93
97
|
rerender(<Component />);
|
|
94
|
-
expect(container).toMatchSnapshot();
|
|
95
98
|
});
|
|
96
99
|
});
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
3
|
import { Provider } from 'react-intl-redux';
|
|
4
4
|
import config from '@plone/volto/registry';
|
|
5
|
+
import '@testing-library/jest-dom/extend-expect';
|
|
5
6
|
|
|
6
7
|
import EmbedMap from './EmbedMap';
|
|
7
8
|
|
|
@@ -23,28 +24,65 @@ config.blocks.blocksConfig = {
|
|
|
23
24
|
},
|
|
24
25
|
};
|
|
25
26
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
<
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
'https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3027.7835278268726!2d14.38842915203974!3d40.634655679238854!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x133b994881d943cb%3A0x6ab93db57d3272f0!2sHotel+Mediterraneo+Sorrento!5e0!3m2!1sen!2ses!4v1550168740166',
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
27
|
+
describe('EmbedMap', () => {
|
|
28
|
+
it('renders map component', () => {
|
|
29
|
+
const { container } = render(
|
|
30
|
+
<Provider store={global.store}>
|
|
31
|
+
<EmbedMap
|
|
32
|
+
id="my-map"
|
|
33
|
+
data={{
|
|
34
|
+
with_notes: false,
|
|
35
|
+
with_sources: false,
|
|
36
|
+
with_more_info: true,
|
|
37
|
+
with_share: true,
|
|
38
|
+
with_enlarge: true,
|
|
39
|
+
url: 'https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3027.7835278268726!2d14.38842915203974!3d40.634655679238854!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x133b994881d943cb%3A0x6ab93db57d3272f0!2sHotel+Mediterraneo+Sorrento!5e0!3m2!1sen!2ses!4v1550168740166',
|
|
40
|
+
useVisibilitySensor: false,
|
|
41
|
+
parameters: {
|
|
42
|
+
Country: 'RO',
|
|
43
|
+
zoomtocountry: 'RO',
|
|
44
|
+
},
|
|
45
|
+
}}
|
|
46
|
+
/>
|
|
47
|
+
</Provider>,
|
|
48
|
+
);
|
|
49
|
+
expect(screen.getByTitle('Embeded ESRI Maps')).toBeInTheDocument();
|
|
50
|
+
expect(container.querySelector('iframe')).toHaveAttribute(
|
|
51
|
+
'src',
|
|
52
|
+
'https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3027.7835278268726!2d14.38842915203974!3d40.634655679238854!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x133b994881d943cb%3A0x6ab93db57d3272f0!2sHotel+Mediterraneo+Sorrento!5e0!3m2!1sen!2ses!4v1550168740166&Country=RO&zoomtocountry=RO',
|
|
53
|
+
);
|
|
54
|
+
expect(screen.getByText('More info')).toBeInTheDocument();
|
|
55
|
+
expect(screen.getByText('Share')).toBeInTheDocument();
|
|
56
|
+
expect(screen.getByText('Enlarge')).toBeInTheDocument();
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it('handles mobile view', () => {
|
|
60
|
+
const { container } = render(
|
|
61
|
+
<Provider store={global.store}>
|
|
62
|
+
<EmbedMap
|
|
63
|
+
id="my-map"
|
|
64
|
+
data={{
|
|
65
|
+
with_notes: false,
|
|
66
|
+
with_sources: false,
|
|
67
|
+
with_more_info: true,
|
|
68
|
+
with_share: true,
|
|
69
|
+
with_enlarge: true,
|
|
70
|
+
url: 'https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3027.7835278268726!2d14.38842915203974!3d40.634655679238854!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x133b994881d943cb%3A0x6ab93db57d3272f0!2sHotel+Mediterraneo+Sorrento!5e0!3m2!1sen!2ses!4v1550168740166',
|
|
71
|
+
useVisibilitySensor: false,
|
|
72
|
+
parameters: {
|
|
73
|
+
Country: 'RO',
|
|
74
|
+
zoomtocountry: 'RO',
|
|
75
|
+
},
|
|
76
|
+
}}
|
|
77
|
+
intl={{ formatMessage: (message) => message.defaultMessage }}
|
|
78
|
+
screen={{ width: 400 }}
|
|
79
|
+
/>
|
|
80
|
+
</Provider>,
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
expect(container.querySelector('iframe')).toHaveClass('google-map');
|
|
84
|
+
expect(container.querySelector('.visualization-toolbar')).toHaveClass(
|
|
85
|
+
'mobile',
|
|
86
|
+
);
|
|
87
|
+
});
|
|
50
88
|
});
|
|
@@ -24,8 +24,7 @@ export const ProtectionSchema = () => ({
|
|
|
24
24
|
{
|
|
25
25
|
children: [
|
|
26
26
|
{
|
|
27
|
-
text:
|
|
28
|
-
'This map is hosted by a third party, Environmental Systems Research Institute. By showing the external content you accept the terms and conditions of ',
|
|
27
|
+
text: 'This map is hosted by a third party, Environmental Systems Research Institute. By showing the external content you accept the terms and conditions of ',
|
|
29
28
|
},
|
|
30
29
|
{
|
|
31
30
|
type: 'a',
|
|
@@ -37,8 +36,7 @@ export const ProtectionSchema = () => ({
|
|
|
37
36
|
],
|
|
38
37
|
},
|
|
39
38
|
{
|
|
40
|
-
text:
|
|
41
|
-
'. This includes their cookie policies, which we have no control over.',
|
|
39
|
+
text: '. This includes their cookie policies, which we have no control over.',
|
|
42
40
|
},
|
|
43
41
|
],
|
|
44
42
|
},
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
3
|
import { Provider } from 'react-intl-redux';
|
|
4
4
|
import config from '@plone/volto/registry';
|
|
5
|
+
import '@testing-library/jest-dom/extend-expect';
|
|
5
6
|
|
|
6
7
|
import { Enlarge, FigureNote, MoreInfo, Share, Sources } from '.';
|
|
7
8
|
|
|
@@ -24,7 +25,7 @@ config.blocks.blocksConfig = {
|
|
|
24
25
|
};
|
|
25
26
|
|
|
26
27
|
test('renders toolbar components', () => {
|
|
27
|
-
const
|
|
28
|
+
const { container } = render(
|
|
28
29
|
<Provider store={global.store}>
|
|
29
30
|
<div className="visualization-toolbar">
|
|
30
31
|
<div className="left-col">
|
|
@@ -43,6 +44,37 @@ test('renders toolbar components', () => {
|
|
|
43
44
|
</div>
|
|
44
45
|
</Provider>,
|
|
45
46
|
);
|
|
46
|
-
|
|
47
|
-
expect(
|
|
47
|
+
|
|
48
|
+
expect(screen.getByText('Note')).toBeInTheDocument();
|
|
49
|
+
expect(screen.getByText('Sources')).toBeInTheDocument();
|
|
50
|
+
expect(screen.getByText('More info')).toBeInTheDocument();
|
|
51
|
+
expect(screen.getByText('Share')).toBeInTheDocument();
|
|
52
|
+
expect(screen.getByText('Enlarge')).toBeInTheDocument();
|
|
53
|
+
expect(
|
|
54
|
+
screen.getByDisplayValue('/path/to/embeded/content'),
|
|
55
|
+
).toBeInTheDocument();
|
|
56
|
+
expect(screen.getByText('Copy')).toBeInTheDocument();
|
|
57
|
+
expect(container.querySelector('.figure-note')).toBeInTheDocument();
|
|
58
|
+
expect(container.querySelector('.sources')).toBeInTheDocument();
|
|
59
|
+
expect(container.querySelector('.more-info')).toBeInTheDocument();
|
|
60
|
+
expect(container.querySelector('.enlarge')).toBeInTheDocument();
|
|
61
|
+
expect(container.querySelector('.share')).toBeInTheDocument();
|
|
62
|
+
expect(container.querySelector('p')).toHaveTextContent('This is a note');
|
|
63
|
+
expect(
|
|
64
|
+
screen.getByText('Data provenance is not set for this visualization.'),
|
|
65
|
+
).toBeInTheDocument();
|
|
66
|
+
expect(container.querySelector('a')).toHaveAttribute(
|
|
67
|
+
'href',
|
|
68
|
+
'/path/to/embeded/content',
|
|
69
|
+
);
|
|
70
|
+
expect(
|
|
71
|
+
container.querySelector('i.ri-external-link-line'),
|
|
72
|
+
).toBeInTheDocument();
|
|
73
|
+
expect(container.querySelector('i.ri-fullscreen-line')).toBeInTheDocument();
|
|
74
|
+
expect(container.querySelector('i.ri-share-fill')).toBeInTheDocument();
|
|
75
|
+
expect(container.querySelector('input')).toHaveAttribute(
|
|
76
|
+
'value',
|
|
77
|
+
'/path/to/embeded/content',
|
|
78
|
+
);
|
|
79
|
+
expect(container.querySelector('button.copy-button')).toBeInTheDocument();
|
|
48
80
|
});
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
3
|
import { Provider } from 'react-intl-redux';
|
|
4
4
|
import config from '@plone/volto/registry';
|
|
5
|
+
import '@testing-library/jest-dom/extend-expect';
|
|
5
6
|
|
|
6
7
|
import MapView from './MapView';
|
|
7
8
|
|
|
@@ -29,7 +30,7 @@ config.blocks.blocksConfig = {
|
|
|
29
30
|
};
|
|
30
31
|
|
|
31
32
|
test('renders map component', () => {
|
|
32
|
-
const
|
|
33
|
+
const { container } = render(
|
|
33
34
|
<Provider store={global.store}>
|
|
34
35
|
<MapView
|
|
35
36
|
content={{
|
|
@@ -40,14 +41,33 @@ test('renders map component', () => {
|
|
|
40
41
|
with_more_info: true,
|
|
41
42
|
with_share: true,
|
|
42
43
|
with_enlarge: true,
|
|
43
|
-
url:
|
|
44
|
-
'https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3027.7835278268726!2d14.38842915203974!3d40.634655679238854!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x133b994881d943cb%3A0x6ab93db57d3272f0!2sHotel+Mediterraneo+Sorrento!5e0!3m2!1sen!2ses!4v1550168740166',
|
|
44
|
+
url: 'https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3027.7835278268726!2d14.38842915203974!3d40.634655679238854!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x133b994881d943cb%3A0x6ab93db57d3272f0!2sHotel+Mediterraneo+Sorrento!5e0!3m2!1sen!2ses!4v1550168740166',
|
|
45
45
|
useVisibilitySensor: false,
|
|
46
46
|
},
|
|
47
47
|
}}
|
|
48
48
|
/>
|
|
49
49
|
</Provider>,
|
|
50
50
|
);
|
|
51
|
-
|
|
52
|
-
expect(
|
|
51
|
+
|
|
52
|
+
expect(screen.getByTitle('Embeded ESRI Maps')).toBeInTheDocument();
|
|
53
|
+
expect(container.querySelector('iframe')).toHaveAttribute(
|
|
54
|
+
'src',
|
|
55
|
+
'https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3027.7835278268726!2d14.38842915203974!3d40.634655679238854!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x133b994881d943cb%3A0x6ab93db57d3272f0!2sHotel+Mediterraneo+Sorrento!5e0!3m2!1sen!2ses!4v1550168740166',
|
|
56
|
+
);
|
|
57
|
+
expect(container.querySelector('.more-info')).toBeInTheDocument();
|
|
58
|
+
expect(container.querySelector('.more-info a')).toHaveAttribute(
|
|
59
|
+
'href',
|
|
60
|
+
'/path/to/map',
|
|
61
|
+
);
|
|
62
|
+
expect(container.querySelector('.share')).toBeInTheDocument();
|
|
63
|
+
expect(container.querySelector('.share button')).toBeInTheDocument();
|
|
64
|
+
expect(container.querySelector('.enlarge')).toBeInTheDocument();
|
|
65
|
+
expect(container.querySelector('.enlarge button')).toBeInTheDocument();
|
|
66
|
+
expect(container.querySelector('.ui.input.share-link input')).toHaveAttribute(
|
|
67
|
+
'value',
|
|
68
|
+
'/path/to/map',
|
|
69
|
+
);
|
|
70
|
+
expect(
|
|
71
|
+
container.querySelector('.ui.primary.button.copy-button'),
|
|
72
|
+
).toBeInTheDocument();
|
|
53
73
|
});
|
package/.project.eslintrc.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
|
|
4
|
-
const projectRootPath = fs.existsSync('./project')
|
|
5
|
-
? fs.realpathSync('./project')
|
|
6
|
-
: fs.realpathSync('./../../../');
|
|
7
|
-
const packageJson = require(path.join(projectRootPath, 'package.json'));
|
|
8
|
-
const jsConfig = require(path.join(projectRootPath, 'jsconfig.json')).compilerOptions;
|
|
9
|
-
|
|
10
|
-
const pathsConfig = jsConfig.paths;
|
|
11
|
-
|
|
12
|
-
let voltoPath = path.join(projectRootPath, 'node_modules/@plone/volto');
|
|
13
|
-
|
|
14
|
-
Object.keys(pathsConfig).forEach(pkg => {
|
|
15
|
-
if (pkg === '@plone/volto') {
|
|
16
|
-
voltoPath = `./${jsConfig.baseUrl}/${pathsConfig[pkg][0]}`;
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
const AddonConfigurationRegistry = require(`${voltoPath}/addon-registry.js`);
|
|
20
|
-
const reg = new AddonConfigurationRegistry(projectRootPath);
|
|
21
|
-
|
|
22
|
-
// Extends ESlint configuration for adding the aliases to `src` directories in Volto addons
|
|
23
|
-
const addonAliases = Object.keys(reg.packages).map(o => [
|
|
24
|
-
o,
|
|
25
|
-
reg.packages[o].modulePath,
|
|
26
|
-
]);
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
module.exports = {
|
|
30
|
-
extends: `${projectRootPath}/node_modules/@plone/volto/.eslintrc`,
|
|
31
|
-
settings: {
|
|
32
|
-
'import/resolver': {
|
|
33
|
-
alias: {
|
|
34
|
-
map: [
|
|
35
|
-
['@plone/volto', '@plone/volto/src'],
|
|
36
|
-
...addonAliases,
|
|
37
|
-
['@package', `${__dirname}/src`],
|
|
38
|
-
['~', `${__dirname}/src`],
|
|
39
|
-
],
|
|
40
|
-
extensions: ['.js', '.jsx', '.json'],
|
|
41
|
-
},
|
|
42
|
-
'babel-plugin-root-import': {
|
|
43
|
-
rootPathSuffix: 'src',
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
};
|
|
48
|
-
|