@eeacms/volto-embed 9.0.0 → 9.0.2
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 +17 -2
- package/cypress.config.js +6 -15
- package/jest-addon.config.js +3 -0
- package/jest.setup.js +77 -0
- package/locales/de/LC_MESSAGES/volto.po +9 -23
- package/locales/en/LC_MESSAGES/volto.po +9 -23
- package/locales/it/LC_MESSAGES/volto.po +9 -23
- package/locales/ro/LC_MESSAGES/volto.po +9 -23
- package/locales/volto.pot +10 -24
- package/package.json +5 -4
- package/src/Blocks/EmbedMaps/Edit.jsx +10 -6
- package/src/Blocks/EmbedMaps/Edit.test.js +2 -26
- package/src/Blocks/EmbedMaps/View.jsx +1 -0
- package/src/Blocks/EmbedMaps/View.test.js +1 -21
- package/src/Blocks/EmbedMaps/index.js +2 -2
- package/src/Blocks/EmbedMaps/schema.js +29 -9
- package/src/Blocks/Maps/Edit.jsx +1 -2
- package/src/Blocks/Maps/Edit.test.js +72 -68
- package/src/Blocks/Maps/MapsSidebar.jsx +1 -2
- package/src/Blocks/Maps/View.jsx +1 -1
- package/src/Blocks/Maps/View.test.js +60 -36
- package/src/Blocks/Maps/schema.js +25 -9
- package/src/Blocks/index.js +9 -0
- package/src/EmbedMap/EmbedMap.jsx +17 -4
- package/src/EmbedMap/EmbedMap.test.js +1 -21
- package/src/PrivacyProtection/PrivacyProtection.jsx +1 -1
- package/src/Toolbar/Toolbar.test.js +1 -49
- package/src/Views/MapView.jsx +16 -2
- package/src/Views/MapView.test.js +1 -21
- package/src/Widgets/MapsViewWidget.jsx +17 -2
- package/src/Widgets/MapsWidget.jsx +11 -2
package/locales/volto.pot
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
msgid ""
|
|
2
2
|
msgstr ""
|
|
3
3
|
"Project-Id-Version: Plone\n"
|
|
4
|
-
"POT-Creation-Date: 2023-11-
|
|
4
|
+
"POT-Creation-Date: 2023-11-29T13:51:29.116Z\n"
|
|
5
5
|
"Last-Translator: Plone i18n <plone-i18n@lists.sourceforge.net>\n"
|
|
6
6
|
"Language-Team: Plone i18n <plone-i18n@lists.sourceforge.net>\n"
|
|
7
7
|
"MIME-Version: 1.0\n"
|
|
@@ -13,13 +13,11 @@ msgstr ""
|
|
|
13
13
|
"Preferred-Encodings: utf-8\n"
|
|
14
14
|
"Domain: volto\n"
|
|
15
15
|
|
|
16
|
-
#: Blocks/EmbedMaps/schema
|
|
17
16
|
#: Blocks/Maps/schema
|
|
18
17
|
# defaultMessage: Alignment
|
|
19
18
|
msgid "Alignment"
|
|
20
19
|
msgstr ""
|
|
21
20
|
|
|
22
|
-
#: Blocks/EmbedMaps/schema
|
|
23
21
|
#: Blocks/Maps/schema
|
|
24
22
|
# defaultMessage: Alt text
|
|
25
23
|
msgid "Alt text"
|
|
@@ -27,55 +25,43 @@ msgstr ""
|
|
|
27
25
|
|
|
28
26
|
#: Blocks/EmbedMaps/schema
|
|
29
27
|
#: Blocks/Maps/schema
|
|
30
|
-
# defaultMessage:
|
|
31
|
-
msgid "
|
|
32
|
-
msgstr ""
|
|
33
|
-
|
|
34
|
-
#: Blocks/EmbedMaps/schema
|
|
35
|
-
#: Blocks/Maps/schema
|
|
36
|
-
# defaultMessage: undefined
|
|
37
|
-
msgid "CSSHeightDescription"
|
|
28
|
+
# defaultMessage: CSS height
|
|
29
|
+
msgid "CSS height"
|
|
38
30
|
msgstr ""
|
|
39
31
|
|
|
40
|
-
#: Blocks/EmbedMaps/Edit
|
|
41
32
|
#: Blocks/Maps/Edit
|
|
42
33
|
# defaultMessage: Center
|
|
43
34
|
msgid "Center"
|
|
44
35
|
msgstr ""
|
|
45
36
|
|
|
46
|
-
#: Blocks/EmbedMaps/Edit
|
|
47
37
|
#: Blocks/Maps/Edit
|
|
48
38
|
#: Widgets/MapsWidget
|
|
49
39
|
# defaultMessage: Embed code error, please follow the instructions and try again.
|
|
50
40
|
msgid "Embed code error, please follow the instructions and try again."
|
|
51
41
|
msgstr ""
|
|
52
42
|
|
|
53
|
-
#: Blocks/EmbedMaps/View
|
|
54
43
|
#: Blocks/Maps/View
|
|
55
|
-
#:
|
|
44
|
+
#: EmbedMap/EmbedMap
|
|
56
45
|
# defaultMessage: Embeded Google Maps
|
|
57
46
|
msgid "Embeded Google Maps"
|
|
58
47
|
msgstr ""
|
|
59
48
|
|
|
60
|
-
#: Blocks/EmbedMaps/Edit
|
|
61
49
|
#: Blocks/Maps/Edit
|
|
50
|
+
#: Widgets/MapsWidget
|
|
62
51
|
# defaultMessage: Enter map Embed Code
|
|
63
52
|
msgid "Enter map Embed Code"
|
|
64
53
|
msgstr ""
|
|
65
54
|
|
|
66
|
-
#: Blocks/EmbedMaps/Edit
|
|
67
55
|
#: Blocks/Maps/Edit
|
|
68
56
|
# defaultMessage: Full
|
|
69
57
|
msgid "Full"
|
|
70
58
|
msgstr ""
|
|
71
59
|
|
|
72
|
-
#: Blocks/EmbedMaps/Edit
|
|
73
60
|
#: Blocks/Maps/Edit
|
|
74
61
|
# defaultMessage: Google Maps Embedded Block
|
|
75
62
|
msgid "Google Maps Embedded Block"
|
|
76
63
|
msgstr ""
|
|
77
64
|
|
|
78
|
-
#: Blocks/EmbedMaps/Edit
|
|
79
65
|
#: Blocks/Maps/Edit
|
|
80
66
|
# defaultMessage: Left
|
|
81
67
|
msgid "Left"
|
|
@@ -86,34 +72,34 @@ msgstr ""
|
|
|
86
72
|
msgid "Live image generated"
|
|
87
73
|
msgstr ""
|
|
88
74
|
|
|
89
|
-
#: Blocks/EmbedMaps/MapsSidebar
|
|
90
75
|
#: Blocks/EmbedMaps/schema
|
|
76
|
+
#: Blocks/Maps/schema
|
|
77
|
+
# defaultMessage: Map height
|
|
78
|
+
msgid "Map height"
|
|
79
|
+
msgstr ""
|
|
80
|
+
|
|
91
81
|
#: Blocks/Maps/MapsSidebar
|
|
92
82
|
#: Blocks/Maps/schema
|
|
93
83
|
# defaultMessage: Maps
|
|
94
84
|
msgid "Maps"
|
|
95
85
|
msgstr ""
|
|
96
86
|
|
|
97
|
-
#: Blocks/EmbedMaps/schema
|
|
98
87
|
#: Blocks/Maps/schema
|
|
99
88
|
# defaultMessage: Maps URL
|
|
100
89
|
msgid "Maps URL"
|
|
101
90
|
msgstr ""
|
|
102
91
|
|
|
103
|
-
#: Blocks/EmbedMaps/MapsSidebar
|
|
104
92
|
#: Blocks/Maps/MapsSidebar
|
|
105
93
|
# defaultMessage: No map selected
|
|
106
94
|
msgid "No map selected"
|
|
107
95
|
msgstr ""
|
|
108
96
|
|
|
109
|
-
#: Blocks/EmbedMaps/Edit
|
|
110
97
|
#: Blocks/Maps/Edit
|
|
111
98
|
#: Widgets/MapsWidget
|
|
112
99
|
# defaultMessage: Please enter the Embed Code provided by Google Maps -> Share -> Embed map. It should contain the <iframe> code on it.
|
|
113
100
|
msgid "Please enter the Embed Code provided by Google Maps -> Share -> Embed map. It should contain the <iframe> code on it."
|
|
114
101
|
msgstr ""
|
|
115
102
|
|
|
116
|
-
#: Blocks/EmbedMaps/Edit
|
|
117
103
|
#: Blocks/Maps/Edit
|
|
118
104
|
# defaultMessage: Right
|
|
119
105
|
msgid "Right"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eeacms/volto-embed",
|
|
3
|
-
"version": "9.0.
|
|
3
|
+
"version": "9.0.2",
|
|
4
4
|
"description": "Embed external content",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"author": "European Environment Agency: IDM2 A-Team",
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
"@cypress/code-coverage": "^3.10.0",
|
|
27
27
|
"@plone/scripts": "*",
|
|
28
28
|
"babel-plugin-transform-class-properties": "^6.24.1",
|
|
29
|
+
"cypress-fail-fast": "^5.0.1",
|
|
29
30
|
"husky": "^8.0.3",
|
|
30
31
|
"lint-staged": "^14.0.1",
|
|
31
32
|
"md5": "^2.3.0"
|
|
@@ -52,6 +53,7 @@
|
|
|
52
53
|
]
|
|
53
54
|
},
|
|
54
55
|
"scripts": {
|
|
56
|
+
"prepare": "husky install",
|
|
55
57
|
"release": "release-it",
|
|
56
58
|
"release-major-beta": "release-it major --preRelease=beta",
|
|
57
59
|
"release-beta": "release-it --preRelease=beta",
|
|
@@ -68,7 +70,6 @@
|
|
|
68
70
|
"lint:fix": "make lint-fix",
|
|
69
71
|
"i18n": "make i18n",
|
|
70
72
|
"cypress:run": "make cypress-run",
|
|
71
|
-
"cypress:open": "make cypress-open"
|
|
72
|
-
"prepare": "husky install"
|
|
73
|
+
"cypress:open": "make cypress-open"
|
|
73
74
|
}
|
|
74
|
-
}
|
|
75
|
+
}
|
|
@@ -1,31 +1,35 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { compose } from 'redux';
|
|
3
|
+
import { injectIntl } from 'react-intl';
|
|
2
4
|
import BlockDataForm from '@plone/volto/components/manage/Form/BlockDataForm';
|
|
3
5
|
import { SidebarPortal } from '@plone/volto/components';
|
|
4
6
|
import View from './View';
|
|
5
7
|
import getSchema from './schema';
|
|
6
8
|
|
|
7
9
|
const Edit = (props) => {
|
|
10
|
+
const { block, data, selected, onChangeBlock } = props;
|
|
8
11
|
const schema = React.useMemo(() => getSchema(props), [props]);
|
|
9
12
|
|
|
10
13
|
return (
|
|
11
14
|
<React.Fragment>
|
|
12
15
|
<View {...props} mode="edit" />
|
|
13
|
-
<SidebarPortal selected={
|
|
16
|
+
<SidebarPortal selected={selected}>
|
|
14
17
|
<BlockDataForm
|
|
15
|
-
block={
|
|
18
|
+
block={block}
|
|
16
19
|
schema={schema}
|
|
17
20
|
title={schema.title}
|
|
18
21
|
onChangeField={(id, value) => {
|
|
19
|
-
|
|
20
|
-
...
|
|
22
|
+
onChangeBlock(block, {
|
|
23
|
+
...data,
|
|
21
24
|
[id]: value,
|
|
22
25
|
});
|
|
23
26
|
}}
|
|
24
|
-
|
|
27
|
+
onChangeBlock={onChangeBlock}
|
|
28
|
+
formData={data}
|
|
25
29
|
/>
|
|
26
30
|
</SidebarPortal>
|
|
27
31
|
</React.Fragment>
|
|
28
32
|
);
|
|
29
33
|
};
|
|
30
34
|
|
|
31
|
-
export default Edit;
|
|
35
|
+
export default compose(injectIntl)(Edit);
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import renderer from 'react-test-renderer';
|
|
3
|
-
import configureStore from 'redux-mock-store';
|
|
4
3
|
import { Provider } from 'react-intl-redux';
|
|
5
4
|
import config from '@plone/volto/registry';
|
|
6
5
|
|
|
@@ -9,32 +8,9 @@ import installEmbedMaps from '.';
|
|
|
9
8
|
|
|
10
9
|
installEmbedMaps(config);
|
|
11
10
|
|
|
12
|
-
const mockStore = configureStore();
|
|
13
|
-
|
|
14
|
-
jest.mock('@plone/volto/components', () => ({
|
|
15
|
-
__esModule: true,
|
|
16
|
-
SidebarPortal: jest.requireActual(
|
|
17
|
-
'@plone/volto/components/manage/Sidebar/SidebarPortal',
|
|
18
|
-
).default,
|
|
19
|
-
UniversalLink: ({ children, href }) => {
|
|
20
|
-
return <a href={href}>{children}</a>;
|
|
21
|
-
},
|
|
22
|
-
}));
|
|
23
|
-
|
|
24
|
-
const store = mockStore({
|
|
25
|
-
intl: {
|
|
26
|
-
locale: 'en',
|
|
27
|
-
messages: {},
|
|
28
|
-
},
|
|
29
|
-
content: {
|
|
30
|
-
create: {},
|
|
31
|
-
},
|
|
32
|
-
connected_data_parameters: {},
|
|
33
|
-
});
|
|
34
|
-
|
|
35
11
|
test('renders an edit embed map block component', () => {
|
|
36
12
|
const component = renderer.create(
|
|
37
|
-
<Provider store={store}>
|
|
13
|
+
<Provider store={global.store}>
|
|
38
14
|
<Edit
|
|
39
15
|
id="my-map"
|
|
40
16
|
data={{
|
|
@@ -57,7 +33,7 @@ test('renders an edit embed map block component', () => {
|
|
|
57
33
|
useVisibilitySensor: false,
|
|
58
34
|
}}
|
|
59
35
|
pathname="/news"
|
|
60
|
-
selected={
|
|
36
|
+
selected={true}
|
|
61
37
|
block="1234"
|
|
62
38
|
index={1}
|
|
63
39
|
onChangeBlock={() => {}}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import renderer from 'react-test-renderer';
|
|
3
|
-
import configureStore from 'redux-mock-store';
|
|
4
3
|
import { Provider } from 'react-intl-redux';
|
|
5
4
|
import config from '@plone/volto/registry';
|
|
6
5
|
|
|
@@ -9,28 +8,9 @@ import installEmbedMaps from '.';
|
|
|
9
8
|
|
|
10
9
|
installEmbedMaps(config);
|
|
11
10
|
|
|
12
|
-
const mockStore = configureStore();
|
|
13
|
-
|
|
14
|
-
jest.mock('@plone/volto/components', () => ({
|
|
15
|
-
__esModule: true,
|
|
16
|
-
UniversalLink: ({ children, href }) => {
|
|
17
|
-
return <a href={href}>{children}</a>;
|
|
18
|
-
},
|
|
19
|
-
}));
|
|
20
|
-
|
|
21
11
|
test('renders a view embed map block component', () => {
|
|
22
|
-
const store = mockStore({
|
|
23
|
-
intl: {
|
|
24
|
-
locale: 'en',
|
|
25
|
-
messages: {},
|
|
26
|
-
},
|
|
27
|
-
content: {
|
|
28
|
-
create: {},
|
|
29
|
-
},
|
|
30
|
-
connected_data_parameters: {},
|
|
31
|
-
});
|
|
32
12
|
const component = renderer.create(
|
|
33
|
-
<Provider store={store}>
|
|
13
|
+
<Provider store={global.store}>
|
|
34
14
|
<View
|
|
35
15
|
id="my-map"
|
|
36
16
|
data={{
|
|
@@ -6,9 +6,9 @@ import sliderSVG from '@plone/volto/icons/slider.svg';
|
|
|
6
6
|
const applyConfig = (config) => {
|
|
7
7
|
config.blocks.blocksConfig.embed_maps = {
|
|
8
8
|
id: 'embed_maps',
|
|
9
|
-
title: 'Embed Map',
|
|
9
|
+
title: 'Embed interactive Map',
|
|
10
10
|
icon: sliderSVG,
|
|
11
|
-
group: '
|
|
11
|
+
group: 'data_visualizations',
|
|
12
12
|
edit: EmbedMap,
|
|
13
13
|
view: EmbedView,
|
|
14
14
|
restricted: false,
|
|
@@ -1,11 +1,24 @@
|
|
|
1
|
-
|
|
1
|
+
import { defineMessages } from 'react-intl';
|
|
2
|
+
|
|
3
|
+
const messages = defineMessages({
|
|
4
|
+
CSSHeight: {
|
|
5
|
+
id: 'CSS height',
|
|
6
|
+
defaultMessage: 'CSS height',
|
|
7
|
+
},
|
|
8
|
+
CSSMapHeightDescription: {
|
|
9
|
+
id: 'Map height',
|
|
10
|
+
defaultMessage: 'Map height',
|
|
11
|
+
},
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export default (props) => {
|
|
2
15
|
return {
|
|
3
|
-
title: 'Embed Map',
|
|
16
|
+
title: 'Embed interactive Map',
|
|
4
17
|
fieldsets: [
|
|
5
18
|
{
|
|
6
19
|
id: 'default',
|
|
7
20
|
title: 'Default',
|
|
8
|
-
fields: ['url'],
|
|
21
|
+
fields: ['url', 'height'],
|
|
9
22
|
},
|
|
10
23
|
{
|
|
11
24
|
id: 'toolbar',
|
|
@@ -24,6 +37,18 @@ export default () => {
|
|
|
24
37
|
title: 'Map url',
|
|
25
38
|
widget: 'url',
|
|
26
39
|
},
|
|
40
|
+
height: {
|
|
41
|
+
title: (
|
|
42
|
+
<a
|
|
43
|
+
rel="noreferrer"
|
|
44
|
+
target="_blank"
|
|
45
|
+
href="https://developer.mozilla.org/en-US/docs/Web/CSS/height"
|
|
46
|
+
>
|
|
47
|
+
{props.intl.formatMessage(messages.CSSHeight)}
|
|
48
|
+
</a>
|
|
49
|
+
),
|
|
50
|
+
description: props.intl.formatMessage(messages.CSSMapHeightDescription),
|
|
51
|
+
},
|
|
27
52
|
with_notes: {
|
|
28
53
|
title: 'Show note',
|
|
29
54
|
type: 'boolean',
|
|
@@ -50,13 +75,8 @@ export default () => {
|
|
|
50
75
|
type: 'boolean',
|
|
51
76
|
defaultValue: true,
|
|
52
77
|
},
|
|
53
|
-
tableau_height: {
|
|
54
|
-
title: 'Height',
|
|
55
|
-
type: 'text',
|
|
56
|
-
defaultValue: '700',
|
|
57
|
-
},
|
|
58
78
|
},
|
|
59
79
|
|
|
60
|
-
required: [
|
|
80
|
+
required: [],
|
|
61
81
|
};
|
|
62
82
|
};
|
package/src/Blocks/Maps/Edit.jsx
CHANGED
|
@@ -4,12 +4,11 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import React, { Component } from 'react';
|
|
7
|
-
import { isString } from 'lodash';
|
|
7
|
+
import { isEqual, isString } from 'lodash';
|
|
8
8
|
import PropTypes from 'prop-types';
|
|
9
9
|
import { Button, Input, Message } from 'semantic-ui-react';
|
|
10
10
|
import { defineMessages, FormattedMessage, injectIntl } from 'react-intl';
|
|
11
11
|
import cx from 'classnames';
|
|
12
|
-
import { isEqual } from 'lodash';
|
|
13
12
|
import { withBlockExtensions } from '@plone/volto/helpers';
|
|
14
13
|
import { compose } from 'redux';
|
|
15
14
|
import { Icon, SidebarPortal } from '@plone/volto/components';
|
|
@@ -1,79 +1,83 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import renderer from 'react-test-renderer';
|
|
3
|
-
import configureStore from 'redux-mock-store';
|
|
4
3
|
import { Provider } from 'react-intl-redux';
|
|
5
4
|
import config from '@plone/volto/registry';
|
|
6
5
|
|
|
7
6
|
import Edit from './Edit';
|
|
8
7
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
create: {},
|
|
28
|
-
},
|
|
29
|
-
connected_data_parameters: {},
|
|
30
|
-
});
|
|
8
|
+
describe('Test Maps Block editing', () => {
|
|
9
|
+
config.blocks.blocksConfig = {
|
|
10
|
+
...config.blocks.blocksConfig,
|
|
11
|
+
maps: {
|
|
12
|
+
id: 'maps',
|
|
13
|
+
title: 'Maps',
|
|
14
|
+
group: 'media',
|
|
15
|
+
extensions: {},
|
|
16
|
+
variations: [],
|
|
17
|
+
restricted: false,
|
|
18
|
+
mostUsed: true,
|
|
19
|
+
sidebarTab: 1,
|
|
20
|
+
security: {
|
|
21
|
+
addPermission: [],
|
|
22
|
+
view: [],
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
};
|
|
31
26
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
variations: [],
|
|
40
|
-
restricted: false,
|
|
41
|
-
mostUsed: true,
|
|
42
|
-
sidebarTab: 1,
|
|
43
|
-
security: {
|
|
44
|
-
addPermission: [],
|
|
45
|
-
view: [],
|
|
27
|
+
const data = {
|
|
28
|
+
'@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>',
|
|
31
|
+
dataprotection: {
|
|
32
|
+
enabled: false,
|
|
33
|
+
privacy_statement: 'This is a privacy statement',
|
|
46
34
|
},
|
|
47
|
-
|
|
48
|
-
};
|
|
35
|
+
useVisibilitySensor: false,
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
test('test-1', () => {
|
|
39
|
+
const component = renderer.create(
|
|
40
|
+
<Provider store={global.store}>
|
|
41
|
+
<Edit
|
|
42
|
+
data={data}
|
|
43
|
+
pathname="/news"
|
|
44
|
+
selected={false}
|
|
45
|
+
block="1234"
|
|
46
|
+
index={1}
|
|
47
|
+
onChangeBlock={() => {}}
|
|
48
|
+
onSelectBlock={() => {}}
|
|
49
|
+
onDeleteBlock={() => {}}
|
|
50
|
+
onFocusPreviousBlock={() => {}}
|
|
51
|
+
onFocusNextBlock={() => {}}
|
|
52
|
+
handleKeyDown={() => {}}
|
|
53
|
+
content={{}}
|
|
54
|
+
/>
|
|
55
|
+
</Provider>,
|
|
56
|
+
);
|
|
57
|
+
const json = component.toJSON();
|
|
58
|
+
expect(json).toMatchSnapshot();
|
|
59
|
+
});
|
|
49
60
|
|
|
50
|
-
test('
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
handleKeyDown={() => {}}
|
|
73
|
-
content={{}}
|
|
74
|
-
/>
|
|
75
|
-
</Provider>,
|
|
76
|
-
);
|
|
77
|
-
const json = component.toJSON();
|
|
78
|
-
expect(json).toMatchSnapshot();
|
|
61
|
+
test('test-2', () => {
|
|
62
|
+
const component = renderer.create(
|
|
63
|
+
<Provider store={global.store}>
|
|
64
|
+
<Edit
|
|
65
|
+
data={data}
|
|
66
|
+
pathname="/news"
|
|
67
|
+
selected={true}
|
|
68
|
+
block="1234"
|
|
69
|
+
index={1}
|
|
70
|
+
onChangeBlock={() => {}}
|
|
71
|
+
onSelectBlock={() => {}}
|
|
72
|
+
onDeleteBlock={() => {}}
|
|
73
|
+
onFocusPreviousBlock={() => {}}
|
|
74
|
+
onFocusNextBlock={() => {}}
|
|
75
|
+
handleKeyDown={() => {}}
|
|
76
|
+
content={{}}
|
|
77
|
+
/>
|
|
78
|
+
</Provider>,
|
|
79
|
+
);
|
|
80
|
+
const json = component.toJSON();
|
|
81
|
+
expect(json).toMatchSnapshot();
|
|
82
|
+
});
|
|
79
83
|
});
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { BlockDataForm } from '@plone/volto/components';
|
|
3
2
|
import { useIntl, defineMessages } from 'react-intl';
|
|
3
|
+
import { Icon, BlockDataForm } from '@plone/volto/components';
|
|
4
4
|
import globeSVG from '@plone/volto/icons/globe.svg';
|
|
5
|
-
import { Icon } from '@plone/volto/components';
|
|
6
5
|
import { Segment } from 'semantic-ui-react';
|
|
7
6
|
import { addPrivacyProtectionToSchema } from '@eeacms/volto-embed';
|
|
8
7
|
import { MapsSchema } from './schema';
|
package/src/Blocks/Maps/View.jsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { render } from '@testing-library/react';
|
|
2
3
|
import renderer from 'react-test-renderer';
|
|
3
|
-
import configureStore from 'redux-mock-store';
|
|
4
4
|
import { Provider } from 'react-intl-redux';
|
|
5
5
|
import config from '@plone/volto/registry';
|
|
6
6
|
|
|
@@ -9,15 +9,6 @@ import installEmbedMaps from '.';
|
|
|
9
9
|
|
|
10
10
|
installEmbedMaps(config);
|
|
11
11
|
|
|
12
|
-
const mockStore = configureStore();
|
|
13
|
-
|
|
14
|
-
jest.mock('@plone/volto/components', () => ({
|
|
15
|
-
__esModule: true,
|
|
16
|
-
UniversalLink: ({ children, href }) => {
|
|
17
|
-
return <a href={href}>{children}</a>;
|
|
18
|
-
},
|
|
19
|
-
}));
|
|
20
|
-
|
|
21
12
|
config.blocks.blocksConfig = {
|
|
22
13
|
...config.blocks.blocksConfig,
|
|
23
14
|
maps: {
|
|
@@ -36,32 +27,65 @@ config.blocks.blocksConfig = {
|
|
|
36
27
|
},
|
|
37
28
|
};
|
|
38
29
|
|
|
39
|
-
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
30
|
+
describe('Test Maps Block rendering', () => {
|
|
31
|
+
const data = {
|
|
32
|
+
'@type': 'maps',
|
|
33
|
+
url:
|
|
34
|
+
'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',
|
|
35
|
+
useVisibilitySensor: false,
|
|
36
|
+
dataprotection: {
|
|
37
|
+
enabled: false,
|
|
44
38
|
},
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
test('test-1', () => {
|
|
42
|
+
const component = renderer.create(
|
|
43
|
+
<Provider store={global.store}>
|
|
44
|
+
<View data={data} />
|
|
45
|
+
</Provider>,
|
|
46
|
+
);
|
|
47
|
+
const json = component.toJSON();
|
|
48
|
+
expect(json).toMatchSnapshot();
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
test('test-2', () => {
|
|
52
|
+
const component = renderer.create(
|
|
53
|
+
<Provider store={global.store}>
|
|
54
|
+
<View
|
|
55
|
+
data={{
|
|
56
|
+
...data,
|
|
57
|
+
height: '100vh',
|
|
58
|
+
}}
|
|
59
|
+
/>
|
|
60
|
+
</Provider>,
|
|
61
|
+
);
|
|
62
|
+
const json = component.toJSON();
|
|
63
|
+
expect(json).toMatchSnapshot();
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
test('test-3', () => {
|
|
67
|
+
const Component = (props) => (
|
|
68
|
+
<Provider store={global.store}>
|
|
69
|
+
<View
|
|
70
|
+
data={{
|
|
71
|
+
...data,
|
|
72
|
+
dataprotection: {
|
|
73
|
+
...data.dataprotection,
|
|
74
|
+
enabled: true,
|
|
75
|
+
},
|
|
76
|
+
height: '100vh',
|
|
77
|
+
useVisibilitySensor: false,
|
|
78
|
+
}}
|
|
79
|
+
/>
|
|
80
|
+
</Provider>
|
|
81
|
+
);
|
|
82
|
+
const { container, rerender } = render(<Component />);
|
|
83
|
+
|
|
84
|
+
expect(container).toMatchSnapshot();
|
|
85
|
+
|
|
86
|
+
container.querySelector('.privacy-button button').click();
|
|
87
|
+
|
|
88
|
+
rerender(<Component />);
|
|
89
|
+
expect(container).toMatchSnapshot();
|
|
49
90
|
});
|
|
50
|
-
const component = renderer.create(
|
|
51
|
-
<Provider store={store}>
|
|
52
|
-
<View
|
|
53
|
-
data={{
|
|
54
|
-
'@type': 'maps',
|
|
55
|
-
url:
|
|
56
|
-
'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',
|
|
57
|
-
useVisibilitySensor: false,
|
|
58
|
-
dataprotection: {
|
|
59
|
-
enabled: false,
|
|
60
|
-
},
|
|
61
|
-
}}
|
|
62
|
-
/>
|
|
63
|
-
</Provider>,
|
|
64
|
-
);
|
|
65
|
-
const json = component.toJSON();
|
|
66
|
-
expect(json).toMatchSnapshot();
|
|
67
91
|
});
|