@eeacms/volto-embed 9.0.1 → 9.0.3
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 +30 -0
- 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 +25 -6
- package/locales/en/LC_MESSAGES/volto.po +25 -6
- package/locales/it/LC_MESSAGES/volto.po +25 -6
- package/locales/ro/LC_MESSAGES/volto.po +25 -6
- package/locales/volto.pot +26 -7
- package/package.json +4 -3
- 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 +1 -1
- 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 +12 -3
- package/src/EmbedMap/EmbedMap.test.js +1 -21
- package/src/PrivacyProtection/PrivacyProtection.jsx +3 -2
- package/src/Toolbar/Toolbar.test.js +1 -49
- package/src/Views/MapView.test.js +1 -21
- package/src/Widgets/MapsWidget.jsx +11 -2
|
@@ -1,48 +1,10 @@
|
|
|
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 { Enlarge, FigureNote, MoreInfo, Share, Sources } from '.';
|
|
8
7
|
|
|
9
|
-
const mockStore = configureStore();
|
|
10
|
-
|
|
11
|
-
jest.mock('@plone/volto/components', () => ({
|
|
12
|
-
__esModule: true,
|
|
13
|
-
UniversalLink: ({ children, href }) => {
|
|
14
|
-
return <a href={href}>{children}</a>;
|
|
15
|
-
},
|
|
16
|
-
}));
|
|
17
|
-
|
|
18
|
-
jest.mock('@plone/volto-slate/editor/render', () => ({
|
|
19
|
-
__esModule: true,
|
|
20
|
-
serializeNodes: (nodes) => {
|
|
21
|
-
return nodes.map((node, index) => {
|
|
22
|
-
const Tag = node.type;
|
|
23
|
-
return (
|
|
24
|
-
<Tag key={`node-${index}`}>
|
|
25
|
-
{node.children.map((item, index) => (
|
|
26
|
-
<span key={`item-${index}`}>{item.text}</span>
|
|
27
|
-
))}
|
|
28
|
-
</Tag>
|
|
29
|
-
);
|
|
30
|
-
});
|
|
31
|
-
},
|
|
32
|
-
serializeNodesToText: (nodes) => {
|
|
33
|
-
return nodes
|
|
34
|
-
.reduce((texts, node) => {
|
|
35
|
-
if (node.children) {
|
|
36
|
-
node.children.forEach((item) => {
|
|
37
|
-
texts.push(item.text);
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
return texts;
|
|
41
|
-
}, [])
|
|
42
|
-
.join('');
|
|
43
|
-
},
|
|
44
|
-
}));
|
|
45
|
-
|
|
46
8
|
config.blocks.blocksConfig = {
|
|
47
9
|
...config.blocks.blocksConfig,
|
|
48
10
|
maps: {
|
|
@@ -62,18 +24,8 @@ config.blocks.blocksConfig = {
|
|
|
62
24
|
};
|
|
63
25
|
|
|
64
26
|
test('renders toolbar components', () => {
|
|
65
|
-
const store = mockStore({
|
|
66
|
-
intl: {
|
|
67
|
-
locale: 'en',
|
|
68
|
-
messages: {},
|
|
69
|
-
},
|
|
70
|
-
content: {
|
|
71
|
-
create: {},
|
|
72
|
-
},
|
|
73
|
-
connected_data_parameters: {},
|
|
74
|
-
});
|
|
75
27
|
const component = renderer.create(
|
|
76
|
-
<Provider store={store}>
|
|
28
|
+
<Provider store={global.store}>
|
|
77
29
|
<div className="visualization-toolbar">
|
|
78
30
|
<div className="left-col">
|
|
79
31
|
<FigureNote
|
|
@@ -1,20 +1,10 @@
|
|
|
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 MapView from './MapView';
|
|
8
7
|
|
|
9
|
-
const mockStore = configureStore();
|
|
10
|
-
|
|
11
|
-
jest.mock('@plone/volto/components', () => ({
|
|
12
|
-
__esModule: true,
|
|
13
|
-
UniversalLink: ({ children, href }) => {
|
|
14
|
-
return <a href={href}>{children}</a>;
|
|
15
|
-
},
|
|
16
|
-
}));
|
|
17
|
-
|
|
18
8
|
config.blocks.blocksConfig = {
|
|
19
9
|
...config.blocks.blocksConfig,
|
|
20
10
|
maps: {
|
|
@@ -34,18 +24,8 @@ config.blocks.blocksConfig = {
|
|
|
34
24
|
};
|
|
35
25
|
|
|
36
26
|
test('renders map component', () => {
|
|
37
|
-
const store = mockStore({
|
|
38
|
-
intl: {
|
|
39
|
-
locale: 'en',
|
|
40
|
-
messages: {},
|
|
41
|
-
},
|
|
42
|
-
content: {
|
|
43
|
-
create: {},
|
|
44
|
-
},
|
|
45
|
-
connected_data_parameters: {},
|
|
46
|
-
});
|
|
47
27
|
const component = renderer.create(
|
|
48
|
-
<Provider store={store}>
|
|
28
|
+
<Provider store={global.store}>
|
|
49
29
|
<MapView
|
|
50
30
|
content={{
|
|
51
31
|
maps: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useMemo, useState } from 'react';
|
|
2
|
-
import { useIntl, FormattedMessage } from 'react-intl';
|
|
2
|
+
import { useIntl, FormattedMessage, defineMessages } from 'react-intl';
|
|
3
3
|
import { Icon } from '@plone/volto/components';
|
|
4
4
|
import { Button, Modal, Grid, Label, Input, Message } from 'semantic-ui-react';
|
|
5
5
|
import { map } from 'lodash';
|
|
@@ -12,6 +12,13 @@ import clearSVG from '@plone/volto/icons/clear.svg';
|
|
|
12
12
|
import aheadSVG from '@plone/volto/icons/ahead.svg';
|
|
13
13
|
import mapsBlockSVG from '@plone/volto/components/manage/Blocks/Maps/block-maps.svg';
|
|
14
14
|
|
|
15
|
+
const messages = defineMessages({
|
|
16
|
+
MapsBlockInputPlaceholder: {
|
|
17
|
+
id: 'Enter map Embed Code',
|
|
18
|
+
defaultMessage: 'Enter map Embed Code',
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
|
|
15
22
|
function MapEditorModal({ id, onClose, onChange, ...rest }) {
|
|
16
23
|
const intl = useIntl();
|
|
17
24
|
const [value, setValue] = useState(rest.value);
|
|
@@ -24,7 +31,9 @@ function MapEditorModal({ id, onClose, onChange, ...rest }) {
|
|
|
24
31
|
);
|
|
25
32
|
|
|
26
33
|
const placeholder = useMemo(
|
|
27
|
-
() =>
|
|
34
|
+
() =>
|
|
35
|
+
value.placeholder ||
|
|
36
|
+
intl.formatMessage(messages.MapsBlockInputPlaceholder),
|
|
28
37
|
[value.placeholder, intl],
|
|
29
38
|
);
|
|
30
39
|
|