Skip to content

Commit

Permalink
Merge pull request #23 from eea/develop
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
avoinea authored Jun 12, 2023
2 parents f59a309 + 2b359f7 commit da44d8c
Show file tree
Hide file tree
Showing 6 changed files with 239 additions and 4 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,22 @@ 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).

### [6.1.2](https://github.com/eea/volto-block-divider/compare/6.1.1...6.1.2) - 12 June 2023

#### :house: Internal changes

- chore: [JENKINS] Deprecate circularity website [valentinab25 - [`025726b`](https://github.com/eea/volto-block-divider/commit/025726b23acb6069d001e533ac6f168d36a212a3)]

#### :hammer_and_wrench: Others

- test: jest should look for addons in node_modules Refs #253277 [valentinab25 - [`628e909`](https://github.com/eea/volto-block-divider/commit/628e909d54d08ec5cd3678ea7da4286ff6859db9)]
- test: Add unit tests for View - refs #253277 [ana-oprea - [`9ed24a5`](https://github.com/eea/volto-block-divider/commit/9ed24a5b962dc8e87f1958130edb06c8d81685de)]
- test: Fix test config, coverage Refs #253277 [valentinab25 - [`a09cfca`](https://github.com/eea/volto-block-divider/commit/a09cfca3a3ad812807f2b1b1e54f4ae11e312a87)]
### [6.1.1](https://github.com/eea/volto-block-divider/compare/6.1.0...6.1.1) - 5 April 2023

#### :bug: Bug Fixes

- fix(divider): short width option #21 from eea/develop [ichim-david - [`f59a309`](https://github.com/eea/volto-block-divider/commit/f59a309fd8862ce0d736fc84be42da9b34c3ab72)]
- fix(divider): short option width difference on view render #20 from eea/divider-short-fix [ichim-david - [`d3c10f0`](https://github.com/eea/volto-block-divider/commit/d3c10f077bd8845360a40a01a6af51bb7f5b0fe9)]

#### :nail_care: Enhancements
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-block-divider"
NAMESPACE = "@eeacms"
SONARQUBE_TAGS = "volto.eea.europa.eu,biodiversity.europa.eu,www.eea.europa.eu-ims,climate-energy.eea.europa.eu,sustainability.eionet.europa.eu,forest.eea.europa.eu,clms.land.copernicus.eu,industry.eea.europa.eu,water.europa.eu-freshwater,demo-www.eea.europa.eu,clmsdemo.devel6cph.eea.europa.eu,circularity.eea.europa.eu,prod-www.eea.europa.eu,water.europa.eu-marine,demo-kitkat.dev2aws.eea.europa.eu,climate-adapt.eea.europa.eu,climate-advisory-board.devel4cph.eea.europa.eu,climate-advisory-board.europa.eu,www.eea.europa.eu-en"
SONARQUBE_TAGS = "volto.eea.europa.eu,biodiversity.europa.eu,www.eea.europa.eu-ims,climate-energy.eea.europa.eu,sustainability.eionet.europa.eu,forest.eea.europa.eu,clms.land.copernicus.eu,industry.eea.europa.eu,water.europa.eu-freshwater,demo-www.eea.europa.eu,clmsdemo.devel6cph.eea.europa.eu,prod-www.eea.europa.eu,water.europa.eu-marine,demo-kitkat.dev2aws.eea.europa.eu,climate-adapt.eea.europa.eu,climate-advisory-board.devel4cph.eea.europa.eu,climate-advisory-board.europa.eu,www.eea.europa.eu-en"
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
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-block-divider",
"version": "6.1.1",
"version": "6.1.2",
"description": "volto-block-divider: Volto add-on",
"main": "src/index.js",
"author": "European Environment Agency: IDM2 A-Team",
Expand Down
103 changes: 103 additions & 0 deletions src/components/Divider/View.test.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
import React from 'react';
import renderer from 'react-test-renderer';
import View from './View';

describe('View', () => {
it('should render the component', () => {
const component = renderer.create(<View data={{}} />);
const json = component.toJSON();
expect(json).toMatchSnapshot();
});

it('should render the component with prop hidden', () => {
const component = renderer.create(<View data={{ hidden: true }} />);
const json = component.toJSON();
expect(json).toMatchSnapshot();
expect(json.children[0].props.className).toContain('hidden');
});

it('should render the component with prop section', () => {
const component = renderer.create(<View data={{ section: true }} />);
const json = component.toJSON();
expect(json).toMatchSnapshot();
expect(json.children[0].props.className).toContain('section');
});

it('should render the component with prop fitted', () => {
const component = renderer.create(<View data={{ fitted: true }} />);
const json = component.toJSON();
expect(json).toMatchSnapshot();
expect(json.children[0].props.className).toContain('fitted');
});

it('should render the component with prop text', () => {
const component = renderer.create(<View data={{ text: 'test test' }} />);
const json = component.toJSON();
expect(json).toMatchSnapshot();
expect(json.children[0].props.className).toContain('horizontal');
});

it('should render the component with prop styles with theme', () => {
const component = renderer.create(
<View data={{ styles: { theme: 'test', inverted: true } }} />,
);
const json = component.toJSON();
expect(json).toMatchSnapshot();
expect(json.props.className).toContain('test');
expect(json.props.className).toContain('inverted');
});

it('should render the component with prop styles, with no theme', () => {
const component = renderer.create(
<View data={{ styles: { inverted: true } }} />,
);
const json = component.toJSON();
expect(json).toMatchSnapshot();
expect(json.children[0].props.className).toContain('inverted');
});

it('should render the component with short', () => {
const component = renderer.create(<View data={{ short: true }} />);
const json = component.toJSON();
expect(json).toMatchSnapshot();
expect(json.children[0].props.className).toContain('short');
});

it('should render the component with all props with no theme', () => {
const component = renderer.create(
<View
data={{
hidden: true,
fitted: true,
text: 'test test',
styles: { inverted: true },
}}
/>,
);
const json = component.toJSON();
expect(json).toMatchSnapshot();
expect(json.children[0].props.className).toContain('hidden');
expect(json.children[0].props.className).toContain('fitted');
expect(json.children[0].props.className).toContain('inverted');
expect(json.children[0].props.className).toContain('horizontal');
});

it('should render the component with all props with theme', () => {
const component = renderer.create(
<View
data={{
hidden: true,
fitted: true,
text: 'test test',
styles: { theme: 'test', inverted: true },
}}
/>,
);
const json = component.toJSON();
expect(json).toMatchSnapshot();
expect(json.props.className).toContain('hidden');
expect(json.props.className).toContain('fitted');
expect(json.props.className).toContain('inverted');
expect(json.props.className).toContain('horizontal');
});
});
119 changes: 119 additions & 0 deletions src/components/Divider/__snapshots__/View.test.jsx.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`View should render the component 1`] = `
<div
className="styled-dividerBlock"
>
<div
className="ui divider"
>
</div>
</div>
`;

exports[`View should render the component with all props with no theme 1`] = `
<div
className="styled-dividerBlock"
>
<div
className="ui fitted hidden horizontal inverted divider"
>
<div>
test test
</div>
</div>
</div>
`;

exports[`View should render the component with all props with theme 1`] = `
<div
className="ui fitted hidden horizontal inverted divider test"
>
<div>
test test
</div>
</div>
`;

exports[`View should render the component with prop fitted 1`] = `
<div
className="styled-dividerBlock"
>
<div
className="ui fitted divider"
>
</div>
</div>
`;

exports[`View should render the component with prop hidden 1`] = `
<div
className="styled-dividerBlock"
>
<div
className="ui hidden divider"
>
</div>
</div>
`;

exports[`View should render the component with prop section 1`] = `
<div
className="styled-dividerBlock"
>
<div
className="ui section divider"
>
</div>
</div>
`;

exports[`View should render the component with prop styles with theme 1`] = `
<div
className="ui inverted divider test"
>
</div>
`;

exports[`View should render the component with prop styles, with no theme 1`] = `
<div
className="styled-dividerBlock"
>
<div
className="ui inverted divider"
>
</div>
</div>
`;

exports[`View should render the component with prop text 1`] = `
<div
className="styled-dividerBlock"
>
<div
className="ui horizontal divider"
>
<div>
test test
</div>
</div>
</div>
`;

exports[`View should render the component with short 1`] = `
<div
className="styled-dividerBlock"
>
<div
className="ui divider short"
>
</div>
</div>
`;

0 comments on commit da44d8c

Please sign in to comment.