Skip to content

Commit

Permalink
Merge pull request #14 from eea/develop
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
avoinea committed Jun 12, 2023
2 parents bad981d + 7ca9756 commit 16cbae9
Show file tree
Hide file tree
Showing 8 changed files with 107 additions and 39 deletions.
14 changes: 11 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,19 @@ All notable changes to this project will be documented in this file. Dates are d

Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

### [1.1.1](https://github.com/eea/volto-description-block/compare/1.1.0...1.1.1) - 19 May 2023
### [1.1.2](https://github.com/eea/volto-description-block/compare/1.1.1...1.1.2) - 12 June 2023

#### :house: Internal changes

#### :bug: Bug Fixes
- chore: [JENKINS] Deprecate circularity website [valentinab25 - [`5a4d802`](https://github.com/eea/volto-description-block/commit/5a4d80276c4b9474484236e371eec034d49d3381)]

- fix: add description widget on id if the field is added by behavior [Miu Razvan - [`f5ca547`](https://github.com/eea/volto-description-block/commit/f5ca547cd1e7f02513ef63b62f993d150819aff1)]
#### :hammer_and_wrench: Others

- test: jest should look for addons in node_modules Refs #253277 [valentinab25 - [`e1842ff`](https://github.com/eea/volto-description-block/commit/e1842ffb1d825c5dab556003e6d9343ef1f8329e)]
- test: add cypress test for basic functionality - refs #252543 [ana-oprea - [`f325ce8`](https://github.com/eea/volto-description-block/commit/f325ce852665e7b26455cc23efcf3b8ca18a04c2)]
- test: Solve issues identified by Sonarqube [dana-cfc4 - [`d480a92`](https://github.com/eea/volto-description-block/commit/d480a92fa31425d05c84cb630bf4ad464391e9d5)]
- test: Fix test config, coverage Refs #253277 [valentinab25 - [`4990f7b`](https://github.com/eea/volto-description-block/commit/4990f7b7e486b895a8052b4458488f2f63f8e47f)]
### [1.1.1](https://github.com/eea/volto-description-block/compare/1.1.0...1.1.1) - 19 May 2023

#### :hammer_and_wrench: Others

Expand Down
3 changes: 2 additions & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pipeline {
environment {
GIT_NAME = "volto-description-block"
NAMESPACE = "@eeacms"
SONARQUBE_TAGS = "volto.eea.europa.eu,demo-www.eea.europa.eu,circularity.eea.europa.eu,forest.eea.europa.eu,clmsdemo.devel6cph.eea.europa.eu,water.europa.eu-marine,biodiversity.europa.eu,climate-adapt.eea.europa.eu,climate-energy.eea.europa.eu,climate-advisory-board.devel4cph.eea.europa.eu,climate-advisory-board.europa.eu,www.eea.europa.eu-ims,www.eea.europa.eu-en,industry.eea.europa.eu"
SONARQUBE_TAGS = "volto.eea.europa.eu,demo-www.eea.europa.eu,forest.eea.europa.eu,clmsdemo.devel6cph.eea.europa.eu,water.europa.eu-marine,biodiversity.europa.eu,climate-adapt.eea.europa.eu,climate-energy.eea.europa.eu,climate-advisory-board.devel4cph.eea.europa.eu,climate-advisory-board.europa.eu,www.eea.europa.eu-ims,www.eea.europa.eu-en,industry.eea.europa.eu"
DEPENDENCIES = ""
VOLTO = ""
}
Expand Down Expand Up @@ -188,6 +188,7 @@ pipeline {
def nodeJS = tool 'NodeJS';
withSonarQubeEnv('Sonarqube') {
sh '''sed -i "s#/opt/frontend/my-volto-project/src/addons/${GIT_NAME}/##g" xunit-reports/coverage/lcov.info'''
sh '''sed -i "s#src/addons/${GIT_NAME}/##g" xunit-reports/coverage/lcov.info'''
sh "export PATH=${scannerHome}/bin:${nodeJS}/bin:$PATH; sonar-scanner -Dsonar.javascript.lcov.reportPaths=./xunit-reports/coverage/lcov.info,./cypress-coverage/coverage/lcov.info -Dsonar.sources=./src -Dsonar.projectKey=$GIT_NAME-$BRANCH_NAME -Dsonar.projectVersion=$BRANCH_NAME-$BUILD_NUMBER"
sh '''try=2; while [ \$try -gt 0 ]; do curl -s -XPOST -u "${SONAR_AUTH_TOKEN}:" "${SONAR_HOST_URL}api/project_tags/set?project=${GIT_NAME}-${BRANCH_NAME}&tags=${SONARQUBE_TAGS},${BRANCH_NAME}" > set_tags_result; if [ \$(grep -ic error set_tags_result ) -eq 0 ]; then try=0; else cat set_tags_result; echo "... Will retry"; sleep 60; try=\$(( \$try - 1 )); fi; done'''
}
Expand Down
29 changes: 0 additions & 29 deletions cypress/e2e/01-block-basics.cy.js

This file was deleted.

89 changes: 89 additions & 0 deletions cypress/e2e/01-description-block-basics.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
import { slateBeforeEach, slateAfterEach } from '../support/e2e';

describe('Blocks Tests', () => {
beforeEach(slateBeforeEach);
afterEach(slateAfterEach);

it('Add Block', () => {
// Change page title
cy.clearSlateTitle();
cy.getSlateTitle().type('Volto Description Block Demo');
cy.get('.documentFirstHeading').contains('Volto Description Block Demo');

cy.getSlate().click();

// Add block
cy.get('.ui.basic.icon.button.block-add-button').first().click();
cy.get('.blocks-chooser .title').contains('Common').click();
cy.get('.content.active.common .button.listing')
.contains('Listing')
.click({ force: true });

// Save
cy.get('#toolbar-save').click();
cy.url().should('eq', Cypress.config().baseUrl + '/cypress/my-page');

cy.contains('Volto Description Block Demo');
cy.get('.block.listing');

// Add a page to our site at the path cypress/my-page so it can be removed at the end of the test
cy.createContent({
contentType: 'Document',
contentId: 'page-1',
contentTitle: 'Page 1',
path: 'cypress/my-page',
});

// Visit the new page
cy.visit('cypress/my-page/page-1');
cy.url().should('eq', Cypress.config().baseUrl + '/cypress/my-page/page-1');

cy.get('.edit').click();

// Add a description block
cy.getSlate().click();
cy.get('.ui.basic.icon.button.block-add-button').first().click();
cy.get(".blocks-chooser .ui.form .field.searchbox input[type='text']").type(
'description',
);
cy.get('.button.description').click();

// Add some text
cy.get('.documentDescription div[role="textbox"]')
.click()
.type('lorem ipsum dolor sit amet');

// Select a part of the text and make it bold
cy.get('.documentDescription [contenteditable=true]').setSelection('lorem');
cy.get('.ui.buttons .button-wrapper a[title="Bold"]').click({
force: true,
});

// Select another part of the text and make it italic
cy.get('.documentDescription div[role="textbox"]').click();
cy.get('.documentDescription [contenteditable=true]').setSelection('ipsum');
cy.get('.ui.buttons .button-wrapper a[title="Italic"]').click({
force: true,
});

// Select another part of the text and make it a subscript
cy.get('.documentDescription div[role="textbox"]').click();
cy.get('.documentDescription [contenteditable=true]').setSelection(
'dolor sit amet',
);
cy.get('.ui.buttons .button-wrapper a[title="Subscript"]').click({
force: true,
});

cy.contains('lorem ipsum dolor sit amet');
cy.get('#field-description').contains('lorem ipsum dolor sit amet');

cy.get('#toolbar-save').click();

// The page view should contain our changes
cy.get('.documentDescription').contains('lorem ipsum dolor sit amet');
cy.visit('/cypress/my-page');
cy.url().should('eq', Cypress.config().baseUrl + '/cypress/my-page');
cy.contains('lorem ipsum dolor sit amet');
});
});
4 changes: 2 additions & 2 deletions jest-addon.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ module.exports = {
'!src/**/*.d.ts',
],
moduleNameMapper: {
'\\.(css|less|scss|sass)$': 'identity-obj-proxy',
'@plone/volto/cypress': '<rootDir>/node_modules/@plone/volto/cypress',
'@plone/volto/babel': '<rootDir>/node_modules/@plone/volto/babel',
'@plone/volto/(.*)$': '<rootDir>/node_modules/@plone/volto/src/$1',
'@package/(.*)$': '<rootDir>/src/$1',
'@root/(.*)$': '<rootDir>/src/$1',
'@plone/volto-quanta/(.*)$': '<rootDir>/src/addons/volto-quanta/src/$1',
'@eeacms/(.*?)/(.*)$': '<rootDir>/src/addons/$1/src/$2',
'@eeacms/(.*?)/(.*)$': '<rootDir>/node_modules/@eeacms/$1/src/$2',
'@plone/volto-slate':
'<rootDir>/node_modules/@plone/volto/packages/volto-slate/src',
'~/(.*)$': '<rootDir>/src/$1',
'load-volto-addons':
'<rootDir>/node_modules/@plone/volto/jest-addons-loader.js',
'\\.(css|less|scss|sass)$': 'identity-obj-proxy',
},
transform: {
'^.+\\.js(x)?$': 'babel-jest',
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eeacms/volto-description-block",
"version": "1.1.1",
"version": "1.1.2",
"description": "@eeacms/volto-description-block: Volto add-on",
"main": "src/index.js",
"author": "European Environment Agency: IDM2 A-Team",
Expand Down
2 changes: 1 addition & 1 deletion src/DescriptionBlock/DescriptionWidget.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ const TextareaWidget = (props) => {
const [lengthError, setlengthError] = useState('');

const onhandleChange = (id, value) => {
if (maxLength & value?.length) {
if (maxLength && value?.length) {
let remlength = maxLength - value.length;
if (remlength < 0) {
setlengthError(`You have exceed word limit by ${Math.abs(remlength)}`);
Expand Down
3 changes: 1 addition & 2 deletions src/DescriptionBlock/Edit.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ import React, { useCallback, useMemo } from 'react';
import { connect } from 'react-redux';
import { defineMessages, useIntl } from 'react-intl';
import config from '@plone/volto/registry';
import { SidebarPortal } from '@plone/volto/components';
import { BlockDataForm } from '@plone/volto/components';
import { SidebarPortal, BlockDataForm } from '@plone/volto/components';
import { handleKey } from '@plone/volto-slate/blocks/Text/keyboard';
import { saveSlateBlockSelection } from '@plone/volto-slate/actions';
import SlateEditor from '@plone/volto-slate/editor/SlateEditor';
Expand Down

0 comments on commit 16cbae9

Please sign in to comment.