@plone/volto 18.12.0 → 18.13.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 CHANGED
@@ -17,6 +17,23 @@ myst:
17
17
 
18
18
  <!-- towncrier release notes start -->
19
19
 
20
+ ## 18.13.0 (2025-04-22)
21
+
22
+ ### Feature
23
+
24
+ - Allow `object_list` widget to receive a `schemaName` prop, mapped to an utility. @sneridagh [#7007](https://github.com/plone/volto/issues/7007)
25
+
26
+ ## 18.12.1 (2025-04-15)
27
+
28
+ ### Bugfix
29
+
30
+ - Fixed broken tests in add-ons in Volto 18.12.0. @Abhishek-17h [#6989](https://github.com/plone/volto/issues/6989)
31
+
32
+ ### Internal
33
+
34
+ - Removes make commands in root of repository whose packages no longer exist. @wesleybl [#6975](https://github.com/plone/volto/issues/6975)
35
+ - Use `Image` from `@plone/volto/components/theme/Image/Image` instead of `semantic-ui-react` in `ContentsUploadModal`. @wesleybl [#6982](https://github.com/plone/volto/issues/6982)
36
+
20
37
  ## 18.12.0 (2025-04-12)
21
38
 
22
39
  ### Feature
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  }
10
10
  ],
11
11
  "license": "MIT",
12
- "version": "18.12.0",
12
+ "version": "18.13.0",
13
13
  "repository": {
14
14
  "type": "git",
15
15
  "url": "git@github.com:plone/volto.git"
@@ -236,9 +236,9 @@
236
236
  "url": "^0.11.3",
237
237
  "use-deep-compare-effect": "1.8.1",
238
238
  "uuid": "^8.3.2",
239
- "@plone/registry": "2.5.0",
240
239
  "@plone/volto-slate": "18.3.0",
241
- "@plone/scripts": "3.9.0"
240
+ "@plone/scripts": "3.9.0",
241
+ "@plone/registry": "2.5.1"
242
242
  },
243
243
  "devDependencies": {
244
244
  "@babel/core": "^7.0.0",
@@ -363,7 +363,7 @@
363
363
  "webpack-dev-server": "4.11.1",
364
364
  "webpack-node-externals": "3.0.0",
365
365
  "why": "0.6.2",
366
- "@plone/types": "1.3.2",
366
+ "@plone/types": "1.4.0",
367
367
  "@plone/volto-coresandbox": "1.0.0"
368
368
  },
369
369
  "volta": {
@@ -6,7 +6,6 @@ import {
6
6
  Dimmer,
7
7
  Header,
8
8
  Icon,
9
- Image,
10
9
  Modal,
11
10
  Table,
12
11
  Segment,
@@ -24,6 +23,7 @@ import FormattedRelativeDate from '@plone/volto/components/theme/FormattedDate/F
24
23
  import { createContent } from '@plone/volto/actions/content/content';
25
24
  import { validateFileUploadSize } from '@plone/volto/helpers/FormValidation/FormValidation';
26
25
  import { usePrevious } from '@plone/volto/helpers/Utils/usePrevious';
26
+ import Image from '@plone/volto/components/theme/Image/Image';
27
27
 
28
28
  const Dropzone = loadable(() => import('react-dropzone'));
29
29
 
@@ -259,7 +259,11 @@ const ContentsUploadModal = (props) => {
259
259
  <Table.Cell>{filesize(file.size, { round: 0 })}</Table.Cell>
260
260
  <Table.Cell>
261
261
  {file.type.split('/')[0] === 'image' && (
262
- <Image src={file.preview} height={60} />
262
+ <Image
263
+ src={file.preview}
264
+ height={60}
265
+ className="ui image"
266
+ />
263
267
  )}
264
268
  </Table.Cell>
265
269
  <Table.Cell>
@@ -1,4 +1,3 @@
1
- import { vi } from 'vitest';
2
1
  export const Contents = vi.fn(() => <div className="Contents" />);
3
2
 
4
3
  export const ContentsRenameModal = vi.fn(() => (
@@ -6,8 +6,6 @@ import { waitFor, render, screen } from '@testing-library/react';
6
6
 
7
7
  import Diff from './Diff';
8
8
 
9
- import { vi, beforeAll } from 'vitest';
10
-
11
9
  const mockStore = configureStore();
12
10
 
13
11
  vi.mock('../Toolbar/Toolbar', () => ({
@@ -1,6 +1,5 @@
1
1
  import type { JSONSchema } from '@plone/types';
2
2
  import type { Ref } from 'react';
3
- import { vi } from 'vitest';
4
3
  import { forwardRef } from 'react';
5
4
 
6
5
  const cleanupSchema = (schema: JSONSchema | null): JSONSchema | null => {
@@ -14,6 +14,7 @@ import deleteSVG from '@plone/volto/icons/delete.svg';
14
14
  import addSVG from '@plone/volto/icons/add.svg';
15
15
  import dragSVG from '@plone/volto/icons/drag.svg';
16
16
  import { v4 as uuid } from 'uuid';
17
+ import config from '@plone/volto/registry';
17
18
 
18
19
  const messages = defineMessages({
19
20
  labelRemoveItem: {
@@ -71,11 +72,20 @@ const ObjectListWidget = (props) => {
71
72
  block,
72
73
  fieldSet,
73
74
  id,
74
- schema,
75
75
  value = [],
76
76
  onChange,
77
77
  schemaExtender,
78
+ schemaName,
78
79
  } = props;
80
+
81
+ // This allows to use a `schemaName` prop defined as source of the schema
82
+ // if not present, it will use the schema defined in the schema prop
83
+ const schema =
84
+ config.getUtility({
85
+ type: 'schema',
86
+ name: schemaName,
87
+ }).method || props.schema;
88
+
79
89
  const [localActiveObject, setLocalActiveObject] = React.useState(
80
90
  props.activeObject ?? value.length - 1,
81
91
  );
@@ -1,5 +1,3 @@
1
- import { vi } from 'vitest';
2
-
3
1
  export const AlignWidget = vi.fn(() => <div id="AlignWidget" />);
4
2
  export const ButtonsWidget = vi.fn(() => <div id="ButtonsWidget" />);
5
3
  export const ArrayWidget = vi.fn(() => <div id="ArrayWidget" />);
@@ -3,8 +3,6 @@ import renderer from 'react-test-renderer';
3
3
  import config from '@plone/volto/registry';
4
4
  import AppExtras from './AppExtras';
5
5
 
6
- import { vi } from 'vitest';
7
-
8
6
  beforeAll(() => {
9
7
  config.settings.appExtras = [
10
8
  {
@@ -1,6 +1,5 @@
1
1
  import config from '@plone/volto/registry';
2
2
  import Api from './Api';
3
- import { vi } from 'vitest';
4
3
 
5
4
  vi.mock('superagent', () => ({
6
5
  default: {
@@ -1,12 +1,6 @@
1
1
  // import superagent from 'superagent';
2
2
  import config from '@plone/volto/registry';
3
3
  import Api from './Api';
4
- import { vi } from 'vitest';
5
-
6
- // jest.mock('react-cookie', () => ({
7
- // load: jest.fn(() => 'token'),
8
- // }));
9
- //
10
4
 
11
5
  vi.mock('superagent', () => ({
12
6
  default: {
@@ -1,4 +1,3 @@
1
- import { describe, it, expect, vi, beforeEach } from 'vitest';
2
1
  import Cookies from 'universal-cookie';
3
2
  import jwt from 'jsonwebtoken';
4
3
  import jwtDecode from 'jwt-decode';
@@ -1,6 +1,5 @@
1
1
  import React from 'react';
2
2
  import config from '@plone/volto/registry';
3
- import { vi } from 'vitest';
4
3
  const loadables = config.settings.loadables;
5
4
 
6
5
  let mockAllLoadables = Object.create(null);
@@ -0,0 +1,46 @@
1
+ import '@testing-library/jest-dom';
2
+ import { expect, describe, it, vi } from 'vitest';
3
+
4
+ global.describe = describe;
5
+ global.it = it;
6
+ global.expect = expect;
7
+ global.vi = vi;
8
+
9
+ global.__CLIENT__ = true;
10
+ global.__DEVELOPMENT__ = false;
11
+ global.__SERVER__ = false;
12
+ global.__TEST__ = true;
13
+
14
+ window.matchMedia =
15
+ window.matchMedia ||
16
+ function (query) {
17
+ return {
18
+ matches: query === '(min-width: 1024px)',
19
+ addListener: function () {},
20
+ removeListener: function () {},
21
+ };
22
+ };
23
+
24
+ vi.stubGlobal(
25
+ 'fetch',
26
+ vi.fn(() =>
27
+ Promise.resolve({
28
+ json: () => Promise.resolve({}),
29
+ text: () => Promise.resolve(''),
30
+ }),
31
+ ),
32
+ );
33
+
34
+ vi.stubGlobal('localStorage', {
35
+ getItem: vi.fn(),
36
+ setItem: vi.fn(),
37
+ removeItem: vi.fn(),
38
+ clear: vi.fn(),
39
+ });
40
+
41
+ vi.stubGlobal('sessionStorage', {
42
+ getItem: vi.fn(),
43
+ setItem: vi.fn(),
44
+ removeItem: vi.fn(),
45
+ clear: vi.fn(),
46
+ });
@@ -1,46 +1,12 @@
1
- import '@testing-library/jest-dom';
2
- import { expect, describe, it, vi } from 'vitest';
3
-
4
- global.describe = describe;
5
- global.it = it;
6
- global.expect = expect;
7
- global.vi = vi;
8
-
9
1
  global.__CLIENT__ = true;
10
2
  global.__DEVELOPMENT__ = false;
11
- global.__SERVER__ = false;
12
- global.__TEST__ = true;
13
3
 
14
4
  window.matchMedia =
15
5
  window.matchMedia ||
16
- function (query) {
6
+ function () {
17
7
  return {
18
- matches: query === '(min-width: 1024px)',
8
+ matches: false,
19
9
  addListener: function () {},
20
10
  removeListener: function () {},
21
11
  };
22
12
  };
23
-
24
- vi.stubGlobal(
25
- 'fetch',
26
- vi.fn(() =>
27
- Promise.resolve({
28
- json: () => Promise.resolve({}),
29
- text: () => Promise.resolve(''),
30
- }),
31
- ),
32
- );
33
-
34
- vi.stubGlobal('localStorage', {
35
- getItem: vi.fn(),
36
- setItem: vi.fn(),
37
- removeItem: vi.fn(),
38
- clear: vi.fn(),
39
- });
40
-
41
- vi.stubGlobal('sessionStorage', {
42
- getItem: vi.fn(),
43
- setItem: vi.fn(),
44
- removeItem: vi.fn(),
45
- clear: vi.fn(),
46
- });
@@ -10,6 +10,7 @@
10
10
  "jsx": "react-jsx",
11
11
  "preserveSymlinks": true,
12
12
  "downlevelIteration": true,
13
+ "types": ["vitest/globals"],
13
14
  "paths": {
14
15
  "@plone/volto/*": ["./src/*"],
15
16
  "react": ["./node_modules/@types/react"],
package/vitest.config.ts CHANGED
@@ -36,7 +36,7 @@ export default defineConfig({
36
36
  globals: true,
37
37
  environment: 'jsdom',
38
38
  setupFiles: [
39
- './test-setup-globals.js',
39
+ './test-setup-globals-vitest.js',
40
40
  './test-setup-config.jsx',
41
41
  './jest-setup-afterenv.js',
42
42
  './jest-addons-loader.js',