@eeacms/volto-tableau 6.0.5 → 7.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/CHANGELOG.md +28 -15
- package/Jenkinsfile +9 -1
- package/Makefile +2 -4
- package/README.md +19 -15
- package/cypress/e2e/block-tableau.cy.js +45 -0
- package/cypress/support/commands.js +40 -2
- package/cypress/support/e2e.js +4 -4
- package/package.json +2 -2
- package/src/Blocks/EmbedTableauVisualization/Edit.jsx +3 -2
- package/src/Blocks/EmbedTableauVisualization/Edit.test.jsx +87 -0
- package/src/Blocks/EmbedTableauVisualization/View.jsx +56 -39
- package/src/Blocks/EmbedTableauVisualization/View.test.jsx +34 -13
- package/src/Blocks/EmbedTableauVisualization/__snapshots__/Edit.test.jsx.snap +20 -0
- package/src/Blocks/EmbedTableauVisualization/__snapshots__/View.test.jsx.snap +20 -0
- package/src/Utils/Download.test.jsx +44 -0
- package/src/Utils/__snapshots__/Download.test.jsx.snap +111 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,34 @@ 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
|
|
8
|
+
|
|
9
|
+
#### :bug: Bug Fixes
|
|
10
|
+
|
|
11
|
+
- fix: unittests [Miu Razvan - [`ce983d2`](https://github.com/eea/volto-tableau/commit/ce983d26d18fc2ed6d24f3fa64999e85c3b90051)]
|
|
12
|
+
|
|
13
|
+
#### :hammer_and_wrench: Others
|
|
14
|
+
|
|
15
|
+
- update [Miu Razvan - [`a7a6f1f`](https://github.com/eea/volto-tableau/commit/a7a6f1f8f0f2ed727a13d386fd30396f80418130)]
|
|
16
|
+
- bump version [Miu Razvan - [`192c7ae`](https://github.com/eea/volto-tableau/commit/192c7ae64e6c659a1f676a3506aa87563cb715e7)]
|
|
17
|
+
- tests [Miu Razvan - [`94aeb23`](https://github.com/eea/volto-tableau/commit/94aeb2332fa98088b0da456df692368163d01221)]
|
|
18
|
+
- update [Miu Razvan - [`daaeeb5`](https://github.com/eea/volto-tableau/commit/daaeeb51876276909d506c9f1851b83089ff9124)]
|
|
19
|
+
- update [Miu Razvan - [`48e976f`](https://github.com/eea/volto-tableau/commit/48e976f0e9ff6d11dd18a61f6d17bd6c0de11e5a)]
|
|
20
|
+
- update [Miu Razvan - [`fcc702a`](https://github.com/eea/volto-tableau/commit/fcc702a38cc3942d84282443d5de543f0e361389)]
|
|
21
|
+
- update [Miu Razvan - [`ef9abd3`](https://github.com/eea/volto-tableau/commit/ef9abd3617bde7148fe2ac6d33079f3d5f82a302)]
|
|
22
|
+
- update snapshot [Dobricean Ioan Dorian - [`baaeccf`](https://github.com/eea/volto-tableau/commit/baaeccf8c589c7a6bac6a5522a0a23b90b9fda1d)]
|
|
23
|
+
- unify view and edit [Dobricean Ioan Dorian - [`1159da9`](https://github.com/eea/volto-tableau/commit/1159da96057dc78a1ac46371c57f55e7786aab34)]
|
|
24
|
+
- fix tests [Dobricean Ioan Dorian - [`33bff4b`](https://github.com/eea/volto-tableau/commit/33bff4b8e9060548610990c6817b49cb06be79ae)]
|
|
25
|
+
- test [Dobricean Ioan Dorian - [`48505ca`](https://github.com/eea/volto-tableau/commit/48505caef84d12091035fdd79cf64067e7f819e2)]
|
|
26
|
+
- split the view and edit [Dobricean Ioan Dorian - [`7227bb1`](https://github.com/eea/volto-tableau/commit/7227bb1fb70e5d895f15872ed6533e089be99836)]
|
|
27
|
+
- update embed tableau so it can work with serialized data [Dobricean Ioan Dorian - [`59d958c`](https://github.com/eea/volto-tableau/commit/59d958c7a1a5055ea62e04abcbf34ee93f52e23a)]
|
|
28
|
+
### [6.0.6](https://github.com/eea/volto-tableau/compare/6.0.5...6.0.6) - 17 November 2023
|
|
29
|
+
|
|
30
|
+
#### :hammer_and_wrench: Others
|
|
31
|
+
|
|
32
|
+
- tests: add cypress for tableau [nileshgulia1 - [`6eca683`](https://github.com/eea/volto-tableau/commit/6eca6834b85cdab4ed82367fee32fdbbb35b0f5e)]
|
|
33
|
+
- tests: update unit tests [nileshgulia1 - [`96cae09`](https://github.com/eea/volto-tableau/commit/96cae09eab2e737f032c97eb401a3efa88e68ec6)]
|
|
34
|
+
- comment test [Miu Razvan - [`a459525`](https://github.com/eea/volto-tableau/commit/a459525fdccf8ee61651d4cb2e04eb253e841c61)]
|
|
7
35
|
### [6.0.5](https://github.com/eea/volto-tableau/compare/6.0.4...6.0.5) - 15 November 2023
|
|
8
36
|
|
|
9
37
|
#### :rocket: New Features
|
|
@@ -29,7 +57,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
29
57
|
|
|
30
58
|
#### :house: Internal changes
|
|
31
59
|
|
|
32
|
-
- chore: [JENKINS] Refactor automated testing [valentinab25 - [`903b90a`](https://github.com/eea/volto-tableau/commit/903b90a2df0abc183aa68d99a89bb688de3a0c73)]
|
|
33
60
|
|
|
34
61
|
#### :hammer_and_wrench: Others
|
|
35
62
|
|
|
@@ -39,9 +66,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
39
66
|
- tests: increase coverage [kreafox - [`ecb9262`](https://github.com/eea/volto-tableau/commit/ecb92625a44365faf4c39f0ff3f02ccc4ca21656)]
|
|
40
67
|
- Fix tableau height [kreafox - [`6194c24`](https://github.com/eea/volto-tableau/commit/6194c2405e2bd93aba9865caed76292cd55193d3)]
|
|
41
68
|
- Show share & download button on widget view [kreafox - [`a66e253`](https://github.com/eea/volto-tableau/commit/a66e2537d08dc7129e249c28e1daa27246c88815)]
|
|
42
|
-
- test: [JENKINS] Add cpu limit on cypress docker [valentinab25 - [`9d2189d`](https://github.com/eea/volto-tableau/commit/9d2189d4edb13dd449d75cd6dd9052bbed67304d)]
|
|
43
|
-
- test: [JENKINS] Increase shm-size to cypress docker [valentinab25 - [`f2fa3f9`](https://github.com/eea/volto-tableau/commit/f2fa3f9ccabab918586179ac16ead44e2eba8498)]
|
|
44
|
-
- test: [JENKINS] Improve cypress time [valentinab25 - [`5748183`](https://github.com/eea/volto-tableau/commit/5748183c27dae18a4ebbc067d659cbc24cad8f71)]
|
|
45
69
|
- use toolbar from volto-embed [Miu Razvan - [`1a232a1`](https://github.com/eea/volto-tableau/commit/1a232a15f2bbe05da75307800590d0a0a1c4996b)]
|
|
46
70
|
## [6.0.0](https://github.com/eea/volto-tableau/compare/5.0.2...6.0.0) - 30 October 2023
|
|
47
71
|
|
|
@@ -99,7 +123,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
99
123
|
- test: change volto version in Jenkinsfile [ana-oprea - [`347aceb`](https://github.com/eea/volto-tableau/commit/347aceb07d152fddeebbf3a7e7a6ac9c55dc21ba)]
|
|
100
124
|
- test: increase cypress timeout [ana-oprea - [`bdf4408`](https://github.com/eea/volto-tableau/commit/bdf44083cd84c96b4914d3f8a3bb17c5187f191c)]
|
|
101
125
|
- test: EN locales, pre-commit fix, feature PRs checks Refs #257193 [valentinab25 - [`caff974`](https://github.com/eea/volto-tableau/commit/caff9742a703b224133a8dd2a969629e70c9fd33)]
|
|
102
|
-
- test: Fix eslint and yarn i18n [Alin Voinea - [`b8be7fb`](https://github.com/eea/volto-tableau/commit/b8be7fb9ab10faed0a1be8ce7e3d4e7c78ebe020)]
|
|
103
126
|
- i18n: Add en [Alin Voinea - [`c5e20dd`](https://github.com/eea/volto-tableau/commit/c5e20ddea25c830ac80665ee9a71e557e8cd117d)]
|
|
104
127
|
- test: Update Makefile and docker-compose to align it with Jenkinsfile [valentinab25 - [`2116ff9`](https://github.com/eea/volto-tableau/commit/2116ff95c6454e813bdca44e6c3aa81fa0a916b8)]
|
|
105
128
|
## [5.0.0](https://github.com/eea/volto-tableau/compare/4.1.1...5.0.0) - 25 July 2023
|
|
@@ -111,21 +134,17 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
111
134
|
#### :hammer_and_wrench: Others
|
|
112
135
|
|
|
113
136
|
- Release 5.0.0 [Alin Voinea - [`97c98e9`](https://github.com/eea/volto-tableau/commit/97c98e98b1295a4ad45756326dc20cd59517515f)]
|
|
114
|
-
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`2acb3a5`](https://github.com/eea/volto-tableau/commit/2acb3a5490f62ce0a95ebbd03c32874ac3a42603)]
|
|
115
137
|
### [4.1.1](https://github.com/eea/volto-tableau/compare/4.1.0...4.1.1) - 21 July 2023
|
|
116
138
|
|
|
117
139
|
#### :hammer_and_wrench: Others
|
|
118
140
|
|
|
119
141
|
- Add VisualizationViewWidget [Tiberiu Ichim - [`fa881cb`](https://github.com/eea/volto-tableau/commit/fa881cbc3643a46697fb16d1c86ada1d4121a46a)]
|
|
120
|
-
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`cbcbad2`](https://github.com/eea/volto-tableau/commit/cbcbad26f7aa3683122199c8d5cbd142903df93b)]
|
|
121
|
-
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`51abe6d`](https://github.com/eea/volto-tableau/commit/51abe6d4db80825fe2e396e04c7003c6ad79b480)]
|
|
122
142
|
### [4.1.0](https://github.com/eea/volto-tableau/compare/4.0.0...4.1.0) - 15 June 2023
|
|
123
143
|
|
|
124
144
|
## [4.0.0](https://github.com/eea/volto-tableau/compare/3.0.8...4.0.0) - 13 June 2023
|
|
125
145
|
|
|
126
146
|
#### :house: Internal changes
|
|
127
147
|
|
|
128
|
-
- chore: [JENKINS] Remove alpha testing version [valentinab25 - [`e33bb21`](https://github.com/eea/volto-tableau/commit/e33bb21eb429c33e3a15d771487a1c9af8ccb0d5)]
|
|
129
148
|
|
|
130
149
|
#### :hammer_and_wrench: Others
|
|
131
150
|
|
|
@@ -157,7 +176,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
157
176
|
|
|
158
177
|
#### :hammer_and_wrench: Others
|
|
159
178
|
|
|
160
|
-
- Add Sonarqube tag using industry-frontend addons list [EEA Jenkins - [`f5deccd`](https://github.com/eea/volto-tableau/commit/f5deccd84372752908b300c5cfd78134818e5ce4)]
|
|
161
179
|
### [3.0.6](https://github.com/eea/volto-tableau/compare/3.0.5...3.0.6) - 30 January 2023
|
|
162
180
|
|
|
163
181
|
### [3.0.5](https://github.com/eea/volto-tableau/compare/3.0.4...3.0.5) - 26 January 2023
|
|
@@ -229,7 +247,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
229
247
|
- Update commands.js [Nilesh - [`7c48437`](https://github.com/eea/volto-tableau/commit/7c4843780efb9b85a4728de73c00d831c1d8fdcf)]
|
|
230
248
|
- Update e2e.js [Nilesh - [`f67b45c`](https://github.com/eea/volto-tableau/commit/f67b45c170f58f8d0301192994226f173e4cb00a)]
|
|
231
249
|
- latest volto compatibility refs #154757 [nileshgulia1 - [`881ba48`](https://github.com/eea/volto-tableau/commit/881ba482dc9b82e7fdac16549d41e80a6d26b3de)]
|
|
232
|
-
- Add Sonarqube tag using marine-frontend addons list [EEA Jenkins - [`58e25df`](https://github.com/eea/volto-tableau/commit/58e25df2291add09670143bee54cde103ee835b9)]
|
|
233
250
|
### [1.3.0](https://github.com/eea/volto-tableau/compare/1.2.5...1.3.0) - 28 September 2022
|
|
234
251
|
|
|
235
252
|
#### :hammer_and_wrench: Others
|
|
@@ -243,15 +260,11 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
243
260
|
- Use volto 16 alpha 14 [Miu Razvan - [`93641be`](https://github.com/eea/volto-tableau/commit/93641be4c2393f49008aff789400cf7c947949fd)]
|
|
244
261
|
- Revert volto-tableau group to common [Andrei Grigore - [`9d24c6d`](https://github.com/eea/volto-tableau/commit/9d24c6d2767fed6a840cddaee55dbd5cecb544b5)]
|
|
245
262
|
- Tableaugroup typo fix [Andrei Grigore - [`b0b5378`](https://github.com/eea/volto-tableau/commit/b0b5378a437043120a96c9e5e8802584145daa22)]
|
|
246
|
-
- Add Sonarqube tag using freshwater-frontend addons list [EEA Jenkins - [`3234347`](https://github.com/eea/volto-tableau/commit/3234347e524cc0ed4918242f503fe9e7dba266b2)]
|
|
247
263
|
- Refs #142010 - Optimize Volto-addons gitflow pipelines [valentinab25 - [`d237e1c`](https://github.com/eea/volto-tableau/commit/d237e1c72817d7e68a3eb698563674d1514db24f)]
|
|
248
264
|
### [1.2.4](https://github.com/eea/volto-tableau/compare/1.2.3...1.2.4) - 25 October 2021
|
|
249
265
|
|
|
250
266
|
#### :hammer_and_wrench: Others
|
|
251
267
|
|
|
252
|
-
- Add Sonarqube tag using frontend addons list [EEA Jenkins - [`2b19679`](https://github.com/eea/volto-tableau/commit/2b19679e2c7bcdc83082d1c73a595eea8b86d14f)]
|
|
253
|
-
- Add Sonarqube tag using frontend addons list [EEA Jenkins - [`384ccae`](https://github.com/eea/volto-tableau/commit/384ccaebed8c414a5c90eb96c6ce0a2b091f249c)]
|
|
254
|
-
- Add Sonarqube tag using frontend addons list [EEA Jenkins - [`589258e`](https://github.com/eea/volto-tableau/commit/589258e9b3cbba9cee37c57bb85ca5b707bc65d7)]
|
|
255
268
|
### [1.2.3](https://github.com/eea/volto-tableau/compare/1.2.2...1.2.3) - 14 June 2021
|
|
256
269
|
|
|
257
270
|
#### :hammer_and_wrench: Others
|
package/Jenkinsfile
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
pipeline {
|
|
2
|
+
tools {
|
|
3
|
+
jdk 'Java17'
|
|
4
|
+
}
|
|
2
5
|
agent {
|
|
3
6
|
node { label 'docker-host' }
|
|
4
7
|
}
|
|
@@ -159,7 +162,8 @@ pipeline {
|
|
|
159
162
|
script {
|
|
160
163
|
try {
|
|
161
164
|
sh '''docker run --pull always --rm -d --name="$IMAGE_NAME-plone" -e SITE="Plone" -e PROFILES="$BACKEND_PROFILES" -e ADDONS="$BACKEND_ADDONS" eeacms/plone-backend'''
|
|
162
|
-
sh '''
|
|
165
|
+
sh '''docker run -d --shm-size=3g --link $IMAGE_NAME-plone:plone --name="$IMAGE_NAME-cypress" -e "RAZZLE_INTERNAL_API_PATH=http://plone:8080/Plone" --entrypoint=make --workdir=/app/src/addons/$GIT_NAME $IMAGE_NAME-frontend start-ci'''
|
|
166
|
+
sh '''timeout -s 9 1800 docker exec --workdir=/app/src/addons/${GIT_NAME} $IMAGE_NAME-cypress make cypress-ci'''
|
|
163
167
|
} finally {
|
|
164
168
|
try {
|
|
165
169
|
sh '''rm -rf cypress-videos cypress-results cypress-coverage cypress-screenshots'''
|
|
@@ -189,6 +193,10 @@ pipeline {
|
|
|
189
193
|
catchError(buildResult: 'SUCCESS', stageResult: 'SUCCESS') {
|
|
190
194
|
junit testResults: 'cypress-results/**/*.xml', allowEmptyResults: true
|
|
191
195
|
}
|
|
196
|
+
catchError(buildResult: 'SUCCESS', stageResult: 'SUCCESS') {
|
|
197
|
+
sh '''docker logs $IMAGE_NAME-cypress'''
|
|
198
|
+
}
|
|
199
|
+
sh script: "docker stop $IMAGE_NAME-cypress", returnStatus: true
|
|
192
200
|
sh script: "docker stop $IMAGE_NAME-plone", returnStatus: true
|
|
193
201
|
sh script: "docker rm -v $IMAGE_NAME-plone", returnStatus: true
|
|
194
202
|
sh script: "docker rm -v $IMAGE_NAME-cypress", returnStatus: true
|
package/Makefile
CHANGED
|
@@ -151,14 +151,12 @@ test-ci:
|
|
|
151
151
|
|
|
152
152
|
.PHONY: start-ci
|
|
153
153
|
start-ci:
|
|
154
|
+
cp .coverage.babel.config.js /app/babel.config.js
|
|
154
155
|
cd ../..
|
|
155
|
-
yarn start
|
|
156
|
+
yarn start
|
|
156
157
|
|
|
157
158
|
.PHONY: cypress-ci
|
|
158
159
|
cypress-ci:
|
|
159
|
-
cp .coverage.babel.config.js /app/babel.config.js
|
|
160
|
-
make start-ci
|
|
161
160
|
$(NODE_MODULES)/.bin/wait-on -t 240000 http://localhost:3000
|
|
162
161
|
NODE_ENV=development make cypress-run
|
|
163
162
|
|
|
164
|
-
|
package/README.md
CHANGED
|
@@ -24,6 +24,10 @@ Registers a VisualizationView component for a content type named 'tableau_visual
|
|
|
24
24
|
|
|
25
25
|
## Getting started
|
|
26
26
|
|
|
27
|
+
### Upgrade
|
|
28
|
+
|
|
29
|
+
#### 7.x.x -> requires >= eea.api.dataconnector@7.0
|
|
30
|
+
|
|
27
31
|
### Try volto-tableau with Docker
|
|
28
32
|
|
|
29
33
|
git clone https://github.com/eea/volto-tableau.git
|
|
@@ -43,25 +47,25 @@ Go to http://localhost:3000
|
|
|
43
47
|
|
|
44
48
|
1. Start Volto frontend
|
|
45
49
|
|
|
46
|
-
|
|
50
|
+
- If you already have a volto project, just update `package.json`:
|
|
47
51
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
+
```JSON
|
|
53
|
+
"addons": [
|
|
54
|
+
"@eeacms/volto-tableau"
|
|
55
|
+
],
|
|
52
56
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
+
"dependencies": {
|
|
58
|
+
"@eeacms/volto-tableau": "*"
|
|
59
|
+
}
|
|
60
|
+
```
|
|
57
61
|
|
|
58
|
-
|
|
62
|
+
- If not, create one:
|
|
59
63
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
64
|
+
```
|
|
65
|
+
npm install -g yo @plone/generator-volto
|
|
66
|
+
yo @plone/volto my-volto-project --canary --addon @eeacms/volto-tableau
|
|
67
|
+
cd my-volto-project
|
|
68
|
+
```
|
|
65
69
|
|
|
66
70
|
1. Install new add-ons and restart Volto:
|
|
67
71
|
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { slateAfterEach } from '../support/e2e';
|
|
2
|
+
|
|
3
|
+
describe('Blocks Tests', () => {
|
|
4
|
+
beforeEach((contentType = 'Document') => {
|
|
5
|
+
cy.intercept('GET', `/**/*?expand*`).as('content');
|
|
6
|
+
cy.intercept('GET', '/**/Document').as('schema');
|
|
7
|
+
cy.autologin();
|
|
8
|
+
cy.createContent({
|
|
9
|
+
contentType: 'Document',
|
|
10
|
+
contentId: 'cypress',
|
|
11
|
+
contentTitle: 'Cypress',
|
|
12
|
+
});
|
|
13
|
+
cy.createContent({
|
|
14
|
+
contentType: contentType,
|
|
15
|
+
contentId: 'my-page',
|
|
16
|
+
contentTitle: 'My Page',
|
|
17
|
+
path: 'cypress',
|
|
18
|
+
});
|
|
19
|
+
cy.visit('/cypress/my-page');
|
|
20
|
+
// cy.waitForResourceToLoad('@navigation');
|
|
21
|
+
// cy.waitForResourceToLoad('@breadcrumbs');
|
|
22
|
+
// cy.waitForResourceToLoad('@actions');
|
|
23
|
+
// cy.waitForResourceToLoad('@types');
|
|
24
|
+
cy.waitForResourceToLoad('my-page');
|
|
25
|
+
cy.navigate('/cypress/my-page/edit');
|
|
26
|
+
});
|
|
27
|
+
afterEach(slateAfterEach);
|
|
28
|
+
|
|
29
|
+
it('Add Tableau block', () => {
|
|
30
|
+
// when I add a maps block
|
|
31
|
+
cy.addNewBlock('tableau');
|
|
32
|
+
|
|
33
|
+
cy.get(`.sidebar-container .field-wrapper-url #field-url`).type(
|
|
34
|
+
'https://tableau-public.discomap.eea.europa.eu/views/GHGProjections/Dashboard1&:jsdebug=n',
|
|
35
|
+
);
|
|
36
|
+
cy.get('#toolbar-save').click();
|
|
37
|
+
cy.wait('@content');
|
|
38
|
+
cy.url().should('eq', Cypress.config().baseUrl + '/cypress/my-page');
|
|
39
|
+
|
|
40
|
+
// then the page view should contain the maps block
|
|
41
|
+
cy.get('#page-document iframe')
|
|
42
|
+
.should('have.attr', 'src')
|
|
43
|
+
.and('match', /\/\/tableau-public.discomap.eea.europa.eu\//);
|
|
44
|
+
});
|
|
45
|
+
});
|
|
@@ -71,8 +71,7 @@ Cypress.Commands.add(
|
|
|
71
71
|
id: contentId,
|
|
72
72
|
title: contentTitle,
|
|
73
73
|
image: {
|
|
74
|
-
data:
|
|
75
|
-
'iVBORw0KGgoAAAANSUhEUgAAANcAAAA4CAMAAABZsZ3QAAAAM1BMVEX29fK42OU+oMvn7u9drtIPisHI4OhstdWZyt4fkcXX5+sAg74umMhNp86p0eJ7vNiKw9v/UV4wAAAAAXRSTlMAQObYZgAABBxJREFUeF7tmuty4yAMhZG4X2zn/Z92J5tsBJwWXG/i3XR6frW2Y/SBLIRAfaQUDNt8E5tLUt9BycfcKfq3R6Mlfyimtx4rzp+K3dtibXkor99zsEqLYZltblTecciogoh+TXfY1Ve4dn07rCDGG9dHSEEOg/GmXl0U1XDxTKxNK5De7BxsyyBr6gGm2/vPxKJ8F6f7BXKfRMp1xIWK9A+5ks25alSb353dWnDJN1k35EL5f8dVGifTf/4tjUuuFq7u4srmXC60yAmldLXIWbg65RKU87lcGxJCFqUPv0IacW0PmSivOZFLE908inPToMmii/roG+MRV/O8FU88i8tFsxV3a06MFUw0Qu7RmAtdV5/HVVaOVMTWNOWSwMljLhzhcB6XIS7OK5V6AvRDNN7t5VJWQs1J40UmalbK56usBG/CuCHSYuc+rkUGeMCViNRARPrzW52N3oQLe6WifNliSuuGaH3czbVNudI9s7ZLUCLHVwWlyES522o1t14uvmbblmVTKqFjaZYJFSTPP4dLL1kU1z7p0lzdbRulmEWLxoQX+z9ce7A8GqEEucllLxePuZwdJl1Lezu0hoswvTPt61DrFcRuujV/2cmlxaGBC7Aw6cpovGANwRiSdOAWJ5AGy4gLL64dl0QhUEAuEUNws+XxV+OKGPdw/hESGYF9XEGaFC7sNLMSXWJjHsnanYi87VK428N2uxpOjOFANcagLM5l+7mSycM8KknZpKLcGi6jmzWGr/vLurZ/0g4u9AZuAoeb5r1ceQhyiTPY1E4wUR6u/F3H2ojSpXMMriBPT9cezTto8Cx+MsglHL4fv1Rxrb1LVw9yvyQpJ3AhFnLZfuRLH2QsOG3FGGD20X/th/u5bFAt16Bt308KjF+MNOXgl/SquIEySX3GhaZvc67KZbDxcCDORz2N8yCWPaY5lyQZO7lQ29fnZbt3Xu6qoge4+DjXl/MocySPOp9rlvdyznahRyHEYd77v3LhugOXDv4J65QXfl803BDAdaWBEDhfVx7nKofjoVCgxnUAqw/UAUDPn788BDvQuG4TDtdtUPvzjSlXAB8DvaDOhhrmhwbywylXAm8CvaouikJTL93gs3y7Yy4VYbIxOHrcMizPqWOjqO9l3Uz52kibQy4xxOgqhJvD+w5rvokOcAlGvNCfeqCv1ste1stzLm0f71Iq3ZfTrPfuE5nhPtF+LvQE2lffQC7pYtQy3tdzdrKvd5TLVVzDetScS3nEKmmwDyt1Cev1kX3YfbvzNK4fzrlw+cB6vm+uiUgf2zdXI62241LawCb7Pi5FXFPF8KpzDoF/Sw2lg+GrHNbno1mhPu+VCF/vfMnw06PnUl6j48dVHD3jHNHPua+fc3o/5yp/zsGi0vYtzi3Pz5mHd4T6BWMIlewacd63AAAAAElFTkSuQmCC',
|
|
74
|
+
data: 'iVBORw0KGgoAAAANSUhEUgAAANcAAAA4CAMAAABZsZ3QAAAAM1BMVEX29fK42OU+oMvn7u9drtIPisHI4OhstdWZyt4fkcXX5+sAg74umMhNp86p0eJ7vNiKw9v/UV4wAAAAAXRSTlMAQObYZgAABBxJREFUeF7tmuty4yAMhZG4X2zn/Z92J5tsBJwWXG/i3XR6frW2Y/SBLIRAfaQUDNt8E5tLUt9BycfcKfq3R6Mlfyimtx4rzp+K3dtibXkor99zsEqLYZltblTecciogoh+TXfY1Ve4dn07rCDGG9dHSEEOg/GmXl0U1XDxTKxNK5De7BxsyyBr6gGm2/vPxKJ8F6f7BXKfRMp1xIWK9A+5ks25alSb353dWnDJN1k35EL5f8dVGifTf/4tjUuuFq7u4srmXC60yAmldLXIWbg65RKU87lcGxJCFqUPv0IacW0PmSivOZFLE908inPToMmii/roG+MRV/O8FU88i8tFsxV3a06MFUw0Qu7RmAtdV5/HVVaOVMTWNOWSwMljLhzhcB6XIS7OK5V6AvRDNN7t5VJWQs1J40UmalbK56usBG/CuCHSYuc+rkUGeMCViNRARPrzW52N3oQLe6WifNliSuuGaH3czbVNudI9s7ZLUCLHVwWlyES522o1t14uvmbblmVTKqFjaZYJFSTPP4dLL1kU1z7p0lzdbRulmEWLxoQX+z9ce7A8GqEEucllLxePuZwdJl1Lezu0hoswvTPt61DrFcRuujV/2cmlxaGBC7Aw6cpovGANwRiSdOAWJ5AGy4gLL64dl0QhUEAuEUNws+XxV+OKGPdw/hESGYF9XEGaFC7sNLMSXWJjHsnanYi87VK428N2uxpOjOFANcagLM5l+7mSycM8KknZpKLcGi6jmzWGr/vLurZ/0g4u9AZuAoeb5r1ceQhyiTPY1E4wUR6u/F3H2ojSpXMMriBPT9cezTto8Cx+MsglHL4fv1Rxrb1LVw9yvyQpJ3AhFnLZfuRLH2QsOG3FGGD20X/th/u5bFAt16Bt308KjF+MNOXgl/SquIEySX3GhaZvc67KZbDxcCDORz2N8yCWPaY5lyQZO7lQ29fnZbt3Xu6qoge4+DjXl/MocySPOp9rlvdyznahRyHEYd77v3LhugOXDv4J65QXfl803BDAdaWBEDhfVx7nKofjoVCgxnUAqw/UAUDPn788BDvQuG4TDtdtUPvzjSlXAB8DvaDOhhrmhwbywylXAm8CvaouikJTL93gs3y7Yy4VYbIxOHrcMizPqWOjqO9l3Uz52kibQy4xxOgqhJvD+w5rvokOcAlGvNCfeqCv1ste1stzLm0f71Iq3ZfTrPfuE5nhPtF+LvQE2lffQC7pYtQy3tdzdrKvd5TLVVzDetScS3nEKmmwDyt1Cev1kX3YfbvzNK4fzrlw+cB6vm+uiUgf2zdXI62241LawCb7Pi5FXFPF8KpzDoF/Sw2lg+GrHNbno1mhPu+VCF/vfMnw06PnUl6j48dVHD3jHNHPua+fc3o/5yp/zsGi0vYtzi3Pz5mHd4T6BWMIlewacd63AAAAAElFTkSuQmCC',
|
|
76
75
|
encoding: 'base64',
|
|
77
76
|
filename: 'image.png',
|
|
78
77
|
'content-type': 'image/png',
|
|
@@ -535,3 +534,42 @@ Cypress.Commands.add(
|
|
|
535
534
|
});
|
|
536
535
|
},
|
|
537
536
|
);
|
|
537
|
+
|
|
538
|
+
Cypress.Commands.add('addNewBlock', (blockName, createNewSlate = false) => {
|
|
539
|
+
let block;
|
|
540
|
+
block = cy.getSlate(createNewSlate).type(`/${blockName}{enter}`);
|
|
541
|
+
return block;
|
|
542
|
+
});
|
|
543
|
+
|
|
544
|
+
Cypress.Commands.add('getSlate', (createNewSlate = false) => {
|
|
545
|
+
let slate;
|
|
546
|
+
if (createNewSlate) {
|
|
547
|
+
cy.get('.block.inner').last().type('{moveToEnd}{enter}');
|
|
548
|
+
}
|
|
549
|
+
cy.getIfExists(
|
|
550
|
+
SLATE_SELECTOR,
|
|
551
|
+
() => {
|
|
552
|
+
slate = cy.get(SLATE_SELECTOR).last();
|
|
553
|
+
},
|
|
554
|
+
() => {
|
|
555
|
+
slate = cy.get(SLATE_SELECTOR, { timeout: 10000 }).last();
|
|
556
|
+
},
|
|
557
|
+
);
|
|
558
|
+
return slate;
|
|
559
|
+
});
|
|
560
|
+
|
|
561
|
+
function getIfExists(
|
|
562
|
+
selector,
|
|
563
|
+
successAction = () => {},
|
|
564
|
+
failAction = () => {},
|
|
565
|
+
) {
|
|
566
|
+
cy.get('body').then((body) => {
|
|
567
|
+
if (body.find(selector).length > 0 && successAction) {
|
|
568
|
+
successAction();
|
|
569
|
+
} else if (failAction) {
|
|
570
|
+
failAction();
|
|
571
|
+
}
|
|
572
|
+
});
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
Cypress.Commands.add('getIfExists', getIfExists);
|
package/cypress/support/e2e.js
CHANGED
|
@@ -35,10 +35,10 @@ export const slateBeforeEach = (contentType = 'Document') => {
|
|
|
35
35
|
path: 'cypress',
|
|
36
36
|
});
|
|
37
37
|
cy.visit('/cypress/my-page');
|
|
38
|
-
cy.waitForResourceToLoad('@navigation');
|
|
39
|
-
cy.waitForResourceToLoad('@breadcrumbs');
|
|
40
|
-
cy.waitForResourceToLoad('@actions');
|
|
41
|
-
cy.waitForResourceToLoad('@types');
|
|
38
|
+
// cy.waitForResourceToLoad('@navigation');
|
|
39
|
+
// cy.waitForResourceToLoad('@breadcrumbs');
|
|
40
|
+
// cy.waitForResourceToLoad('@actions');
|
|
41
|
+
// cy.waitForResourceToLoad('@types');
|
|
42
42
|
cy.waitForResourceToLoad('my-page');
|
|
43
43
|
cy.navigate('/cypress/my-page/edit');
|
|
44
44
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eeacms/volto-tableau",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0",
|
|
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
|
+
}
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import BlockDataForm from '@plone/volto/components/manage/Form/BlockDataForm';
|
|
3
3
|
import { SidebarPortal } from '@plone/volto/components';
|
|
4
|
-
import View from './View';
|
|
5
4
|
import getSchema from './schema';
|
|
6
5
|
|
|
6
|
+
import View from './View';
|
|
7
|
+
|
|
7
8
|
const Edit = (props) => {
|
|
8
9
|
const schema = React.useMemo(() => getSchema(props), [props]);
|
|
9
10
|
|
|
10
11
|
return (
|
|
11
12
|
<React.Fragment>
|
|
12
|
-
<View
|
|
13
|
+
<View mode="edit" {...props} />
|
|
13
14
|
<SidebarPortal selected={props.selected}>
|
|
14
15
|
<BlockDataForm
|
|
15
16
|
block={props.block}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import renderer from 'react-test-renderer';
|
|
3
|
+
import configureStore from 'redux-mock-store';
|
|
4
|
+
import { Provider } from 'react-intl-redux';
|
|
5
|
+
import config from '@plone/volto/registry';
|
|
6
|
+
|
|
7
|
+
import Edit from './Edit';
|
|
8
|
+
import installEmbedTableau from '.';
|
|
9
|
+
|
|
10
|
+
installEmbedTableau(config);
|
|
11
|
+
|
|
12
|
+
const mockStore = configureStore([]);
|
|
13
|
+
|
|
14
|
+
window.URL.createObjectURL = jest.fn(() => 'test');
|
|
15
|
+
|
|
16
|
+
jest.mock('@plone/volto/components', () => ({
|
|
17
|
+
Icon: ({ children }) => <img alt="incon">{children}</img>,
|
|
18
|
+
Toast: ({ children }) => <p>{children}</p>,
|
|
19
|
+
SidebarPortal: jest.requireActual(
|
|
20
|
+
'@plone/volto/components/manage/Sidebar/SidebarPortal',
|
|
21
|
+
).default,
|
|
22
|
+
}));
|
|
23
|
+
|
|
24
|
+
jest.mock('@eeacms/volto-matomo/utils', () => ({
|
|
25
|
+
trackLink: jest.fn(),
|
|
26
|
+
}));
|
|
27
|
+
|
|
28
|
+
jest.mock(
|
|
29
|
+
'@eeacms/volto-embed/PrivacyProtection/PrivacyProtection',
|
|
30
|
+
() => ({ children }) => {
|
|
31
|
+
return children;
|
|
32
|
+
},
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
jest.mock('@eeacms/volto-embed/helpers', () => ({
|
|
36
|
+
pickMetadata: (data) => data,
|
|
37
|
+
}));
|
|
38
|
+
|
|
39
|
+
const store = mockStore({
|
|
40
|
+
intl: {
|
|
41
|
+
locale: 'en',
|
|
42
|
+
messages: {},
|
|
43
|
+
},
|
|
44
|
+
content: {
|
|
45
|
+
create: {},
|
|
46
|
+
subrequests: [],
|
|
47
|
+
},
|
|
48
|
+
connected_data_parameters: {},
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
describe('Edit', () => {
|
|
52
|
+
const data = {
|
|
53
|
+
'@type': 'embed_tableau_visualization',
|
|
54
|
+
dataprotection: {
|
|
55
|
+
enabled: false,
|
|
56
|
+
},
|
|
57
|
+
tableau_vis_url: 'http://localhost:3000/tableau-ct',
|
|
58
|
+
with_download: true,
|
|
59
|
+
with_more_info: true,
|
|
60
|
+
with_notes: true,
|
|
61
|
+
with_share: true,
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
it('should render the component', () => {
|
|
65
|
+
const component = renderer.create(
|
|
66
|
+
<Provider store={store}>
|
|
67
|
+
<Edit
|
|
68
|
+
id="my-tableau"
|
|
69
|
+
data={data}
|
|
70
|
+
pathname="/news"
|
|
71
|
+
selected={false}
|
|
72
|
+
block="1234"
|
|
73
|
+
index={1}
|
|
74
|
+
onChangeBlock={() => {}}
|
|
75
|
+
onSelectBlock={() => {}}
|
|
76
|
+
onDeleteBlock={() => {}}
|
|
77
|
+
onFocusPreviousBlock={() => {}}
|
|
78
|
+
onFocusNextBlock={() => {}}
|
|
79
|
+
handleKeyDown={() => {}}
|
|
80
|
+
content={{}}
|
|
81
|
+
/>
|
|
82
|
+
</Provider>,
|
|
83
|
+
);
|
|
84
|
+
const json = component.toJSON();
|
|
85
|
+
expect(json).toMatchSnapshot();
|
|
86
|
+
});
|
|
87
|
+
});
|
|
@@ -1,13 +1,30 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
import { Message } from 'semantic-ui-react';
|
|
3
|
+
import { flattenToAppURL } from '@plone/volto/helpers';
|
|
2
4
|
import { connect } from 'react-redux';
|
|
3
5
|
import { compose } from 'redux';
|
|
4
|
-
import { flattenToAppURL } from '@plone/volto/helpers';
|
|
5
6
|
import { getContent } from '@plone/volto/actions';
|
|
6
|
-
import
|
|
7
|
+
import PrivacyProtection from '@eeacms/volto-embed/PrivacyProtection/PrivacyProtection';
|
|
8
|
+
import { pickMetadata } from '@eeacms/volto-embed/helpers';
|
|
7
9
|
import Tableau from '@eeacms/volto-tableau/Tableau/Tableau';
|
|
8
10
|
|
|
11
|
+
function getTableauVisualization(props) {
|
|
12
|
+
const { isBlock } = props;
|
|
13
|
+
const content = (isBlock ? props.tableauContent : props.content) || {};
|
|
14
|
+
const tableau_visualization =
|
|
15
|
+
(isBlock
|
|
16
|
+
? props.tableauContent?.tableau_visualization
|
|
17
|
+
: props.content?.tableau_visualization) ||
|
|
18
|
+
props.data.tableau_visualization ||
|
|
19
|
+
{};
|
|
20
|
+
return {
|
|
21
|
+
...pickMetadata(content),
|
|
22
|
+
...tableau_visualization,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
9
26
|
const View = (props) => {
|
|
10
|
-
const data = props
|
|
27
|
+
const { isBlock, id, mode, data, getContent } = props;
|
|
11
28
|
const {
|
|
12
29
|
with_notes = true,
|
|
13
30
|
with_sources = true,
|
|
@@ -17,17 +34,28 @@ const View = (props) => {
|
|
|
17
34
|
with_enlarge = true,
|
|
18
35
|
tableau_height = 700,
|
|
19
36
|
} = data;
|
|
20
|
-
const { figure_note = [], data_provenance = {}, tableau_visualization } =
|
|
21
|
-
props.tableau_visualization_data || {};
|
|
22
37
|
|
|
23
38
|
const tableau_vis_url = flattenToAppURL(data.tableau_vis_url || '');
|
|
24
39
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
40
|
+
const tableau_visualization = getTableauVisualization(props);
|
|
41
|
+
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
const tableauVisId = flattenToAppURL(tableau_visualization['@id'] || '');
|
|
44
|
+
if (
|
|
45
|
+
isBlock &&
|
|
46
|
+
mode === 'edit' &&
|
|
47
|
+
tableau_vis_url &&
|
|
48
|
+
tableau_vis_url !== tableauVisId
|
|
49
|
+
) {
|
|
50
|
+
getContent(tableau_vis_url, null, id);
|
|
28
51
|
}
|
|
29
|
-
|
|
30
|
-
|
|
52
|
+
}, [id, isBlock, getContent, mode, tableau_vis_url, tableau_visualization]);
|
|
53
|
+
|
|
54
|
+
const { figure_note = [], data_provenance = {} } = tableau_visualization;
|
|
55
|
+
|
|
56
|
+
if (props.mode === 'edit' && !tableau_vis_url) {
|
|
57
|
+
return <Message>Please select a tableau from block editor.</Message>;
|
|
58
|
+
}
|
|
31
59
|
|
|
32
60
|
return (
|
|
33
61
|
<div className="embed-tableau">
|
|
@@ -35,33 +63,21 @@ const View = (props) => {
|
|
|
35
63
|
{...props}
|
|
36
64
|
data={{ ...data, url: tableau_visualization?.url }}
|
|
37
65
|
>
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
with_download,
|
|
54
|
-
with_share,
|
|
55
|
-
with_enlarge,
|
|
56
|
-
tableau_height,
|
|
57
|
-
tableau_vis_url,
|
|
58
|
-
}}
|
|
59
|
-
figure_note={figure_note}
|
|
60
|
-
sources={data_provenance.data || []}
|
|
61
|
-
/>
|
|
62
|
-
)}
|
|
63
|
-
</>
|
|
64
|
-
)}
|
|
66
|
+
<Tableau
|
|
67
|
+
data={{
|
|
68
|
+
...tableau_visualization,
|
|
69
|
+
with_notes,
|
|
70
|
+
with_sources,
|
|
71
|
+
with_more_info,
|
|
72
|
+
with_download,
|
|
73
|
+
with_share,
|
|
74
|
+
with_enlarge,
|
|
75
|
+
tableau_height,
|
|
76
|
+
tableau_vis_url,
|
|
77
|
+
}}
|
|
78
|
+
figure_note={figure_note}
|
|
79
|
+
sources={data_provenance?.data || []}
|
|
80
|
+
/>
|
|
65
81
|
</PrivacyProtection>
|
|
66
82
|
</div>
|
|
67
83
|
);
|
|
@@ -70,7 +86,8 @@ const View = (props) => {
|
|
|
70
86
|
export default compose(
|
|
71
87
|
connect(
|
|
72
88
|
(state, props) => ({
|
|
73
|
-
|
|
89
|
+
tableauContent: state.content.subrequests?.[props.id]?.data,
|
|
90
|
+
isBlock: !!props.data?.['@type'],
|
|
74
91
|
}),
|
|
75
92
|
{
|
|
76
93
|
getContent,
|
|
@@ -1,31 +1,51 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
3
|
-
import '@testing-library/jest-dom/extend-expect';
|
|
4
|
-
import { Provider } from 'react-redux';
|
|
2
|
+
import renderer from 'react-test-renderer';
|
|
5
3
|
import configureStore from 'redux-mock-store';
|
|
4
|
+
import { Provider } from 'react-intl-redux';
|
|
6
5
|
import View from './View';
|
|
7
6
|
|
|
8
7
|
const mockStore = configureStore([]);
|
|
9
|
-
const store = mockStore({ content: { subrequests: [] } });
|
|
10
8
|
|
|
11
9
|
window.URL.createObjectURL = jest.fn(() => 'test');
|
|
12
10
|
|
|
13
|
-
jest.mock('@eeacms/volto-embed', () => ({
|
|
14
|
-
PrivacyProtection: ({ children }) => <div>{children}</div>,
|
|
15
|
-
}));
|
|
16
|
-
|
|
17
11
|
jest.mock('@plone/volto/components', () => ({
|
|
18
12
|
Icon: ({ children }) => <img alt="incon">{children}</img>,
|
|
13
|
+
Toast: ({ children }) => <p>{children}</p>,
|
|
19
14
|
}));
|
|
20
15
|
|
|
21
|
-
jest.mock('@
|
|
22
|
-
|
|
16
|
+
jest.mock('@eeacms/volto-matomo/utils', () => ({
|
|
17
|
+
trackLink: jest.fn(),
|
|
23
18
|
}));
|
|
24
19
|
|
|
20
|
+
jest.mock(
|
|
21
|
+
'@eeacms/volto-embed/PrivacyProtection/PrivacyProtection',
|
|
22
|
+
() => ({ children }) => {
|
|
23
|
+
return children;
|
|
24
|
+
},
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
jest.mock('@eeacms/volto-embed/helpers', () => ({
|
|
28
|
+
pickMetadata: (data) => data,
|
|
29
|
+
}));
|
|
30
|
+
|
|
31
|
+
const store = mockStore({
|
|
32
|
+
intl: {
|
|
33
|
+
locale: 'en',
|
|
34
|
+
messages: {},
|
|
35
|
+
},
|
|
36
|
+
content: {
|
|
37
|
+
create: {},
|
|
38
|
+
subrequests: [],
|
|
39
|
+
},
|
|
40
|
+
connected_data_parameters: {},
|
|
41
|
+
});
|
|
42
|
+
|
|
25
43
|
describe('View', () => {
|
|
26
44
|
const data = {
|
|
27
45
|
'@type': 'embed_tableau_visualization',
|
|
28
|
-
dataprotection: {
|
|
46
|
+
dataprotection: {
|
|
47
|
+
enabled: false,
|
|
48
|
+
},
|
|
29
49
|
tableau_vis_url: 'http://localhost:3000/tableau-ct',
|
|
30
50
|
with_download: true,
|
|
31
51
|
with_more_info: true,
|
|
@@ -34,11 +54,12 @@ describe('View', () => {
|
|
|
34
54
|
};
|
|
35
55
|
|
|
36
56
|
it('should render the component', () => {
|
|
37
|
-
const
|
|
57
|
+
const component = renderer.create(
|
|
38
58
|
<Provider store={store}>
|
|
39
59
|
<View data={data} />
|
|
40
60
|
</Provider>,
|
|
41
61
|
);
|
|
42
|
-
|
|
62
|
+
const json = component.toJSON();
|
|
63
|
+
expect(json).toMatchSnapshot();
|
|
43
64
|
});
|
|
44
65
|
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`Edit should render the component 1`] = `
|
|
4
|
+
<div
|
|
5
|
+
className="embed-tableau"
|
|
6
|
+
>
|
|
7
|
+
<div
|
|
8
|
+
className="tableau-wrapper"
|
|
9
|
+
>
|
|
10
|
+
<div
|
|
11
|
+
className="tableau tableau-2.8.0"
|
|
12
|
+
style={
|
|
13
|
+
Object {
|
|
14
|
+
"height": "700px",
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
/>
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
20
|
+
`;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`View should render the component 1`] = `
|
|
4
|
+
<div
|
|
5
|
+
className="embed-tableau"
|
|
6
|
+
>
|
|
7
|
+
<div
|
|
8
|
+
className="tableau-wrapper"
|
|
9
|
+
>
|
|
10
|
+
<div
|
|
11
|
+
className="tableau tableau-2.8.0"
|
|
12
|
+
style={
|
|
13
|
+
Object {
|
|
14
|
+
"height": "700px",
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
/>
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
20
|
+
`;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import renderer from 'react-test-renderer';
|
|
3
|
+
import configureStore from 'redux-mock-store';
|
|
4
|
+
import { Provider } from 'react-intl-redux';
|
|
5
|
+
|
|
6
|
+
import Download from './Download';
|
|
7
|
+
|
|
8
|
+
const mockStore = configureStore([]);
|
|
9
|
+
|
|
10
|
+
window.URL.createObjectURL = jest.fn(() => 'test');
|
|
11
|
+
|
|
12
|
+
jest.mock('semantic-ui-react', () => ({
|
|
13
|
+
Popup: ({ content, trigger }) => {
|
|
14
|
+
return (
|
|
15
|
+
<div className="popup">
|
|
16
|
+
<div className="trigger">{trigger}</div>
|
|
17
|
+
<div className="content">{content}</div>
|
|
18
|
+
</div>
|
|
19
|
+
);
|
|
20
|
+
},
|
|
21
|
+
}));
|
|
22
|
+
|
|
23
|
+
const store = mockStore({
|
|
24
|
+
intl: {
|
|
25
|
+
locale: 'en',
|
|
26
|
+
messages: {},
|
|
27
|
+
},
|
|
28
|
+
content: {
|
|
29
|
+
create: {},
|
|
30
|
+
subrequests: [],
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
describe('Edit', () => {
|
|
35
|
+
it('should render the component', () => {
|
|
36
|
+
const component = renderer.create(
|
|
37
|
+
<Provider store={store}>
|
|
38
|
+
<Download />
|
|
39
|
+
</Provider>,
|
|
40
|
+
);
|
|
41
|
+
const json = component.toJSON();
|
|
42
|
+
expect(json).toMatchSnapshot();
|
|
43
|
+
});
|
|
44
|
+
});
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`Edit should render the component 1`] = `
|
|
4
|
+
<div
|
|
5
|
+
className="popup"
|
|
6
|
+
>
|
|
7
|
+
<div
|
|
8
|
+
className="trigger"
|
|
9
|
+
>
|
|
10
|
+
<div
|
|
11
|
+
className="tableau-download-container"
|
|
12
|
+
>
|
|
13
|
+
<button
|
|
14
|
+
className="trigger-button"
|
|
15
|
+
>
|
|
16
|
+
<i
|
|
17
|
+
className="ri-download-fill"
|
|
18
|
+
/>
|
|
19
|
+
Download
|
|
20
|
+
</button>
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
23
|
+
<div
|
|
24
|
+
className="content"
|
|
25
|
+
>
|
|
26
|
+
<div
|
|
27
|
+
className="item"
|
|
28
|
+
>
|
|
29
|
+
<span
|
|
30
|
+
className="label"
|
|
31
|
+
>
|
|
32
|
+
Data formats
|
|
33
|
+
</span>
|
|
34
|
+
<div
|
|
35
|
+
className="types"
|
|
36
|
+
>
|
|
37
|
+
<div
|
|
38
|
+
className="type"
|
|
39
|
+
>
|
|
40
|
+
<button
|
|
41
|
+
onClick={[Function]}
|
|
42
|
+
>
|
|
43
|
+
<span>
|
|
44
|
+
CSV
|
|
45
|
+
</span>
|
|
46
|
+
</button>
|
|
47
|
+
</div>
|
|
48
|
+
<div
|
|
49
|
+
className="type"
|
|
50
|
+
>
|
|
51
|
+
<button
|
|
52
|
+
onClick={[Function]}
|
|
53
|
+
>
|
|
54
|
+
<span>
|
|
55
|
+
Excel
|
|
56
|
+
</span>
|
|
57
|
+
</button>
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
61
|
+
<div
|
|
62
|
+
className="item"
|
|
63
|
+
>
|
|
64
|
+
<span
|
|
65
|
+
className="label"
|
|
66
|
+
>
|
|
67
|
+
Image formats
|
|
68
|
+
</span>
|
|
69
|
+
<div
|
|
70
|
+
className="types"
|
|
71
|
+
>
|
|
72
|
+
<div
|
|
73
|
+
className="type"
|
|
74
|
+
>
|
|
75
|
+
<button
|
|
76
|
+
onClick={[Function]}
|
|
77
|
+
>
|
|
78
|
+
<span>
|
|
79
|
+
PNG
|
|
80
|
+
</span>
|
|
81
|
+
</button>
|
|
82
|
+
</div>
|
|
83
|
+
</div>
|
|
84
|
+
</div>
|
|
85
|
+
<div
|
|
86
|
+
className="item"
|
|
87
|
+
>
|
|
88
|
+
<span
|
|
89
|
+
className="label"
|
|
90
|
+
>
|
|
91
|
+
Other formats
|
|
92
|
+
</span>
|
|
93
|
+
<div
|
|
94
|
+
className="types"
|
|
95
|
+
>
|
|
96
|
+
<div
|
|
97
|
+
className="type"
|
|
98
|
+
>
|
|
99
|
+
<button
|
|
100
|
+
onClick={[Function]}
|
|
101
|
+
>
|
|
102
|
+
<span>
|
|
103
|
+
PDF
|
|
104
|
+
</span>
|
|
105
|
+
</button>
|
|
106
|
+
</div>
|
|
107
|
+
</div>
|
|
108
|
+
</div>
|
|
109
|
+
</div>
|
|
110
|
+
</div>
|
|
111
|
+
`;
|