@eeacms/volto-embed 9.0.1 → 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 CHANGED
@@ -4,6 +4,14 @@ 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
+ ### [9.0.2](https://github.com/eea/volto-embed/compare/9.0.1...9.0.2) - 29 November 2023
8
+
9
+ #### :hammer_and_wrench: Others
10
+
11
+ - fix tests [Miu Razvan - [`063eed1`](https://github.com/eea/volto-embed/commit/063eed1d816b4a5c83293b5e24dacf17de967009)]
12
+ - update [Miu Razvan - [`7c9452f`](https://github.com/eea/volto-embed/commit/7c9452f1851a26de2ad5d57c80475bb362065782)]
13
+ - add locales [Miu Razvan - [`d79cb48`](https://github.com/eea/volto-embed/commit/d79cb48005e5e14dbb663f5438c0ecbd53ac0502)]
14
+ - update tests [Miu Razvan - [`976d26f`](https://github.com/eea/volto-embed/commit/976d26fa8df5e5f06394904f6f3dfaef2e3a4b10)]
7
15
  ### [9.0.1](https://github.com/eea/volto-embed/compare/9.0.0...9.0.1) - 24 November 2023
8
16
 
9
17
  #### :hammer_and_wrench: Others
package/cypress.config.js CHANGED
@@ -1,36 +1,27 @@
1
- const { defineConfig } = require("cypress");
1
+ const { defineConfig } = require('cypress');
2
2
 
3
3
  module.exports = defineConfig({
4
4
  viewportWidth: 1280,
5
5
  defaultCommandTimeout: 8888,
6
6
  chromeWebSecurity: false,
7
- reporter: "junit",
7
+ reporter: 'junit',
8
8
  video: false,
9
-
10
9
  retries: {
11
10
  runMode: 2,
12
11
  openMode: 0,
13
12
  },
14
-
15
13
  reporterOptions: {
16
- mochaFile: "cypress/reports/cypress-[hash].xml",
14
+ mochaFile: 'cypress/reports/cypress-[hash].xml',
17
15
  jenkinsMode: true,
18
16
  toConsole: true,
19
17
  },
20
-
21
18
  e2e: {
22
19
  setupNodeEvents(on, config) {
23
20
  // e2e testing node events setup code
24
- require("@cypress/code-coverage/task")(on, config);
21
+ require('@cypress/code-coverage/task')(on, config);
22
+ require('cypress-fail-fast/plugin')(on, config);
25
23
  return config;
26
24
  },
27
- baseUrl: "http://localhost:3000",
28
- },
29
-
30
- component: {
31
- devServer: {
32
- framework: "react",
33
- bundler: "webpack",
34
- },
25
+ baseUrl: 'http://localhost:3000',
35
26
  },
36
27
  });
@@ -36,4 +36,7 @@ module.exports = {
36
36
  statements: 5,
37
37
  },
38
38
  },
39
+ setupFilesAfterEnv: [
40
+ '<rootDir>/node_modules/@eeacms/volto-embed/jest.setup.js',
41
+ ],
39
42
  };
package/jest.setup.js ADDED
@@ -0,0 +1,77 @@
1
+ import { jest } from '@jest/globals';
2
+ import configureStore from 'redux-mock-store';
3
+
4
+ const mockStore = configureStore();
5
+
6
+ global.store = mockStore({
7
+ intl: {
8
+ locale: 'en',
9
+ messages: {},
10
+ },
11
+ content: {
12
+ create: {},
13
+ subrequests: [],
14
+ },
15
+ connected_data_parameters: {},
16
+ });
17
+
18
+ const mockSemanticComponents = jest.requireActual('semantic-ui-react');
19
+ const mockComponents = jest.requireActual('@plone/volto/components');
20
+
21
+ jest.mock('semantic-ui-react', () => ({
22
+ ...mockSemanticComponents,
23
+ Popup: ({ content, trigger }) => {
24
+ return (
25
+ <div className="popup">
26
+ <div className="trigger">{trigger}</div>
27
+ <div className="content">{content}</div>
28
+ </div>
29
+ );
30
+ },
31
+ }));
32
+
33
+ jest.doMock('@plone/volto/components', () => {
34
+ return {
35
+ __esModule: true,
36
+ ...mockComponents,
37
+ Toast: ({ children }) => <div className="toast">{children}</div>,
38
+ SidebarPortal: ({ children }) => <div id="sidebar">{children}</div>,
39
+ UniversalLink: ({ children, href }) => {
40
+ return <a href={href}>{children}</a>;
41
+ },
42
+ };
43
+ });
44
+
45
+ jest.doMock('@plone/volto-slate/editor/render', () => ({
46
+ __esModule: true,
47
+ serializeNodes: (nodes) => {
48
+ return nodes.map((node, index) => {
49
+ const Tag = node.type || 'p';
50
+ return (
51
+ <Tag key={`node-${index}`}>
52
+ {node.children.map((item, index) => (
53
+ <span key={`item-${index}`}>{item.text}</span>
54
+ ))}
55
+ </Tag>
56
+ );
57
+ });
58
+ },
59
+ serializeNodesToText: (nodes) => {
60
+ return nodes
61
+ .reduce((texts, node) => {
62
+ if (node.children) {
63
+ node.children.forEach((item) => {
64
+ texts.push(item.text);
65
+ });
66
+ }
67
+ return texts;
68
+ }, [])
69
+ .join('');
70
+ },
71
+ }));
72
+
73
+ global.fetch = jest.fn(() =>
74
+ Promise.resolve({
75
+ json: () => Promise.resolve({}),
76
+ }),
77
+ );
@@ -12,7 +12,18 @@ msgstr ""
12
12
  "Plural-Forms: \n"
13
13
 
14
14
  #: Blocks/Maps/schema
15
- # defaultMessage: undefined
15
+ # defaultMessage: Alignment
16
+ msgid "Alignment"
17
+ msgstr ""
18
+
19
+ #: Blocks/Maps/schema
20
+ # defaultMessage: Alt text
21
+ msgid "Alt text"
22
+ msgstr ""
23
+
24
+ #: Blocks/EmbedMaps/schema
25
+ #: Blocks/Maps/schema
26
+ # defaultMessage: CSS height
16
27
  msgid "CSS height"
17
28
  msgstr ""
18
29
 
@@ -34,6 +45,7 @@ msgid "Embeded Google Maps"
34
45
  msgstr ""
35
46
 
36
47
  #: Blocks/Maps/Edit
48
+ #: Widgets/MapsWidget
37
49
  # defaultMessage: Enter map Embed Code
38
50
  msgid "Enter map Embed Code"
39
51
  msgstr ""
@@ -48,11 +60,6 @@ msgstr ""
48
60
  msgid "Google Maps Embedded Block"
49
61
  msgstr ""
50
62
 
51
- #: Blocks/Maps/schema
52
- # defaultMessage: undefined
53
- msgid "Iframe height"
54
- msgstr ""
55
-
56
63
  #: Blocks/Maps/Edit
57
64
  # defaultMessage: Left
58
65
  msgid "Left"
@@ -63,11 +70,23 @@ msgstr ""
63
70
  msgid "Live image generated"
64
71
  msgstr ""
65
72
 
73
+ #: Blocks/EmbedMaps/schema
74
+ #: Blocks/Maps/schema
75
+ # defaultMessage: Map height
76
+ msgid "Map height"
77
+ msgstr ""
78
+
66
79
  #: Blocks/Maps/MapsSidebar
80
+ #: Blocks/Maps/schema
67
81
  # defaultMessage: Maps
68
82
  msgid "Maps"
69
83
  msgstr ""
70
84
 
85
+ #: Blocks/Maps/schema
86
+ # defaultMessage: Maps URL
87
+ msgid "Maps URL"
88
+ msgstr ""
89
+
71
90
  #: Blocks/Maps/MapsSidebar
72
91
  # defaultMessage: No map selected
73
92
  msgid "No map selected"
@@ -12,7 +12,18 @@ msgstr ""
12
12
  "Plural-Forms: \n"
13
13
 
14
14
  #: Blocks/Maps/schema
15
- # defaultMessage: undefined
15
+ # defaultMessage: Alignment
16
+ msgid "Alignment"
17
+ msgstr ""
18
+
19
+ #: Blocks/Maps/schema
20
+ # defaultMessage: Alt text
21
+ msgid "Alt text"
22
+ msgstr ""
23
+
24
+ #: Blocks/EmbedMaps/schema
25
+ #: Blocks/Maps/schema
26
+ # defaultMessage: CSS height
16
27
  msgid "CSS height"
17
28
  msgstr ""
18
29
 
@@ -34,6 +45,7 @@ msgid "Embeded Google Maps"
34
45
  msgstr ""
35
46
 
36
47
  #: Blocks/Maps/Edit
48
+ #: Widgets/MapsWidget
37
49
  # defaultMessage: Enter map Embed Code
38
50
  msgid "Enter map Embed Code"
39
51
  msgstr ""
@@ -48,11 +60,6 @@ msgstr ""
48
60
  msgid "Google Maps Embedded Block"
49
61
  msgstr ""
50
62
 
51
- #: Blocks/Maps/schema
52
- # defaultMessage: undefined
53
- msgid "Iframe height"
54
- msgstr ""
55
-
56
63
  #: Blocks/Maps/Edit
57
64
  # defaultMessage: Left
58
65
  msgid "Left"
@@ -63,11 +70,23 @@ msgstr ""
63
70
  msgid "Live image generated"
64
71
  msgstr ""
65
72
 
73
+ #: Blocks/EmbedMaps/schema
74
+ #: Blocks/Maps/schema
75
+ # defaultMessage: Map height
76
+ msgid "Map height"
77
+ msgstr ""
78
+
66
79
  #: Blocks/Maps/MapsSidebar
80
+ #: Blocks/Maps/schema
67
81
  # defaultMessage: Maps
68
82
  msgid "Maps"
69
83
  msgstr ""
70
84
 
85
+ #: Blocks/Maps/schema
86
+ # defaultMessage: Maps URL
87
+ msgid "Maps URL"
88
+ msgstr ""
89
+
71
90
  #: Blocks/Maps/MapsSidebar
72
91
  # defaultMessage: No map selected
73
92
  msgid "No map selected"
@@ -12,7 +12,18 @@ msgstr ""
12
12
  "Plural-Forms: \n"
13
13
 
14
14
  #: Blocks/Maps/schema
15
- # defaultMessage: undefined
15
+ # defaultMessage: Alignment
16
+ msgid "Alignment"
17
+ msgstr ""
18
+
19
+ #: Blocks/Maps/schema
20
+ # defaultMessage: Alt text
21
+ msgid "Alt text"
22
+ msgstr ""
23
+
24
+ #: Blocks/EmbedMaps/schema
25
+ #: Blocks/Maps/schema
26
+ # defaultMessage: CSS height
16
27
  msgid "CSS height"
17
28
  msgstr ""
18
29
 
@@ -34,6 +45,7 @@ msgid "Embeded Google Maps"
34
45
  msgstr ""
35
46
 
36
47
  #: Blocks/Maps/Edit
48
+ #: Widgets/MapsWidget
37
49
  # defaultMessage: Enter map Embed Code
38
50
  msgid "Enter map Embed Code"
39
51
  msgstr ""
@@ -48,11 +60,6 @@ msgstr ""
48
60
  msgid "Google Maps Embedded Block"
49
61
  msgstr ""
50
62
 
51
- #: Blocks/Maps/schema
52
- # defaultMessage: undefined
53
- msgid "Iframe height"
54
- msgstr ""
55
-
56
63
  #: Blocks/Maps/Edit
57
64
  # defaultMessage: Left
58
65
  msgid "Left"
@@ -63,11 +70,23 @@ msgstr ""
63
70
  msgid "Live image generated"
64
71
  msgstr ""
65
72
 
73
+ #: Blocks/EmbedMaps/schema
74
+ #: Blocks/Maps/schema
75
+ # defaultMessage: Map height
76
+ msgid "Map height"
77
+ msgstr ""
78
+
66
79
  #: Blocks/Maps/MapsSidebar
80
+ #: Blocks/Maps/schema
67
81
  # defaultMessage: Maps
68
82
  msgid "Maps"
69
83
  msgstr ""
70
84
 
85
+ #: Blocks/Maps/schema
86
+ # defaultMessage: Maps URL
87
+ msgid "Maps URL"
88
+ msgstr ""
89
+
71
90
  #: Blocks/Maps/MapsSidebar
72
91
  # defaultMessage: No map selected
73
92
  msgid "No map selected"
@@ -12,7 +12,18 @@ msgstr ""
12
12
  "Plural-Forms: \n"
13
13
 
14
14
  #: Blocks/Maps/schema
15
- # defaultMessage: undefined
15
+ # defaultMessage: Alignment
16
+ msgid "Alignment"
17
+ msgstr ""
18
+
19
+ #: Blocks/Maps/schema
20
+ # defaultMessage: Alt text
21
+ msgid "Alt text"
22
+ msgstr ""
23
+
24
+ #: Blocks/EmbedMaps/schema
25
+ #: Blocks/Maps/schema
26
+ # defaultMessage: CSS height
16
27
  msgid "CSS height"
17
28
  msgstr ""
18
29
 
@@ -34,6 +45,7 @@ msgid "Embeded Google Maps"
34
45
  msgstr ""
35
46
 
36
47
  #: Blocks/Maps/Edit
48
+ #: Widgets/MapsWidget
37
49
  # defaultMessage: Enter map Embed Code
38
50
  msgid "Enter map Embed Code"
39
51
  msgstr ""
@@ -48,11 +60,6 @@ msgstr ""
48
60
  msgid "Google Maps Embedded Block"
49
61
  msgstr ""
50
62
 
51
- #: Blocks/Maps/schema
52
- # defaultMessage: undefined
53
- msgid "Iframe height"
54
- msgstr ""
55
-
56
63
  #: Blocks/Maps/Edit
57
64
  # defaultMessage: Left
58
65
  msgid "Left"
@@ -63,11 +70,23 @@ msgstr ""
63
70
  msgid "Live image generated"
64
71
  msgstr ""
65
72
 
73
+ #: Blocks/EmbedMaps/schema
74
+ #: Blocks/Maps/schema
75
+ # defaultMessage: Map height
76
+ msgid "Map height"
77
+ msgstr ""
78
+
66
79
  #: Blocks/Maps/MapsSidebar
80
+ #: Blocks/Maps/schema
67
81
  # defaultMessage: Maps
68
82
  msgid "Maps"
69
83
  msgstr ""
70
84
 
85
+ #: Blocks/Maps/schema
86
+ # defaultMessage: Maps URL
87
+ msgid "Maps URL"
88
+ msgstr ""
89
+
71
90
  #: Blocks/Maps/MapsSidebar
72
91
  # defaultMessage: No map selected
73
92
  msgid "No map selected"
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-24T12:50:06.731Z\n"
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"
@@ -14,7 +14,18 @@ msgstr ""
14
14
  "Domain: volto\n"
15
15
 
16
16
  #: Blocks/Maps/schema
17
- # defaultMessage: undefined
17
+ # defaultMessage: Alignment
18
+ msgid "Alignment"
19
+ msgstr ""
20
+
21
+ #: Blocks/Maps/schema
22
+ # defaultMessage: Alt text
23
+ msgid "Alt text"
24
+ msgstr ""
25
+
26
+ #: Blocks/EmbedMaps/schema
27
+ #: Blocks/Maps/schema
28
+ # defaultMessage: CSS height
18
29
  msgid "CSS height"
19
30
  msgstr ""
20
31
 
@@ -36,6 +47,7 @@ msgid "Embeded Google Maps"
36
47
  msgstr ""
37
48
 
38
49
  #: Blocks/Maps/Edit
50
+ #: Widgets/MapsWidget
39
51
  # defaultMessage: Enter map Embed Code
40
52
  msgid "Enter map Embed Code"
41
53
  msgstr ""
@@ -50,11 +62,6 @@ msgstr ""
50
62
  msgid "Google Maps Embedded Block"
51
63
  msgstr ""
52
64
 
53
- #: Blocks/Maps/schema
54
- # defaultMessage: undefined
55
- msgid "Iframe height"
56
- msgstr ""
57
-
58
65
  #: Blocks/Maps/Edit
59
66
  # defaultMessage: Left
60
67
  msgid "Left"
@@ -65,11 +72,23 @@ msgstr ""
65
72
  msgid "Live image generated"
66
73
  msgstr ""
67
74
 
75
+ #: Blocks/EmbedMaps/schema
76
+ #: Blocks/Maps/schema
77
+ # defaultMessage: Map height
78
+ msgid "Map height"
79
+ msgstr ""
80
+
68
81
  #: Blocks/Maps/MapsSidebar
82
+ #: Blocks/Maps/schema
69
83
  # defaultMessage: Maps
70
84
  msgid "Maps"
71
85
  msgstr ""
72
86
 
87
+ #: Blocks/Maps/schema
88
+ # defaultMessage: Maps URL
89
+ msgid "Maps URL"
90
+ msgstr ""
91
+
73
92
  #: Blocks/Maps/MapsSidebar
74
93
  # defaultMessage: No map selected
75
94
  msgid "No map selected"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-embed",
3
- "version": "9.0.1",
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={props.selected}>
16
+ <SidebarPortal selected={selected}>
14
17
  <BlockDataForm
15
- block={props.block}
18
+ block={block}
16
19
  schema={schema}
17
20
  title={schema.title}
18
21
  onChangeField={(id, value) => {
19
- props.onChangeBlock(props.block, {
20
- ...props.data,
22
+ onChangeBlock(block, {
23
+ ...data,
21
24
  [id]: value,
22
25
  });
23
26
  }}
24
- formData={props.data}
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={false}
36
+ selected={true}
61
37
  block="1234"
62
38
  index={1}
63
39
  onChangeBlock={() => {}}
@@ -51,6 +51,7 @@ function View(props) {
51
51
  data={{
52
52
  ...maps,
53
53
  useVisibilitySensor,
54
+ height: props.data.height || maps.height,
54
55
  with_notes,
55
56
  with_sources,
56
57
  with_more_info,
@@ -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={{
@@ -8,7 +8,7 @@ const applyConfig = (config) => {
8
8
  id: 'embed_maps',
9
9
  title: 'Embed interactive Map',
10
10
  icon: sliderSVG,
11
- group: 'common',
11
+ group: 'data_visualizations',
12
12
  edit: EmbedMap,
13
13
  view: EmbedView,
14
14
  restricted: false,