@eeacms/volto-tableau 7.0.0 → 7.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,7 +4,22 @@ 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
- ### [7.0.0](https://github.com/eea/volto-tableau/compare/6.0.6...7.0.0) - 23 November 2023
7
+ ### [7.0.2](https://github.com/eea/volto-tableau/compare/7.0.1...7.0.2) - 28 November 2023
8
+
9
+ #### :bug: Bug Fixes
10
+
11
+ - fix: fix error on missing value [kreafox - [`a19cf71`](https://github.com/eea/volto-tableau/commit/a19cf715a20b5b499436b98e09efdbc67ae9698b)]
12
+ - fix: pass static parameters to tableau in widget view [kreafox - [`88a1911`](https://github.com/eea/volto-tableau/commit/88a191179be1074688924389fd4303aa3ace4c2f)]
13
+
14
+ #### :hammer_and_wrench: Others
15
+
16
+ - test: update tests [kreafox - [`7daa993`](https://github.com/eea/volto-tableau/commit/7daa9935518d16f0b609dc382ec220dbcb0253c2)]
17
+ ### [7.0.1](https://github.com/eea/volto-tableau/compare/7.0.0...7.0.1) - 24 November 2023
18
+
19
+ #### :hammer_and_wrench: Others
20
+
21
+ - update [Miu Razvan - [`e274b41`](https://github.com/eea/volto-tableau/commit/e274b416f65b446f0e2453e9f0ed6f4cdd27a3f6)]
22
+ ## [7.0.0](https://github.com/eea/volto-tableau/compare/6.0.6...7.0.0) - 23 November 2023
8
23
 
9
24
  #### :bug: Bug Fixes
10
25
 
@@ -25,12 +40,14 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
25
40
  - test [Dobricean Ioan Dorian - [`48505ca`](https://github.com/eea/volto-tableau/commit/48505caef84d12091035fdd79cf64067e7f819e2)]
26
41
  - split the view and edit [Dobricean Ioan Dorian - [`7227bb1`](https://github.com/eea/volto-tableau/commit/7227bb1fb70e5d895f15872ed6533e089be99836)]
27
42
  - update embed tableau so it can work with serialized data [Dobricean Ioan Dorian - [`59d958c`](https://github.com/eea/volto-tableau/commit/59d958c7a1a5055ea62e04abcbf34ee93f52e23a)]
43
+ - test: [JENKINS] Use java17 for sonarqube scanner [valentinab25 - [`c452d70`](https://github.com/eea/volto-tableau/commit/c452d704819fb485e3cd3b39c2501361d20e8559)]
28
44
  ### [6.0.6](https://github.com/eea/volto-tableau/compare/6.0.5...6.0.6) - 17 November 2023
29
45
 
30
46
  #### :hammer_and_wrench: Others
31
47
 
32
48
  - tests: add cypress for tableau [nileshgulia1 - [`6eca683`](https://github.com/eea/volto-tableau/commit/6eca6834b85cdab4ed82367fee32fdbbb35b0f5e)]
33
49
  - tests: update unit tests [nileshgulia1 - [`96cae09`](https://github.com/eea/volto-tableau/commit/96cae09eab2e737f032c97eb401a3efa88e68ec6)]
50
+ - test: [JENKINS] Run cypress in started frontend container [valentinab25 - [`c7e81cb`](https://github.com/eea/volto-tableau/commit/c7e81cb0768f755dd4107a4998253d9bccc33809)]
34
51
  - comment test [Miu Razvan - [`a459525`](https://github.com/eea/volto-tableau/commit/a459525fdccf8ee61651d4cb2e04eb253e841c61)]
35
52
  ### [6.0.5](https://github.com/eea/volto-tableau/compare/6.0.4...6.0.5) - 15 November 2023
36
53
 
@@ -57,6 +74,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
57
74
 
58
75
  #### :house: Internal changes
59
76
 
77
+ - chore: [JENKINS] Refactor automated testing [valentinab25 - [`903b90a`](https://github.com/eea/volto-tableau/commit/903b90a2df0abc183aa68d99a89bb688de3a0c73)]
60
78
 
61
79
  #### :hammer_and_wrench: Others
62
80
 
@@ -66,6 +84,9 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
66
84
  - tests: increase coverage [kreafox - [`ecb9262`](https://github.com/eea/volto-tableau/commit/ecb92625a44365faf4c39f0ff3f02ccc4ca21656)]
67
85
  - Fix tableau height [kreafox - [`6194c24`](https://github.com/eea/volto-tableau/commit/6194c2405e2bd93aba9865caed76292cd55193d3)]
68
86
  - Show share & download button on widget view [kreafox - [`a66e253`](https://github.com/eea/volto-tableau/commit/a66e2537d08dc7129e249c28e1daa27246c88815)]
87
+ - test: [JENKINS] Add cpu limit on cypress docker [valentinab25 - [`9d2189d`](https://github.com/eea/volto-tableau/commit/9d2189d4edb13dd449d75cd6dd9052bbed67304d)]
88
+ - test: [JENKINS] Increase shm-size to cypress docker [valentinab25 - [`f2fa3f9`](https://github.com/eea/volto-tableau/commit/f2fa3f9ccabab918586179ac16ead44e2eba8498)]
89
+ - test: [JENKINS] Improve cypress time [valentinab25 - [`5748183`](https://github.com/eea/volto-tableau/commit/5748183c27dae18a4ebbc067d659cbc24cad8f71)]
69
90
  - use toolbar from volto-embed [Miu Razvan - [`1a232a1`](https://github.com/eea/volto-tableau/commit/1a232a15f2bbe05da75307800590d0a0a1c4996b)]
70
91
  ## [6.0.0](https://github.com/eea/volto-tableau/compare/5.0.2...6.0.0) - 30 October 2023
71
92
 
@@ -123,6 +144,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
123
144
  - test: change volto version in Jenkinsfile [ana-oprea - [`347aceb`](https://github.com/eea/volto-tableau/commit/347aceb07d152fddeebbf3a7e7a6ac9c55dc21ba)]
124
145
  - test: increase cypress timeout [ana-oprea - [`bdf4408`](https://github.com/eea/volto-tableau/commit/bdf44083cd84c96b4914d3f8a3bb17c5187f191c)]
125
146
  - test: EN locales, pre-commit fix, feature PRs checks Refs #257193 [valentinab25 - [`caff974`](https://github.com/eea/volto-tableau/commit/caff9742a703b224133a8dd2a969629e70c9fd33)]
147
+ - test: Fix eslint and yarn i18n [Alin Voinea - [`b8be7fb`](https://github.com/eea/volto-tableau/commit/b8be7fb9ab10faed0a1be8ce7e3d4e7c78ebe020)]
126
148
  - i18n: Add en [Alin Voinea - [`c5e20dd`](https://github.com/eea/volto-tableau/commit/c5e20ddea25c830ac80665ee9a71e557e8cd117d)]
127
149
  - test: Update Makefile and docker-compose to align it with Jenkinsfile [valentinab25 - [`2116ff9`](https://github.com/eea/volto-tableau/commit/2116ff95c6454e813bdca44e6c3aa81fa0a916b8)]
128
150
  ## [5.0.0](https://github.com/eea/volto-tableau/compare/4.1.1...5.0.0) - 25 July 2023
@@ -134,17 +156,21 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
134
156
  #### :hammer_and_wrench: Others
135
157
 
136
158
  - Release 5.0.0 [Alin Voinea - [`97c98e9`](https://github.com/eea/volto-tableau/commit/97c98e98b1295a4ad45756326dc20cd59517515f)]
159
+ - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`2acb3a5`](https://github.com/eea/volto-tableau/commit/2acb3a5490f62ce0a95ebbd03c32874ac3a42603)]
137
160
  ### [4.1.1](https://github.com/eea/volto-tableau/compare/4.1.0...4.1.1) - 21 July 2023
138
161
 
139
162
  #### :hammer_and_wrench: Others
140
163
 
141
164
  - Add VisualizationViewWidget [Tiberiu Ichim - [`fa881cb`](https://github.com/eea/volto-tableau/commit/fa881cbc3643a46697fb16d1c86ada1d4121a46a)]
165
+ - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`cbcbad2`](https://github.com/eea/volto-tableau/commit/cbcbad26f7aa3683122199c8d5cbd142903df93b)]
166
+ - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`51abe6d`](https://github.com/eea/volto-tableau/commit/51abe6d4db80825fe2e396e04c7003c6ad79b480)]
142
167
  ### [4.1.0](https://github.com/eea/volto-tableau/compare/4.0.0...4.1.0) - 15 June 2023
143
168
 
144
169
  ## [4.0.0](https://github.com/eea/volto-tableau/compare/3.0.8...4.0.0) - 13 June 2023
145
170
 
146
171
  #### :house: Internal changes
147
172
 
173
+ - chore: [JENKINS] Remove alpha testing version [valentinab25 - [`e33bb21`](https://github.com/eea/volto-tableau/commit/e33bb21eb429c33e3a15d771487a1c9af8ccb0d5)]
148
174
 
149
175
  #### :hammer_and_wrench: Others
150
176
 
@@ -176,6 +202,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
176
202
 
177
203
  #### :hammer_and_wrench: Others
178
204
 
205
+ - Add Sonarqube tag using industry-frontend addons list [EEA Jenkins - [`f5deccd`](https://github.com/eea/volto-tableau/commit/f5deccd84372752908b300c5cfd78134818e5ce4)]
179
206
  ### [3.0.6](https://github.com/eea/volto-tableau/compare/3.0.5...3.0.6) - 30 January 2023
180
207
 
181
208
  ### [3.0.5](https://github.com/eea/volto-tableau/compare/3.0.4...3.0.5) - 26 January 2023
@@ -247,6 +274,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
247
274
  - Update commands.js [Nilesh - [`7c48437`](https://github.com/eea/volto-tableau/commit/7c4843780efb9b85a4728de73c00d831c1d8fdcf)]
248
275
  - Update e2e.js [Nilesh - [`f67b45c`](https://github.com/eea/volto-tableau/commit/f67b45c170f58f8d0301192994226f173e4cb00a)]
249
276
  - latest volto compatibility refs #154757 [nileshgulia1 - [`881ba48`](https://github.com/eea/volto-tableau/commit/881ba482dc9b82e7fdac16549d41e80a6d26b3de)]
277
+ - Add Sonarqube tag using marine-frontend addons list [EEA Jenkins - [`58e25df`](https://github.com/eea/volto-tableau/commit/58e25df2291add09670143bee54cde103ee835b9)]
250
278
  ### [1.3.0](https://github.com/eea/volto-tableau/compare/1.2.5...1.3.0) - 28 September 2022
251
279
 
252
280
  #### :hammer_and_wrench: Others
@@ -260,11 +288,15 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
260
288
  - Use volto 16 alpha 14 [Miu Razvan - [`93641be`](https://github.com/eea/volto-tableau/commit/93641be4c2393f49008aff789400cf7c947949fd)]
261
289
  - Revert volto-tableau group to common [Andrei Grigore - [`9d24c6d`](https://github.com/eea/volto-tableau/commit/9d24c6d2767fed6a840cddaee55dbd5cecb544b5)]
262
290
  - Tableaugroup typo fix [Andrei Grigore - [`b0b5378`](https://github.com/eea/volto-tableau/commit/b0b5378a437043120a96c9e5e8802584145daa22)]
291
+ - Add Sonarqube tag using freshwater-frontend addons list [EEA Jenkins - [`3234347`](https://github.com/eea/volto-tableau/commit/3234347e524cc0ed4918242f503fe9e7dba266b2)]
263
292
  - Refs #142010 - Optimize Volto-addons gitflow pipelines [valentinab25 - [`d237e1c`](https://github.com/eea/volto-tableau/commit/d237e1c72817d7e68a3eb698563674d1514db24f)]
264
293
  ### [1.2.4](https://github.com/eea/volto-tableau/compare/1.2.3...1.2.4) - 25 October 2021
265
294
 
266
295
  #### :hammer_and_wrench: Others
267
296
 
297
+ - Add Sonarqube tag using frontend addons list [EEA Jenkins - [`2b19679`](https://github.com/eea/volto-tableau/commit/2b19679e2c7bcdc83082d1c73a595eea8b86d14f)]
298
+ - Add Sonarqube tag using frontend addons list [EEA Jenkins - [`384ccae`](https://github.com/eea/volto-tableau/commit/384ccaebed8c414a5c90eb96c6ce0a2b091f249c)]
299
+ - Add Sonarqube tag using frontend addons list [EEA Jenkins - [`589258e`](https://github.com/eea/volto-tableau/commit/589258e9b3cbba9cee37c57bb85ca5b707bc65d7)]
268
300
  ### [1.2.3](https://github.com/eea/volto-tableau/compare/1.2.2...1.2.3) - 14 June 2021
269
301
 
270
302
  #### :hammer_and_wrench: Others
package/Jenkinsfile CHANGED
@@ -248,33 +248,33 @@ pipeline {
248
248
  }
249
249
  }
250
250
 
251
- stage('SonarQube compare to master') {
252
- when {
253
- anyOf {
254
- allOf {
255
- not { environment name: 'CHANGE_ID', value: '' }
256
- environment name: 'CHANGE_TARGET', value: 'develop'
257
- }
258
- allOf {
259
- environment name: 'CHANGE_ID', value: ''
260
- branch 'develop'
261
- not { changelog '.*^Automated release [0-9\\.]+$' }
262
- }
263
- }
264
- }
265
- steps {
266
- script {
267
- sh '''echo "Error" > checkresult.txt'''
268
- catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
269
- sh '''set -o pipefail; docker run -i --rm --pull always --name="$IMAGE_NAME-gitflow-sn" -e GIT_BRANCH="$BRANCH_NAME" -e GIT_NAME="$GIT_NAME" eeacms/gitflow /checkSonarqubemaster.sh | grep -v "Found script" | tee checkresult.txt'''
270
- }
251
+ // stage('SonarQube compare to master') {
252
+ // when {
253
+ // anyOf {
254
+ // allOf {
255
+ // not { environment name: 'CHANGE_ID', value: '' }
256
+ // environment name: 'CHANGE_TARGET', value: 'develop'
257
+ // }
258
+ // allOf {
259
+ // environment name: 'CHANGE_ID', value: ''
260
+ // branch 'develop'
261
+ // not { changelog '.*^Automated release [0-9\\.]+$' }
262
+ // }
263
+ // }
264
+ // }
265
+ // steps {
266
+ // script {
267
+ // sh '''echo "Error" > checkresult.txt'''
268
+ // catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
269
+ // sh '''set -o pipefail; docker run -i --rm --pull always --name="$IMAGE_NAME-gitflow-sn" -e GIT_BRANCH="$BRANCH_NAME" -e GIT_NAME="$GIT_NAME" eeacms/gitflow /checkSonarqubemaster.sh | grep -v "Found script" | tee checkresult.txt'''
270
+ // }
271
271
 
272
- publishChecks name: 'SonarQube', title: 'Sonarqube Code Quality Check', summary: 'Quality check on the SonarQube metrics from branch develop, comparing it with the ones from master branch. No bugs are allowed',
273
- text: readFile(file: 'checkresult.txt'), conclusion: "${currentBuild.currentResult}",
274
- detailsURL: "${env.BUILD_URL}display/redirect"
275
- }
276
- }
277
- }
272
+ // publishChecks name: 'SonarQube', title: 'Sonarqube Code Quality Check', summary: 'Quality check on the SonarQube metrics from branch develop, comparing it with the ones from master branch. No bugs are allowed',
273
+ // text: readFile(file: 'checkresult.txt'), conclusion: "${currentBuild.currentResult}",
274
+ // detailsURL: "${env.BUILD_URL}display/redirect"
275
+ // }
276
+ // }
277
+ // }
278
278
 
279
279
  stage('Pull Request') {
280
280
  when {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-tableau",
3
- "version": "7.0.0",
3
+ "version": "7.0.2",
4
4
  "description": "@eeacms/volto-tableau: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -75,4 +75,4 @@
75
75
  "cypress:open": "make cypress-open",
76
76
  "prepare": "husky install"
77
77
  }
78
- }
78
+ }
@@ -51,8 +51,6 @@ const View = (props) => {
51
51
  }
52
52
  }, [id, isBlock, getContent, mode, tableau_vis_url, tableau_visualization]);
53
53
 
54
- const { figure_note = [], data_provenance = {} } = tableau_visualization;
55
-
56
54
  if (props.mode === 'edit' && !tableau_vis_url) {
57
55
  return <Message>Please select a tableau from block editor.</Message>;
58
56
  }
@@ -75,8 +73,6 @@ const View = (props) => {
75
73
  tableau_height,
76
74
  tableau_vis_url,
77
75
  }}
78
- figure_note={figure_note}
79
- sources={data_provenance?.data || []}
80
76
  />
81
77
  </PrivacyProtection>
82
78
  </div>
@@ -6,7 +6,7 @@ import sliderSVG from '@plone/volto/icons/slider.svg';
6
6
  export default (config) => {
7
7
  config.blocks.blocksConfig.embed_tableau_visualization = {
8
8
  id: 'embed_tableau_visualization',
9
- title: 'Embed EEA Tableau visualization',
9
+ title: 'Embed Dashboard (Tableau)',
10
10
  icon: sliderSVG,
11
11
  group: 'common',
12
12
  edit: EmbedTableauVisualizatonEdit,
@@ -29,7 +29,7 @@ const View = React.forwardRef((props, ref) => {
29
29
  const extraOptions = React.useMemo(() => {
30
30
  const options = {};
31
31
  staticParameters.forEach((parameter) => {
32
- if (parameter.field) {
32
+ if (parameter.field && parameter.value) {
33
33
  options[parameter.field] = parameter.value;
34
34
  }
35
35
  });
@@ -89,20 +89,19 @@ const Tableau = forwardRef((props, ref) => {
89
89
  extraOptions = {},
90
90
  mode = 'view',
91
91
  screen = {},
92
- figure_note = [],
93
- sources,
94
92
  version = '2.8.0',
95
93
  setVizState,
96
94
  onChangeBlock,
97
95
  } = props;
98
96
  const {
97
+ data_provenance = {},
98
+ figure_note = [],
99
99
  autoScale = false,
100
100
  hideTabs = false,
101
101
  hideToolbar = false,
102
102
  sheetname = '',
103
103
  toolbarPosition = 'Top',
104
104
  breakpointUrls = [],
105
- tableau_vis_url,
106
105
  with_notes = true,
107
106
  with_sources = true,
108
107
  with_more_info = true,
@@ -317,14 +316,14 @@ const Tableau = forwardRef((props, ref) => {
317
316
  };
318
317
 
319
318
  const updateScale = () => {
320
- const tableauEl = vizEl.current.querySelector('iframe');
319
+ const iframe = vizEl.current.querySelector('iframe');
321
320
  const { sheetSize = {} } = viz.current.getVizSize() || {};
322
321
  const vizWidth = sheetSize?.minSize?.width || 1;
323
322
  const scale = Math.min(vizEl.current.clientWidth / vizWidth, 1);
324
- tableauEl.style.transform = `scale(${scale})`;
323
+ iframe.style.transform = `scale(${scale})`;
325
324
  window.requestAnimationFrame(() => {
326
325
  if (vizEl.current) {
327
- vizEl.current.style.height = `${scale * tableauEl.clientHeight}px`;
326
+ vizEl.current.style.height = `${scale * iframe.clientHeight}px`;
328
327
  }
329
328
  });
330
329
  };
@@ -441,9 +440,9 @@ const Tableau = forwardRef((props, ref) => {
441
440
  {loaded && (
442
441
  <div className={cx('visualization-toolbar', { mobile })}>
443
442
  <div className="left-col">
444
- {with_notes && <FigureNote note={figure_note || []} />}
445
- {with_sources && <Sources sources={sources} />}
446
- {with_more_info && <MoreInfo href={tableau_vis_url || data.url} />}
443
+ {with_notes && <FigureNote notes={figure_note || []} />}
444
+ {with_sources && <Sources sources={data_provenance?.data || []} />}
445
+ {with_more_info && <MoreInfo href={data['@id']} />}
447
446
  </div>
448
447
  <div className="right-col">
449
448
  {with_enlarge && loaded && (
@@ -463,9 +462,7 @@ const Tableau = forwardRef((props, ref) => {
463
462
  </Enlarge>
464
463
  )}
465
464
  {with_download && loaded && <Download viz={viz.current} />}
466
- {with_share && loaded && (
467
- <Share href={tableau_vis_url || data.url} />
468
- )}
465
+ {with_share && loaded && <Share href={data['@id']} />}
469
466
  </div>
470
467
  </div>
471
468
  )}
@@ -3,6 +3,7 @@ import { hasBlocksData } from '@plone/volto/helpers';
3
3
  import { Container } from 'semantic-ui-react';
4
4
  import config from '@plone/volto/registry';
5
5
  import RenderBlocks from '@plone/volto/components/theme/View/RenderBlocks';
6
+ import { pickMetadata } from '@eeacms/volto-embed/helpers';
6
7
  import Tableau from '@eeacms/volto-tableau/Tableau/Tableau';
7
8
 
8
9
  const VisualizationView = (props) => {
@@ -17,6 +18,7 @@ const VisualizationView = (props) => {
17
18
  <Tableau
18
19
  data={{
19
20
  ...tableau_visualization,
21
+ ...pickMetadata(content),
20
22
  with_notes: false,
21
23
  with_sources: false,
22
24
  with_more_info: false,
@@ -1,13 +1,27 @@
1
- import Tableau from '@eeacms/volto-tableau/Tableau/Tableau';
1
+ import React from 'react';
2
+ import { connect } from 'react-redux';
2
3
  import config from '@plone/volto/registry';
4
+ import { pickMetadata } from '@eeacms/volto-embed/helpers';
5
+ import Tableau from '@eeacms/volto-tableau/Tableau/Tableau';
3
6
 
4
- export default function VisualizationViewWidget(props) {
5
- const { value = {} } = props;
7
+ function VisualizationViewWidget(props) {
8
+ const { staticParameters = [] } = props.value;
9
+
10
+ const extraOptions = React.useMemo(() => {
11
+ const options = {};
12
+ staticParameters.forEach((parameter) => {
13
+ if (parameter.field && parameter.value) {
14
+ options[parameter.field] = parameter.value;
15
+ }
16
+ });
17
+ return options;
18
+ }, [staticParameters]);
6
19
 
7
20
  return (
8
21
  <Tableau
9
22
  data={{
10
- ...value,
23
+ ...(props.value || {}),
24
+ ...pickMetadata(props.content),
11
25
  with_notes: false,
12
26
  with_sources: false,
13
27
  with_more_info: false,
@@ -15,9 +29,14 @@ export default function VisualizationViewWidget(props) {
15
29
  with_enlarge: true,
16
30
  with_download: true,
17
31
  }}
32
+ extraOptions={extraOptions}
18
33
  breakpoints={
19
34
  config.blocks.blocksConfig?.embed_tableau_visualization?.breakpoints
20
35
  }
21
36
  />
22
37
  );
23
38
  }
39
+
40
+ export default connect((state) => ({ content: state.content.data }))(
41
+ VisualizationViewWidget,
42
+ );
@@ -6,13 +6,19 @@ import configureStore from 'redux-mock-store';
6
6
  import VisualizationViewWidget from './VisualizationViewWidget';
7
7
 
8
8
  const mockStore = configureStore([]);
9
- const store = mockStore({});
9
+ const store = mockStore({
10
+ content: { data: {} },
11
+ });
10
12
 
11
13
  jest.mock('@plone/volto/components', () => ({
12
14
  Icon: ({ children }) => <img alt="incon">{children}</img>,
13
15
  Toast: ({ children }) => <p>{children}</p>,
14
16
  }));
15
17
 
18
+ jest.mock('@eeacms/volto-embed/helpers', () => ({
19
+ pickMetadata: (data) => data,
20
+ }));
21
+
16
22
  describe('VisualizationViewWidget', () => {
17
23
  it('should render the component', () => {
18
24
  const data = {
@@ -23,9 +29,13 @@ describe('VisualizationViewWidget', () => {
23
29
  with_share: true,
24
30
  };
25
31
 
32
+ const value = {
33
+ staticParameters: [],
34
+ };
35
+
26
36
  const { container } = render(
27
37
  <Provider store={store}>
28
- <VisualizationViewWidget data={data} />
38
+ <VisualizationViewWidget data={data} value={value} />
29
39
  </Provider>,
30
40
  );
31
41
  expect(container.querySelector('.tableau-wrapper')).toBeInTheDocument();
@@ -24,7 +24,7 @@ const VisualizationWidget = (props) => {
24
24
  const extraOptions = React.useMemo(() => {
25
25
  const options = {};
26
26
  (value.staticParameters || []).forEach((parameter) => {
27
- if (parameter.field) {
27
+ if (parameter.field && parameter.value) {
28
28
  options[parameter.field] = parameter.value;
29
29
  }
30
30
  });