@eeacms/volto-tabs-block 1.2.4 → 1.2.9
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 +43 -2
- package/Jenkinsfile +53 -22
- package/Makefile +50 -0
- package/README.md +88 -2
- package/cypress/integration/block-basics.js +10 -9
- package/cypress/support/index.js +1 -1
- package/jest-addon.config.js +36 -0
- package/package.json +16 -11
- package/src/components/Edit.jsx +0 -2
- package/src/components/View.jsx +3 -0
- package/src/components/templates/carousel/HorizontalView.jsx +23 -6
- package/src/components/templates/default/View.jsx +2 -2
- package/src/index.js +1 -0
- package/src/less/carousel.less +0 -2
- package/src/less/tabs-block.less +0 -2
package/CHANGELOG.md
CHANGED
|
@@ -4,10 +4,52 @@ 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
|
+
#### [1.2.9](https://github.com/eea/volto-tabs-block/compare/1.2.8...1.2.9)
|
|
8
|
+
|
|
9
|
+
- Add SonarQube badges [`f2865ff`](https://github.com/eea/volto-tabs-block/commit/f2865ff2b36f04d8cb132e851a76af6c04846165)
|
|
10
|
+
|
|
11
|
+
#### [1.2.8](https://github.com/eea/volto-tabs-block/compare/1.2.7...1.2.8)
|
|
12
|
+
|
|
13
|
+
> 10 December 2021
|
|
14
|
+
|
|
15
|
+
- Develop [`#13`](https://github.com/eea/volto-tabs-block/pull/13)
|
|
16
|
+
- Correct Cypress tests [`#12`](https://github.com/eea/volto-tabs-block/pull/12)
|
|
17
|
+
- Refs #142010 - Optimize Volto-addons gitflow pipelines [`d10c0b3`](https://github.com/eea/volto-tabs-block/commit/d10c0b3d35d25c530d19eebde38dfe5da8fda01b)
|
|
18
|
+
|
|
19
|
+
#### [1.2.7](https://github.com/eea/volto-tabs-block/compare/1.2.6...1.2.7)
|
|
20
|
+
|
|
21
|
+
> 27 August 2021
|
|
22
|
+
|
|
23
|
+
- Remove hard dependencies to Volto add-ons to avoid dependencies hell [`#11`](https://github.com/eea/volto-tabs-block/pull/11)
|
|
24
|
+
- Develop [`#10`](https://github.com/eea/volto-tabs-block/pull/10)
|
|
25
|
+
- Develop [`#9`](https://github.com/eea/volto-tabs-block/pull/9)
|
|
26
|
+
- Cypress coverage [`#8`](https://github.com/eea/volto-tabs-block/pull/8)
|
|
27
|
+
- Remove hard dependencies to Volto add-ons [`58c579e`](https://github.com/eea/volto-tabs-block/commit/58c579ebcacb6f924642ee6094e0668b430462b9)
|
|
28
|
+
|
|
29
|
+
#### [1.2.6](https://github.com/eea/volto-tabs-block/compare/1.2.5...1.2.6)
|
|
30
|
+
|
|
31
|
+
> 29 July 2021
|
|
32
|
+
|
|
33
|
+
- Release 1.2.6 [`b316664`](https://github.com/eea/volto-tabs-block/commit/b316664577eb1dceec94d82622c9dc2056dffbba)
|
|
34
|
+
|
|
35
|
+
#### [1.2.5](https://github.com/eea/volto-tabs-block/compare/1.2.4...1.2.5)
|
|
36
|
+
|
|
37
|
+
> 29 July 2021
|
|
38
|
+
|
|
39
|
+
- Develop [`#10`](https://github.com/eea/volto-tabs-block/pull/10)
|
|
40
|
+
- Develop [`#9`](https://github.com/eea/volto-tabs-block/pull/9)
|
|
41
|
+
- Move less import in View instead of Edit [`84aeff0`](https://github.com/eea/volto-tabs-block/commit/84aeff04a980076f54687c546691d37b6e790478)
|
|
42
|
+
- gitignore tweaks [`f4c993d`](https://github.com/eea/volto-tabs-block/commit/f4c993d004b126f08f16651ab9460546fa9e9cad)
|
|
43
|
+
- Style update [`323aaaf`](https://github.com/eea/volto-tabs-block/commit/323aaafcad01d8fdf0e713a1fc254ae9fe319f43)
|
|
44
|
+
- Fix 'scroll to' feature on carousel [`16c6a08`](https://github.com/eea/volto-tabs-block/commit/16c6a08f6db687542ea38e07a92b265e592f6173)
|
|
45
|
+
- Better accesibility [`3511611`](https://github.com/eea/volto-tabs-block/commit/351161197270a4807f01d85a7055cbaadae72f8e)
|
|
46
|
+
- Add jest configuration [`c01b021`](https://github.com/eea/volto-tabs-block/commit/c01b0213bcb4b51408b6e3c196b2dcfa086377a9)
|
|
47
|
+
|
|
7
48
|
#### [1.2.4](https://github.com/eea/volto-tabs-block/compare/1.2.3...1.2.4)
|
|
8
49
|
|
|
50
|
+
> 27 May 2021
|
|
51
|
+
|
|
9
52
|
- Cypress coverage [`#8`](https://github.com/eea/volto-tabs-block/pull/8)
|
|
10
|
-
- [JENKINS] - Fix stylelint [`2319baa`](https://github.com/eea/volto-tabs-block/commit/2319baa8258828cd3847715779bc21d472bd7677)
|
|
11
53
|
- Added z-index [`5aa8221`](https://github.com/eea/volto-tabs-block/commit/5aa8221d20c02e34788571d9231e73431c1043fe)
|
|
12
54
|
|
|
13
55
|
#### [1.2.3](https://github.com/eea/volto-tabs-block/compare/1.2.2...1.2.3)
|
|
@@ -22,7 +64,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
22
64
|
|
|
23
65
|
> 12 May 2021
|
|
24
66
|
|
|
25
|
-
- JENKINS: auto-release pipeline [`#5`](https://github.com/eea/volto-tabs-block/pull/5)
|
|
26
67
|
- Update style for menu title & description [`0683074`](https://github.com/eea/volto-tabs-block/commit/06830749ca9655ba74e07984536020b826da0696)
|
|
27
68
|
- Updated styles [`104f8ab`](https://github.com/eea/volto-tabs-block/commit/104f8ab3cf60f7e4e54e84d1b523010e97be1f66)
|
|
28
69
|
- Prettier [`f1dd4bc`](https://github.com/eea/volto-tabs-block/commit/f1dd4bcd3d82c37db00810bdc7a11c7dee4c3276)
|
package/Jenkinsfile
CHANGED
|
@@ -4,13 +4,37 @@ pipeline {
|
|
|
4
4
|
environment {
|
|
5
5
|
GIT_NAME = "volto-tabs-block"
|
|
6
6
|
NAMESPACE = "@eeacms"
|
|
7
|
-
SONARQUBE_TAGS = "volto.eea.europa.eu"
|
|
8
|
-
DEPENDENCIES = ""
|
|
7
|
+
SONARQUBE_TAGS = "volto.eea.europa.eu,climate-energy.eea.europa.eu,biodiversity.europa.eu,www.eea.europa.eu-ims,sustainability.eionet.europa.eu,forest.eea.europa.eu,clms.land.copernicus.eu,industry.eea.europa.eu,water.europa.eu-freshwater"
|
|
8
|
+
DEPENDENCIES = "@eeacms/volto-block-style"
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
stages {
|
|
12
12
|
|
|
13
|
+
stage('Release') {
|
|
14
|
+
when {
|
|
15
|
+
allOf {
|
|
16
|
+
environment name: 'CHANGE_ID', value: ''
|
|
17
|
+
branch 'master'
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
steps {
|
|
21
|
+
node(label: 'docker') {
|
|
22
|
+
withCredentials([string(credentialsId: 'eea-jenkins-token', variable: 'GITHUB_TOKEN'),string(credentialsId: 'eea-jenkins-npm-token', variable: 'NPM_TOKEN')]) {
|
|
23
|
+
sh '''docker pull eeacms/gitflow'''
|
|
24
|
+
sh '''docker run -i --rm --name="$BUILD_TAG-gitflow-master" -e GIT_BRANCH="$BRANCH_NAME" -e GIT_NAME="$GIT_NAME" -e GIT_TOKEN="$GITHUB_TOKEN" -e NPM_TOKEN="$NPM_TOKEN" -e LANGUAGE=javascript eeacms/gitflow'''
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
13
30
|
stage('Code') {
|
|
31
|
+
when {
|
|
32
|
+
allOf {
|
|
33
|
+
environment name: 'CHANGE_ID', value: ''
|
|
34
|
+
not { changelog '.*^Automated release [0-9\\.]+$' }
|
|
35
|
+
not { branch 'master' }
|
|
36
|
+
}
|
|
37
|
+
}
|
|
14
38
|
steps {
|
|
15
39
|
parallel(
|
|
16
40
|
|
|
@@ -36,6 +60,15 @@ pipeline {
|
|
|
36
60
|
}
|
|
37
61
|
|
|
38
62
|
stage('Tests') {
|
|
63
|
+
when {
|
|
64
|
+
allOf {
|
|
65
|
+
environment name: 'CHANGE_ID', value: ''
|
|
66
|
+
anyOf {
|
|
67
|
+
not { changelog '.*^Automated release [0-9\\.]+$' }
|
|
68
|
+
branch 'master'
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
39
72
|
steps {
|
|
40
73
|
parallel(
|
|
41
74
|
|
|
@@ -75,6 +108,15 @@ pipeline {
|
|
|
75
108
|
}
|
|
76
109
|
|
|
77
110
|
stage('Integration tests') {
|
|
111
|
+
when {
|
|
112
|
+
allOf {
|
|
113
|
+
environment name: 'CHANGE_ID', value: ''
|
|
114
|
+
anyOf {
|
|
115
|
+
not { changelog '.*^Automated release [0-9\\.]+$' }
|
|
116
|
+
branch 'master'
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
78
120
|
steps {
|
|
79
121
|
parallel(
|
|
80
122
|
|
|
@@ -122,10 +164,16 @@ pipeline {
|
|
|
122
164
|
}
|
|
123
165
|
|
|
124
166
|
stage('Report to SonarQube') {
|
|
125
|
-
// Exclude Pull-Requests
|
|
126
167
|
when {
|
|
127
168
|
allOf {
|
|
128
169
|
environment name: 'CHANGE_ID', value: ''
|
|
170
|
+
anyOf {
|
|
171
|
+
branch 'master'
|
|
172
|
+
allOf {
|
|
173
|
+
branch 'develop'
|
|
174
|
+
not { changelog '.*^Automated release [0-9\\.]+$' }
|
|
175
|
+
}
|
|
176
|
+
}
|
|
129
177
|
}
|
|
130
178
|
}
|
|
131
179
|
steps {
|
|
@@ -156,8 +204,8 @@ pipeline {
|
|
|
156
204
|
steps {
|
|
157
205
|
node(label: 'docker') {
|
|
158
206
|
script {
|
|
159
|
-
if ( env.CHANGE_BRANCH != "develop"
|
|
160
|
-
error "Pipeline aborted due to PR not made from develop
|
|
207
|
+
if ( env.CHANGE_BRANCH != "develop" ) {
|
|
208
|
+
error "Pipeline aborted due to PR not made from develop branch"
|
|
161
209
|
}
|
|
162
210
|
withCredentials([string(credentialsId: 'eea-jenkins-token', variable: 'GITHUB_TOKEN')]) {
|
|
163
211
|
sh '''docker pull eeacms/gitflow'''
|
|
@@ -168,23 +216,6 @@ pipeline {
|
|
|
168
216
|
}
|
|
169
217
|
}
|
|
170
218
|
|
|
171
|
-
stage('Release') {
|
|
172
|
-
when {
|
|
173
|
-
allOf {
|
|
174
|
-
environment name: 'CHANGE_ID', value: ''
|
|
175
|
-
branch 'master'
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
steps {
|
|
179
|
-
node(label: 'docker') {
|
|
180
|
-
withCredentials([string(credentialsId: 'eea-jenkins-token', variable: 'GITHUB_TOKEN'),string(credentialsId: 'eea-jenkins-npm-token', variable: 'NPM_TOKEN')]) {
|
|
181
|
-
sh '''docker pull eeacms/gitflow'''
|
|
182
|
-
sh '''docker run -i --rm --name="$BUILD_TAG-gitflow-master" -e GIT_BRANCH="$BRANCH_NAME" -e GIT_NAME="$GIT_NAME" -e GIT_TOKEN="$GITHUB_TOKEN" -e NPM_TOKEN="$NPM_TOKEN" -e LANGUAGE=javascript eeacms/gitflow'''
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
|
|
188
219
|
}
|
|
189
220
|
|
|
190
221
|
post {
|
package/Makefile
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
SHELL=/bin/bash
|
|
2
|
+
|
|
3
|
+
DIR=$(shell basename $$(pwd))
|
|
4
|
+
ADDON ?= "@eeacms/volto-tabs-block"
|
|
5
|
+
|
|
6
|
+
# We like colors
|
|
7
|
+
# From: https://coderwall.com/p/izxssa/colored-makefile-for-golang-projects
|
|
8
|
+
RED=`tput setaf 1`
|
|
9
|
+
GREEN=`tput setaf 2`
|
|
10
|
+
RESET=`tput sgr0`
|
|
11
|
+
YELLOW=`tput setaf 3`
|
|
12
|
+
|
|
13
|
+
project:
|
|
14
|
+
npm install -g yo
|
|
15
|
+
npm install -g @plone/generator-volto
|
|
16
|
+
npm install -g mrs-developer
|
|
17
|
+
yo @plone/volto project --addon ${ADDON} --workspace "src/addons/${DIR}" --no-interactive
|
|
18
|
+
ln -sf $$(pwd) project/src/addons/
|
|
19
|
+
cp .project.eslintrc.js .eslintrc.js
|
|
20
|
+
cd project && yarn
|
|
21
|
+
@echo "-------------------"
|
|
22
|
+
@echo "$(GREEN)Volto project is ready!$(RESET)"
|
|
23
|
+
@echo "$(RED)Now run: cd project && yarn start$(RESET)"
|
|
24
|
+
|
|
25
|
+
all: project
|
|
26
|
+
|
|
27
|
+
.PHONY: start-test-backend
|
|
28
|
+
start-test-backend: ## Start Test Plone Backend
|
|
29
|
+
@echo "$(GREEN)==> Start Test Plone Backend$(RESET)"
|
|
30
|
+
docker run -i --rm -e ZSERVER_HOST=0.0.0.0 -e ZSERVER_PORT=55001 -p 55001:55001 -e SITE=plone -e APPLY_PROFILES=plone.app.contenttypes:plone-content,plone.restapi:default,kitconcept.volto:default-homepage -e CONFIGURE_PACKAGES=plone.app.contenttypes,plone.restapi,kitconcept.volto,kitconcept.volto.cors -e ADDONS='plone.app.robotframework plone.app.contenttypes plone.restapi kitconcept.volto' plone ./bin/robot-server plone.app.robotframework.testing.PLONE_ROBOT_TESTING
|
|
31
|
+
|
|
32
|
+
.PHONY: start-backend-docker
|
|
33
|
+
start-backend-docker: ## Starts a Docker-based backend
|
|
34
|
+
@echo "$(GREEN)==> Start Docker-based Plone Backend$(RESET)"
|
|
35
|
+
docker run -it --rm --name=plone -p 8080:8080 -e SITE=Plone -e ADDONS="kitconcept.volto" -e ZCML="kitconcept.volto.cors" plone
|
|
36
|
+
|
|
37
|
+
.PHONY: test
|
|
38
|
+
test:
|
|
39
|
+
docker pull plone/volto-addon-ci
|
|
40
|
+
docker run -it --rm -e NAMESPACE="@eeacms" -e GIT_NAME="${DIR}" -e RAZZLE_JEST_CONFIG=jest-addon.config.js -v "$$(pwd):/opt/frontend/my-volto-project/src/addons/${DIR}" plone/volto-addon-ci yarn test --watchAll=false
|
|
41
|
+
|
|
42
|
+
.PHONY: test-update
|
|
43
|
+
test-update:
|
|
44
|
+
docker pull plone/volto-addon-ci
|
|
45
|
+
docker run -it --rm -e NAMESPACE="@eeacms" -e GIT_NAME="${DIR}" -e RAZZLE_JEST_CONFIG=jest-addon.config.js -v "$$(pwd):/opt/frontend/my-volto-project/src/addons/${DIR}" plone/volto-addon-ci yarn test --watchAll=false -u
|
|
46
|
+
|
|
47
|
+
.PHONY: help
|
|
48
|
+
help: ## Show this help.
|
|
49
|
+
@echo -e "$$(grep -hE '^\S+:.*##' $(MAKEFILE_LIST) | sed -e 's/:.*##\s*/:/' -e 's/^\(.\+\):\(.*\)/\\x1b[36m\1\\x1b[m:\2/' | column -c2 -t -s :)"
|
|
50
|
+
-s :)"
|
package/README.md
CHANGED
|
@@ -1,7 +1,18 @@
|
|
|
1
1
|
# volto-tabs-block
|
|
2
|
+
|
|
2
3
|
[](https://github.com/eea/volto-tabs-block/releases)
|
|
3
|
-
|
|
4
|
-
[](https://ci.eionet.europa.eu/view/Github/job/volto-addons/job/volto-tabs-block/job/master/display/redirect)
|
|
6
|
+
[](https://sonarqube.eea.europa.eu/dashboard?id=volto-tabs-block-master)
|
|
7
|
+
[](https://sonarqube.eea.europa.eu/dashboard?id=volto-tabs-block-master)
|
|
8
|
+
[](https://sonarqube.eea.europa.eu/dashboard?id=volto-tabs-block-master)
|
|
9
|
+
[](https://sonarqube.eea.europa.eu/dashboard?id=volto-tabs-block-master)
|
|
10
|
+
|
|
11
|
+
[](https://ci.eionet.europa.eu/view/Github/job/volto-addons/job/volto-tabs-block/job/develop/display/redirect)
|
|
12
|
+
[](https://sonarqube.eea.europa.eu/dashboard?id=volto-tabs-block-develop)
|
|
13
|
+
[](https://sonarqube.eea.europa.eu/dashboard?id=volto-tabs-block-develop)
|
|
14
|
+
[](https://sonarqube.eea.europa.eu/dashboard?id=volto-tabs-block-develop)
|
|
15
|
+
[](https://sonarqube.eea.europa.eu/dashboard?id=volto-tabs-block-develop)
|
|
5
16
|
|
|
6
17
|
[Volto](https://github.com/plone/volto) add-on
|
|
7
18
|
|
|
@@ -48,6 +59,81 @@ Demo GIF
|
|
|
48
59
|
|
|
49
60
|
1. Happy editing!
|
|
50
61
|
|
|
62
|
+
## Release
|
|
63
|
+
|
|
64
|
+
### Automatic release using Jenkins
|
|
65
|
+
|
|
66
|
+
* The automatic release is started by creating a [Pull Request](../../compare/master...develop) from `develop` to `master`. The pull request status checks correlated to the branch and PR Jenkins jobs need to be processed successfully. 1 review from a github user with rights is mandatory.
|
|
67
|
+
* It runs on every commit on `master` branch, which is protected from direct commits, only allowing pull request merge commits.
|
|
68
|
+
* The automatic release is done by [Jenkins](https://ci.eionet.europa.eu). The status of the release job can be seen both in the Readme.md badges and the green check/red cross/yellow circle near the last commit information. If you click on the icon, you will have the list of checks that were run. The `continuous-integration/jenkins/branch` link goes to the Jenkins job execution webpage.
|
|
69
|
+
* Automated release scripts are located in the `eeacms/gitflow` docker image, specifically [js-release.sh](https://github.com/eea/eea.docker.gitflow/blob/master/src/js-release.sh) script. It uses the `release-it` tool.
|
|
70
|
+
* As long as a PR request is open from develop to master, the PR Jenkins job will automatically re-create the CHANGELOG.md and package.json files to be production-ready.
|
|
71
|
+
* The version format must be MAJOR.MINOR.PATCH. By default, next release is set to next minor version (with patch 0).
|
|
72
|
+
* You can manually change the version in `package.json`. The new version must not be already present in the tags/releases of the repository, otherwise it will be automatically increased by the script. Any changes to the version will trigger a `CHANGELOG.md` re-generation.
|
|
73
|
+
* Automated commits and commits with [JENKINS] or [YARN] in the commit log are excluded from `CHANGELOG.md` file.
|
|
74
|
+
|
|
75
|
+
### Manual release from the develop branch ( beta release )
|
|
76
|
+
|
|
77
|
+
#### Installation and configuration of release-it
|
|
78
|
+
|
|
79
|
+
You need to first install the [release-it](https://github.com/release-it/release-it) client.
|
|
80
|
+
|
|
81
|
+
```
|
|
82
|
+
npm install -g release-it
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Release-it uses the configuration written in the [`.release-it.json`](./.release-it.json) file located in the root of the repository.
|
|
86
|
+
|
|
87
|
+
Release-it is a tool that automates 4 important steps in the release process:
|
|
88
|
+
|
|
89
|
+
1. Version increase in `package.json` ( increased from the current version in `package.json`)
|
|
90
|
+
2. `CHANGELOG.md` automatic generation from commit messages ( grouped by releases )
|
|
91
|
+
3. GitHub release on the commit with the changelog and package.json modification on the develop branch
|
|
92
|
+
4. NPM release ( by default it's disabled, but can be enabled in the configuration file )
|
|
93
|
+
|
|
94
|
+
To configure the authentification, you need to export GITHUB_TOKEN for [GitHub](https://github.com/settings/tokens)
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
export GITHUB_TOKEN=XXX-XXXXXXXXXXXXXXXXXXXXXX
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
To configure npm, you can use the `npm login` command or use a configuration file with a TOKEN :
|
|
101
|
+
|
|
102
|
+
```
|
|
103
|
+
echo "//registry.npmjs.org/:_authToken=YYYYYYYYYYYYYYYYYYYYYYYYYYYYYY" > .npmrc
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
#### Using release-it tool
|
|
107
|
+
|
|
108
|
+
There are 3 yarn scripts that can be run to do the release
|
|
109
|
+
|
|
110
|
+
##### yarn release-beta
|
|
111
|
+
|
|
112
|
+
Automatically calculates and presents 3 beta versions - patch, minor and major for you to choose ( or Other for manual input).
|
|
113
|
+
|
|
114
|
+
```
|
|
115
|
+
? Select increment (next version):
|
|
116
|
+
❯ prepatch (0.1.1-beta.0)
|
|
117
|
+
preminor (0.2.0-beta.0)
|
|
118
|
+
premajor (1.0.0-beta.0)
|
|
119
|
+
Other, please specify...
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
##### yarn release-major-beta
|
|
123
|
+
|
|
124
|
+
Same as `yarn release-beta`, but with premajor version pre-selected.
|
|
125
|
+
|
|
126
|
+
##### yarn release
|
|
127
|
+
|
|
128
|
+
Generic command, does not automatically add the `beta` to version, but you can still manually write it if you choose Other.
|
|
129
|
+
|
|
130
|
+
#### Important notes
|
|
131
|
+
|
|
132
|
+
> Do not use release-it tool on master branch, the commit on CHANGELOG.md file and the version increase in the package.json file can't be done without a PULL REQUEST.
|
|
133
|
+
|
|
134
|
+
> Do not keep Pull Requests from develop to master branches open when you are doing beta releases from the develop branch. As long as a PR to master is open, an automatic script will run on every commit and will update both the version and the changelog to a production-ready state - ( MAJOR.MINOR.PATCH mandatory format for version).
|
|
135
|
+
|
|
136
|
+
|
|
51
137
|
## How to contribute
|
|
52
138
|
|
|
53
139
|
See [DEVELOP.md](https://github.com/eea/volto-tabs-block/blob/master/DEVELOP.md).
|
|
@@ -5,16 +5,17 @@ describe('Blocks Tests', () => {
|
|
|
5
5
|
afterEach(tearDownAfterEach);
|
|
6
6
|
|
|
7
7
|
it('Add Block: Empty', () => {
|
|
8
|
+
// without this the clear command below does nothing sometimes
|
|
9
|
+
cy.wait(500);
|
|
10
|
+
|
|
8
11
|
// Change page title
|
|
9
|
-
cy.get('.
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
cy.get('
|
|
16
|
-
'{enter}',
|
|
17
|
-
);
|
|
12
|
+
cy.get('[contenteditable=true]').first().clear();
|
|
13
|
+
|
|
14
|
+
cy.get('[contenteditable=true]').first().type('My Add-on Page');
|
|
15
|
+
|
|
16
|
+
cy.get('.documentFirstHeading').contains('My Add-on Page');
|
|
17
|
+
|
|
18
|
+
cy.get('[contenteditable=true]').first().type('{enter}');
|
|
18
19
|
|
|
19
20
|
// Add block
|
|
20
21
|
cy.get('.ui.basic.icon.button.block-add-button').first().click();
|
package/cypress/support/index.js
CHANGED
|
@@ -44,7 +44,7 @@ export const setupBeforeEach = () => {
|
|
|
44
44
|
cy.waitForResourceToLoad('@types');
|
|
45
45
|
cy.waitForResourceToLoad('my-page');
|
|
46
46
|
cy.navigate('/cypress/my-page/edit');
|
|
47
|
-
cy.get(`.block.title
|
|
47
|
+
cy.get(`.block.title h1`);
|
|
48
48
|
};
|
|
49
49
|
|
|
50
50
|
export const tearDownAfterEach = () => {
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
testMatch: ['**/src/addons/**/?(*.)+(spec|test).[jt]s?(x)'],
|
|
3
|
+
collectCoverageFrom: [
|
|
4
|
+
'src/addons/**/src/**/*.{js,jsx,ts,tsx}',
|
|
5
|
+
'!src/**/*.d.ts',
|
|
6
|
+
],
|
|
7
|
+
moduleNameMapper: {
|
|
8
|
+
'@plone/volto/cypress': '<rootDir>/node_modules/@plone/volto/cypress',
|
|
9
|
+
'@plone/volto/babel': '<rootDir>/node_modules/@plone/volto/babel',
|
|
10
|
+
'@plone/volto/(.*)$': '<rootDir>/node_modules/@plone/volto/src/$1',
|
|
11
|
+
'@package/(.*)$': '<rootDir>/src/$1',
|
|
12
|
+
'@plone/volto-quanta/(.*)$': '<rootDir>/src/addons/volto-quanta/src/$1',
|
|
13
|
+
'@eeacms/(.*?)/(.*)$': '<rootDir>/src/addons/$1/src/$2',
|
|
14
|
+
'volto-slate/(.*)$': '<rootDir>/src/addons/volto-slate/src/$1',
|
|
15
|
+
'~/(.*)$': '<rootDir>/src/$1',
|
|
16
|
+
'load-volto-addons':
|
|
17
|
+
'<rootDir>/node_modules/@plone/volto/jest-addons-loader.js',
|
|
18
|
+
},
|
|
19
|
+
transform: {
|
|
20
|
+
'^.+\\.js(x)?$': 'babel-jest',
|
|
21
|
+
'^.+\\.css$': 'jest-css-modules',
|
|
22
|
+
'^.+\\.less$': 'jest-css-modules',
|
|
23
|
+
'^.+\\.scss$': 'jest-css-modules',
|
|
24
|
+
'^.+\\.(png)$': 'jest-file',
|
|
25
|
+
'^.+\\.(jpg)$': 'jest-file',
|
|
26
|
+
'^.+\\.(svg)$': './node_modules/@plone/volto/jest-svgsystem-transform.js',
|
|
27
|
+
},
|
|
28
|
+
coverageThreshold: {
|
|
29
|
+
global: {
|
|
30
|
+
branches: 5,
|
|
31
|
+
functions: 5,
|
|
32
|
+
lines: 5,
|
|
33
|
+
statements: 5,
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eeacms/volto-tabs-block",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.9",
|
|
4
4
|
"description": "volto-tabs-block: Volto add-on",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"author": "European Environment Agency: IDM2 A-Team",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"react-slick": "^0.24.0",
|
|
24
24
|
"slick-carousel": "^1.8.1",
|
|
25
|
-
"@eeacms/volto-block-style": "
|
|
25
|
+
"@eeacms/volto-block-style": "*"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@cypress/code-coverage": "^3.9.5",
|
|
@@ -30,16 +30,21 @@
|
|
|
30
30
|
},
|
|
31
31
|
"scripts": {
|
|
32
32
|
"release": "release-it",
|
|
33
|
-
"
|
|
33
|
+
"release-major-beta": "release-it major --preRelease=beta",
|
|
34
|
+
"release-beta": "release-it --preRelease=beta",
|
|
34
35
|
"bootstrap": "npm install -g ejs; npm link ejs; node bootstrap",
|
|
35
|
-
"
|
|
36
|
-
"
|
|
36
|
+
"test": "make test",
|
|
37
|
+
"test:fix": "make test-update",
|
|
38
|
+
"i18n": "rm -rf build/messages && NODE_ENV=production node src/i18n.js",
|
|
39
|
+
"pre-commit": "yarn stylelint:fix && yarn prettier:fix && yarn lint:fix",
|
|
40
|
+
"stylelint": "if [ -d ./project ]; then ./project/node_modules/stylelint/bin/stylelint.js --allow-empty-input 'src/**/*.{css,less}'; else ../../../node_modules/stylelint/bin/stylelint.js --allow-empty-input 'src/**/*.{css,less}'; fi",
|
|
41
|
+
"stylelint:overrides": "if [ -d ./project ]; then ./project/node_modules/.bin/stylelint --syntax less --allow-empty-input 'theme/**/*.overrides' 'src/**/*.overrides'; else ../../../node_modules/.bin/stylelint --syntax less --allow-empty-input 'theme/**/*.overrides' 'src/**/*.overrides'; fi",
|
|
37
42
|
"stylelint:fix": "yarn stylelint --fix && yarn stylelint:overrides --fix",
|
|
38
|
-
"prettier": "../../../node_modules/.bin/prettier --single-quote --check 'src/**/*.{js,jsx,json,css,less,md}'",
|
|
39
|
-
"prettier:fix": "../../../node_modules/.bin/prettier --single-quote --write 'src/**/*.{js,jsx,json,css,less,md}'",
|
|
40
|
-
"lint": "../../../node_modules/eslint/bin/eslint.js --max-warnings=0 'src/**/*.{js,jsx}'",
|
|
41
|
-
"lint:fix": "../../../node_modules/eslint/bin/eslint.js --fix 'src/**/*.{js,jsx}'",
|
|
42
|
-
"cypress:run": "../../../node_modules/cypress/bin/cypress run",
|
|
43
|
-
"cypress:open": "../../../node_modules/cypress/bin/cypress open"
|
|
43
|
+
"prettier": "if [ -d ./project ]; then ./project/node_modules/.bin/prettier --single-quote --check 'src/**/*.{js,jsx,json,css,less,md}'; else ../../../node_modules/.bin/prettier --single-quote --check 'src/**/*.{js,jsx,json,css,less,md}'; fi",
|
|
44
|
+
"prettier:fix": "if [ -d ./project ]; then ./project/node_modules/.bin/prettier --single-quote --write 'src/**/*.{js,jsx,json,css,less,md}'; else ../../../node_modules/.bin/prettier --single-quote --write 'src/**/*.{js,jsx,json,css,less,md}'; fi",
|
|
45
|
+
"lint": "if [ -d ./project ]; then ./project/node_modules/eslint/bin/eslint.js --max-warnings=0 'src/**/*.{js,jsx}'; else ../../../node_modules/eslint/bin/eslint.js --max-warnings=0 'src/**/*.{js,jsx}'; fi",
|
|
46
|
+
"lint:fix": "if [ -d ./project ]; then ./project/node_modules/eslint/bin/eslint.js --fix 'src/**/*.{js,jsx}'; else ../../../node_modules/eslint/bin/eslint.js --fix 'src/**/*.{js,jsx}'; fi",
|
|
47
|
+
"cypress:run": "if [ -d ./project ]; then ./project/node_modules/cypress/bin/cypress run; else ../../../node_modules/cypress/bin/cypress run; fi",
|
|
48
|
+
"cypress:open": "if [ -d ./project ]; then ./project/node_modules/cypress/bin/cypress open; else ../../../node_modules/cypress/bin/cypress open; fi"
|
|
44
49
|
}
|
|
45
50
|
}
|
package/src/components/Edit.jsx
CHANGED
package/src/components/View.jsx
CHANGED
|
@@ -6,6 +6,8 @@ import cx from 'classnames';
|
|
|
6
6
|
|
|
7
7
|
import config from '@plone/volto/registry';
|
|
8
8
|
|
|
9
|
+
import '@eeacms/volto-tabs-block/less/tabs-block.less';
|
|
10
|
+
|
|
9
11
|
const View = (props) => {
|
|
10
12
|
const view = React.useRef(null);
|
|
11
13
|
const { data = {}, uiContainer = '' } = props;
|
|
@@ -33,6 +35,7 @@ const View = (props) => {
|
|
|
33
35
|
>
|
|
34
36
|
<div
|
|
35
37
|
className={cx('tabs-block', template, theme, verticalAlign)}
|
|
38
|
+
id={props.id}
|
|
36
39
|
ref={view}
|
|
37
40
|
>
|
|
38
41
|
<StyleWrapperView
|
|
@@ -26,6 +26,7 @@ const Dots = (props) => {
|
|
|
26
26
|
className={cx({ 'slick-active': activeTab === tab })}
|
|
27
27
|
>
|
|
28
28
|
<button
|
|
29
|
+
aria-label={`Select slide ${index + 1}`}
|
|
29
30
|
onClick={() => {
|
|
30
31
|
if (slider.current) {
|
|
31
32
|
slider.current.slickGoTo(index);
|
|
@@ -55,7 +56,7 @@ const ArrowsGroup = (props) => {
|
|
|
55
56
|
>
|
|
56
57
|
{currentSlide > 0 ? (
|
|
57
58
|
<button
|
|
58
|
-
|
|
59
|
+
aria-label="Previous slide"
|
|
59
60
|
className="slick-arrow slick-prev"
|
|
60
61
|
onClick={() => {
|
|
61
62
|
if (slider.current) {
|
|
@@ -70,7 +71,7 @@ const ArrowsGroup = (props) => {
|
|
|
70
71
|
)}
|
|
71
72
|
{currentSlide < slideCount - 1 ? (
|
|
72
73
|
<button
|
|
73
|
-
|
|
74
|
+
aria-label="Next slide"
|
|
74
75
|
className="slick-arrow slick-next"
|
|
75
76
|
onClick={() => {
|
|
76
77
|
if (slider.current) {
|
|
@@ -118,6 +119,18 @@ const View = (props) => {
|
|
|
118
119
|
},
|
|
119
120
|
};
|
|
120
121
|
|
|
122
|
+
React.useEffect(() => {
|
|
123
|
+
if (!slider.current?.innerSlider?.list) return;
|
|
124
|
+
const unfocuseElements = ['a', 'button', 'input'];
|
|
125
|
+
unfocuseElements.forEach((tag) => {
|
|
126
|
+
for (let element of slider.current.innerSlider.list.querySelectorAll(
|
|
127
|
+
".slick-slide[aria-hidden='true'] a",
|
|
128
|
+
)) {
|
|
129
|
+
element.setAttribute('aria-hiden', 'true');
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
}, [activeTab]);
|
|
133
|
+
|
|
121
134
|
React.useEffect(() => {
|
|
122
135
|
const urlHash = props.location.hash.substring(1) || '';
|
|
123
136
|
if (
|
|
@@ -130,10 +143,14 @@ const View = (props) => {
|
|
|
130
143
|
const parent = document.getElementById(parentId);
|
|
131
144
|
// TODO: Find the best way to add offset relative to header
|
|
132
145
|
// The header can be static on mobile and relative on > mobile
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
146
|
+
const headerWrapper = document.querySelector('.header-wrapper');
|
|
147
|
+
const offsetHeight = headerWrapper?.offsetHeight || 0;
|
|
148
|
+
if (
|
|
149
|
+
id !== parentId &&
|
|
150
|
+
parentId === hashlink.data.parentId &&
|
|
151
|
+
index > -1 &&
|
|
152
|
+
parent
|
|
153
|
+
) {
|
|
137
154
|
if (activeTabIndex !== index) {
|
|
138
155
|
slider.current.slickGoTo(index);
|
|
139
156
|
}
|
|
@@ -103,7 +103,7 @@ const View = (props) => {
|
|
|
103
103
|
},
|
|
104
104
|
render: () => {
|
|
105
105
|
return (
|
|
106
|
-
<Tab.Pane>
|
|
106
|
+
<Tab.Pane className={uiContainer}>
|
|
107
107
|
{' '}
|
|
108
108
|
<RenderBlocks {...props} metadata={metadata} content={tabs[tab]} />
|
|
109
109
|
</Tab.Pane>
|
|
@@ -116,7 +116,7 @@ const View = (props) => {
|
|
|
116
116
|
<>
|
|
117
117
|
<Tab
|
|
118
118
|
activeIndex={activeTabIndex}
|
|
119
|
-
className={cx('default tabs', menuPosition
|
|
119
|
+
className={cx('default tabs', menuPosition)}
|
|
120
120
|
menu={{
|
|
121
121
|
className: cx(menuAlign),
|
|
122
122
|
}}
|
package/src/index.js
CHANGED
package/src/less/carousel.less
CHANGED