@eeacms/volto-widget-toggle 3.1.0 → 3.1.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,12 +4,31 @@ 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
+ ### [3.1.2](https://github.com/eea/volto-widget-toggle/compare/3.1.1...3.1.2) - 24 July 2023
8
+
9
+ #### :hammer_and_wrench: Others
10
+
11
+ - test: add unit tests for CheckboxWidget - refs #253277 [ana-oprea - [`7eb7622`](https://github.com/eea/volto-widget-toggle/commit/7eb7622ab02f7a429ad300c0795798aa7301e918)]
12
+ ### [3.1.1](https://github.com/eea/volto-widget-toggle/compare/3.1.0...3.1.1) - 12 June 2023
13
+
14
+ #### :hammer_and_wrench: Others
15
+
16
+ - test: jest should look for addons in node_modules Refs #253277 [valentinab25 - [`da228a9`](https://github.com/eea/volto-widget-toggle/commit/da228a925ea784b4b418f37ea07418de87759670)]
17
+ - test: Fix test config, coverage Refs #253277 [valentinab25 - [`b4f3492`](https://github.com/eea/volto-widget-toggle/commit/b4f3492448826968dfbb979fad00f0b65d644017)]
18
+ - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`08bfec1`](https://github.com/eea/volto-widget-toggle/commit/08bfec176ebdf6dff13a7db969a73ca9d8415ee8)]
19
+ - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`1324cce`](https://github.com/eea/volto-widget-toggle/commit/1324cceab3305bf02ab2004a4ff77d492f44481e)]
20
+ - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`13d684d`](https://github.com/eea/volto-widget-toggle/commit/13d684daf218103723779a470ff3dc7f101e93c1)]
7
21
  ### [3.1.0](https://github.com/eea/volto-widget-toggle/compare/3.0.1...3.1.0) - 27 March 2023
8
22
 
9
23
  #### :hammer_and_wrench: Others
10
24
 
11
- - Release 3.1.0 [Alin Voinea - [`f0e7f54`](https://github.com/eea/volto-widget-toggle/commit/f0e7f541416831f24d1c843c7d95ee40baa34099)]
25
+ - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`11a80c7`](https://github.com/eea/volto-widget-toggle/commit/11a80c7ce1f66aa0c7ec600c626875ab7ac8c1cb)]
26
+ - Add Sonarqube tag using advisory-board-frontend addons list [EEA Jenkins - [`c353ca1`](https://github.com/eea/volto-widget-toggle/commit/c353ca1794b99b2e5f6681ad93ab844ef33e117e)]
27
+ - Add Sonarqube tag using advisory-board-frontend addons list [EEA Jenkins - [`143e5be`](https://github.com/eea/volto-widget-toggle/commit/143e5be8400af60658baa34a7934f707df121f83)]
12
28
  - test(Jenkins): Run tests and cypress with latest canary @plone/volto [Alin Voinea - [`c658d9f`](https://github.com/eea/volto-widget-toggle/commit/c658d9f0fc0fc6cc4b26041b79c93c0982b152c5)]
29
+ - Add Sonarqube tag using cca-frontend addons list [EEA Jenkins - [`6f8b43e`](https://github.com/eea/volto-widget-toggle/commit/6f8b43e0fe92d2065725be355b800446fedf2992)]
30
+ - yarn 3 [Alin Voinea - [`02d53da`](https://github.com/eea/volto-widget-toggle/commit/02d53daff4ee2886f5533ce8afd0d4e67cd0a9f1)]
31
+ - Add Sonarqube tag using demo-kitkat-frontend addons list [EEA Jenkins - [`42059ef`](https://github.com/eea/volto-widget-toggle/commit/42059efe39cf11c31b1a48ddf6503aaf9da14db7)]
13
32
  ### [3.0.1](https://github.com/eea/volto-widget-toggle/compare/3.0.0...3.0.1) - 16 November 2022
14
33
 
15
34
  #### :hammer_and_wrench: Others
@@ -22,15 +41,21 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
22
41
  - Cleanup [Alin Voinea - [`f0bfe89`](https://github.com/eea/volto-widget-toggle/commit/f0bfe892db782472d0911b3562346d80bed2fb94)]
23
42
  - Typo [Miu Razvan - [`f1faa3d`](https://github.com/eea/volto-widget-toggle/commit/f1faa3d1c0239d377a75b375dcf092cea048c121)]
24
43
  - Use latest cypress [Miu Razvan - [`165ef4a`](https://github.com/eea/volto-widget-toggle/commit/165ef4a017833e757a69da734985acd18155228e)]
44
+ - Add Sonarqube tag using marine-frontend addons list [EEA Jenkins - [`45037b0`](https://github.com/eea/volto-widget-toggle/commit/45037b01295d0593929af9ff6f53823e51129f43)]
45
+ - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`de17f98`](https://github.com/eea/volto-widget-toggle/commit/de17f983029cda87580f39b6ab7b1a0139e080cd)]
25
46
  - update(jest): add @plone/volto-slate resolver refs- #153447 [nileshgulia1 - [`b5e6889`](https://github.com/eea/volto-widget-toggle/commit/b5e6889bc22efaeec2025bd79dfe2a839650e4a6)]
26
47
  ### [2.2.7](https://github.com/eea/volto-widget-toggle/compare/2.2.6...2.2.7) - 30 June 2022
27
48
 
28
49
  #### :hammer_and_wrench: Others
29
50
 
51
+ - Add Sonarqube tag using circularity-frontend addons list [EEA Jenkins - [`78e846a`](https://github.com/eea/volto-widget-toggle/commit/78e846a63de32fc42db181a07859a886b10d8b4e)]
52
+ - Add Sonarqube tag using clms-frontend addons list [EEA Jenkins - [`75191c3`](https://github.com/eea/volto-widget-toggle/commit/75191c366506d17db335e2b305e5ea8f058e9dfb)]
53
+ - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`3806c6c`](https://github.com/eea/volto-widget-toggle/commit/3806c6c481c069ab939b7603c7d3e102563276dd)]
30
54
  ### [2.2.6](https://github.com/eea/volto-widget-toggle/compare/2.2.5...2.2.6) - 3 January 2022
31
55
 
32
56
  #### :hammer_and_wrench: Others
33
57
 
58
+ - Add Sonarqube tag using freshwater-frontend addons list [EEA Jenkins - [`c2e3484`](https://github.com/eea/volto-widget-toggle/commit/c2e3484b3396dbabf38a8b9e8f6df0b89d4aa663)]
34
59
  ### [2.2.5](https://github.com/eea/volto-widget-toggle/compare/2.2.4...2.2.5) - 16 December 2021
35
60
 
36
61
  ### [2.2.4](https://github.com/eea/volto-widget-toggle/compare/2.2.3...2.2.4) - 10 December 2021
@@ -38,6 +63,13 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
38
63
  #### :hammer_and_wrench: Others
39
64
 
40
65
  - Refs #142010 - Optimize Volto-addons gitflow pipelines [valentinab25 - [`2bd2039`](https://github.com/eea/volto-widget-toggle/commit/2bd203979963ee5cb15592470e1d341d1bd65291)]
66
+ - Add Sonarqube tag using industry-frontend addons list [EEA Jenkins - [`af5afe1`](https://github.com/eea/volto-widget-toggle/commit/af5afe1263aff21801bbb8239163ac01644f2a7e)]
67
+ - Add Sonarqube tag using clms-frontend addons list [EEA Jenkins - [`2d60373`](https://github.com/eea/volto-widget-toggle/commit/2d60373b280dcb2f902e4dc6fff0bdb8ea7d7ac7)]
68
+ - Add Sonarqube tag using bise-frontend addons list [EEA Jenkins - [`80527c1`](https://github.com/eea/volto-widget-toggle/commit/80527c1f72bd8cc325ff1c072def18d24c3e99ae)]
69
+ - Add Sonarqube tag using sustainability-frontend addons list [EEA Jenkins - [`bc52e72`](https://github.com/eea/volto-widget-toggle/commit/bc52e72e32197ca82f93bac645f0094bc7db7ab1)]
70
+ - Add Sonarqube tag using climate-energy-frontend addons list [EEA Jenkins - [`30397bd`](https://github.com/eea/volto-widget-toggle/commit/30397bde9a045be3c2e6614af798ce11f18e3039)]
71
+ - Add Sonarqube tag using ims-frontend addons list [EEA Jenkins - [`dd3fb67`](https://github.com/eea/volto-widget-toggle/commit/dd3fb67693900db1ce6d8f631c61a2a5c25d9b70)]
72
+ - Add Sonarqube tag using frontend addons list [EEA Jenkins - [`54d09d1`](https://github.com/eea/volto-widget-toggle/commit/54d09d164591f1cf3d47a69838ccbd9abb8f22b6)]
41
73
  ### [2.2.3](https://github.com/eea/volto-widget-toggle/compare/2.2.2...2.2.3) - 28 June 2021
42
74
 
43
75
  #### :hammer_and_wrench: Others
@@ -71,6 +103,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
71
103
 
72
104
  - Release 1.0.1 [Alin Voinea - [`454220f`](https://github.com/eea/volto-widget-toggle/commit/454220fa61495427f874fb9b56401fe69689f4fe)]
73
105
  - Auto-release npm [Alin Voinea - [`10b31b3`](https://github.com/eea/volto-widget-toggle/commit/10b31b3b64330d41f69a033a45030e49d20c16b5)]
106
+ - yarn prettier [Alin Voinea - [`5136059`](https://github.com/eea/volto-widget-toggle/commit/51360595bf452c815e526ce10f15aa8a84ad186f)]
74
107
  ## [1.0.0](https://github.com/eea/volto-widget-toggle/compare/0.1.0...1.0.0) - 29 September 2020
75
108
 
76
109
  #### :hammer_and_wrench: Others
@@ -5,19 +5,19 @@ module.exports = {
5
5
  '!src/**/*.d.ts',
6
6
  ],
7
7
  moduleNameMapper: {
8
+ '\\.(css|less|scss|sass)$': 'identity-obj-proxy',
8
9
  '@plone/volto/cypress': '<rootDir>/node_modules/@plone/volto/cypress',
9
10
  '@plone/volto/babel': '<rootDir>/node_modules/@plone/volto/babel',
10
11
  '@plone/volto/(.*)$': '<rootDir>/node_modules/@plone/volto/src/$1',
11
12
  '@package/(.*)$': '<rootDir>/src/$1',
12
13
  '@root/(.*)$': '<rootDir>/src/$1',
13
14
  '@plone/volto-quanta/(.*)$': '<rootDir>/src/addons/volto-quanta/src/$1',
14
- '@eeacms/(.*?)/(.*)$': '<rootDir>/src/addons/$1/src/$2',
15
+ '@eeacms/(.*?)/(.*)$': '<rootDir>/node_modules/@eeacms/$1/src/$2',
15
16
  '@plone/volto-slate':
16
17
  '<rootDir>/node_modules/@plone/volto/packages/volto-slate/src',
17
18
  '~/(.*)$': '<rootDir>/src/$1',
18
19
  'load-volto-addons':
19
20
  '<rootDir>/node_modules/@plone/volto/jest-addons-loader.js',
20
- '\\.(css|less|scss|sass)$': 'identity-obj-proxy',
21
21
  },
22
22
  transform: {
23
23
  '^.+\\.js(x)?$': 'babel-jest',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-widget-toggle",
3
- "version": "3.1.0",
3
+ "version": "3.1.2",
4
4
  "description": "volto-widget-toggle: Volto add-on to replace checkboxes with toggle buttons",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -0,0 +1,65 @@
1
+ import React from 'react';
2
+ import { render } from '@testing-library/react';
3
+ import { Provider } from 'react-intl-redux';
4
+ import CheckboxWidget from './CheckboxWidget';
5
+ import configureStore from 'redux-mock-store';
6
+ import '@testing-library/jest-dom/extend-expect';
7
+
8
+ const mockStore = configureStore([]);
9
+ const store = mockStore({
10
+ intl: {
11
+ locale: 'en',
12
+ messages: {},
13
+ formatMessage: jest.fn(),
14
+ },
15
+ });
16
+
17
+ const mockOnChange = jest.fn();
18
+
19
+ describe('CheckboxWidget', () => {
20
+ beforeEach(() => {
21
+ jest.clearAllMocks();
22
+ });
23
+
24
+ it('renders a checkbox', () => {
25
+ const { getByText } = render(
26
+ <Provider store={store} locale="en">
27
+ <CheckboxWidget
28
+ id="test"
29
+ title="Test Checkbox"
30
+ onChange={mockOnChange}
31
+ />
32
+ </Provider>,
33
+ );
34
+ expect(getByText('Test Checkbox')).toBeInTheDocument();
35
+ });
36
+
37
+ it('sets a default value if given', () => {
38
+ render(
39
+ <Provider store={store} locale="en">
40
+ <CheckboxWidget
41
+ id="test"
42
+ title="Test Checkbox"
43
+ onChange={mockOnChange}
44
+ defaultValue={true}
45
+ />
46
+ </Provider>,
47
+ );
48
+ expect(mockOnChange).toHaveBeenCalledWith('test', true);
49
+ });
50
+
51
+ it('does not set a default value if already having a value', () => {
52
+ render(
53
+ <Provider store={store} locale="en">
54
+ <CheckboxWidget
55
+ id="test"
56
+ title="Test Checkbox"
57
+ onChange={mockOnChange}
58
+ value={false}
59
+ defaultValue={true}
60
+ />
61
+ </Provider>,
62
+ );
63
+ expect(mockOnChange).not.toHaveBeenCalled();
64
+ });
65
+ });