diff --git a/.github/workflows/acceptance.yml b/.github/workflows/acceptance.yml
index e6b4989a24..7f3e04d035 100644
--- a/.github/workflows/acceptance.yml
+++ b/.github/workflows/acceptance.yml
@@ -11,7 +11,7 @@ jobs:
matrix:
node-version: [18.x, 20.x]
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
# node setup
- name: Use Node.js ${{ matrix.node-version }}
@@ -32,7 +32,7 @@ jobs:
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- - uses: actions/cache@v3
+ - uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
@@ -42,7 +42,7 @@ jobs:
- name: Cache Cypress Binary
id: cache-cypress-binary
- uses: actions/cache@v3
+ uses: actions/cache@v4
with:
path: ~/.cache/Cypress
key: binary-${{ matrix.node-version }}-${{ hashFiles('package-lock.json') }}
@@ -95,11 +95,11 @@ jobs:
matrix:
node-version: [18.x, 20.x]
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
# node setup
- name: Use Node.js ${{ matrix.node-version }}
- uses: actions/setup-node@v3
+ uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
@@ -114,7 +114,7 @@ jobs:
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- - uses: actions/cache@v3
+ - uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
@@ -124,7 +124,7 @@ jobs:
- name: Cache Cypress Binary
id: cache-cypress-binary
- uses: actions/cache@v3
+ uses: actions/cache@v4
with:
path: ~/.cache/Cypress
key: binary-${{ matrix.node-version }}-${{ hashFiles('package-lock.json') }}
@@ -177,11 +177,11 @@ jobs:
matrix:
node-version: [18.x, 20.x]
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
# node setup
- name: Use Node.js ${{ matrix.node-version }}
- uses: actions/setup-node@v3
+ uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
@@ -196,7 +196,7 @@ jobs:
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- - uses: actions/cache@v3
+ - uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
@@ -206,7 +206,7 @@ jobs:
- name: Cache Cypress Binary
id: cache-cypress-binary
- uses: actions/cache@v3
+ uses: actions/cache@v4
with:
path: ~/.cache/Cypress
key: binary-${{ matrix.node-version }}-${{ hashFiles('package-lock.json') }}
@@ -259,11 +259,11 @@ jobs:
matrix:
node-version: [18.x, 20.x]
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
# node setup
- name: Use Node.js ${{ matrix.node-version }}
- uses: actions/setup-node@v3
+ uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
@@ -278,7 +278,7 @@ jobs:
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- - uses: actions/cache@v3
+ - uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
@@ -288,7 +288,7 @@ jobs:
- name: Cache Cypress Binary
id: cache-cypress-binary
- uses: actions/cache@v3
+ uses: actions/cache@v4
with:
path: ~/.cache/Cypress
key: binary-${{ matrix.node-version }}-${{ hashFiles('package-lock.json') }}
@@ -341,11 +341,11 @@ jobs:
matrix:
node-version: [18.x, 20.x]
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
# node setup
- name: Use Node.js ${{ matrix.node-version }}
- uses: actions/setup-node@v3
+ uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
@@ -360,7 +360,7 @@ jobs:
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- - uses: actions/cache@v3
+ - uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
@@ -370,7 +370,7 @@ jobs:
- name: Cache Cypress Binary
id: cache-cypress-binary
- uses: actions/cache@v3
+ uses: actions/cache@v4
with:
path: ~/.cache/Cypress
key: binary-${{ matrix.node-version }}-${{ hashFiles('package-lock.json') }}
@@ -423,11 +423,11 @@ jobs:
matrix:
node-version: [18.x, 20.x]
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
# node setup
- name: Use Node.js ${{ matrix.node-version }}
- uses: actions/setup-node@v3
+ uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
@@ -442,7 +442,7 @@ jobs:
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- - uses: actions/cache@v3
+ - uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
@@ -452,7 +452,7 @@ jobs:
- name: Cache Cypress Binary
id: cache-cypress-binary
- uses: actions/cache@v3
+ uses: actions/cache@v4
with:
path: ~/.cache/Cypress
key: binary-${{ matrix.node-version }}-${{ hashFiles('package-lock.json') }}
@@ -504,11 +504,11 @@ jobs:
matrix:
node-version: [18.x]
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
# node setup
- name: Use Node.js ${{ matrix.node-version }}
- uses: actions/setup-node@v3
+ uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
@@ -523,7 +523,7 @@ jobs:
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- - uses: actions/cache@v3
+ - uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
@@ -533,7 +533,7 @@ jobs:
- name: Cache Cypress Binary
id: cache-cypress-binary
- uses: actions/cache@v3
+ uses: actions/cache@v4
with:
path: ~/.cache/Cypress
key: binary-${{ matrix.node-version }}-${{ hashFiles('package-lock.json') }}
@@ -586,11 +586,11 @@ jobs:
matrix:
node-version: [18.x]
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
# node setup
- name: Use Node.js ${{ matrix.node-version }}
- uses: actions/setup-node@v3
+ uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
@@ -605,7 +605,7 @@ jobs:
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- - uses: actions/cache@v3
+ - uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
@@ -615,7 +615,7 @@ jobs:
- name: Cache Cypress Binary
id: cache-cypress-binary
- uses: actions/cache@v3
+ uses: actions/cache@v4
with:
path: ~/.cache/Cypress
key: binary-${{ matrix.node-version }}-${{ hashFiles('package-lock.json') }}
@@ -668,11 +668,11 @@ jobs:
# matrix:
# node-version: [18.x]
# steps:
- # - uses: actions/checkout@v3
+ # - uses: actions/checkout@v4
# # node setup
# - name: Use Node.js ${{ matrix.node-version }}
- # uses: actions/setup-node@v3
+ # uses: actions/setup-node@v4
# with:
# node-version: ${{ matrix.node-version }}
@@ -687,7 +687,7 @@ jobs:
# run: |
# echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- # - uses: actions/cache@v3
+ # - uses: actions/cache@v4
# name: Setup pnpm cache
# with:
# path: ${{ env.STORE_PATH }}
@@ -739,11 +739,11 @@ jobs:
matrix:
node-version: [18.x]
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
# node setup
- name: Use Node.js ${{ matrix.node-version }}
- uses: actions/setup-node@v3
+ uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
@@ -758,7 +758,7 @@ jobs:
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- - uses: actions/cache@v3
+ - uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
@@ -768,7 +768,7 @@ jobs:
- name: Cache Cypress Binary
id: cache-cypress-binary
- uses: actions/cache@v3
+ uses: actions/cache@v4
with:
path: ~/.cache/Cypress
key: binary-${{ matrix.node-version }}-${{ hashFiles('package-lock.json') }}
@@ -822,11 +822,11 @@ jobs:
node-version: [18.x]
# python-version: [3.7]
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
# node setup
- name: Use Node.js ${{ matrix.node-version }}
- uses: actions/setup-node@v3
+ uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
@@ -841,7 +841,7 @@ jobs:
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- - uses: actions/cache@v3
+ - uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
@@ -851,7 +851,7 @@ jobs:
- name: Cache Cypress Binary
id: cache-cypress-binary
- uses: actions/cache@v3
+ uses: actions/cache@v4
with:
path: ~/.cache/Cypress
key: binary-${{ matrix.node-version }}-${{ hashFiles('package-lock.json') }}
@@ -932,11 +932,11 @@ jobs:
project-directory: ./my-volto-app
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
# node setup
- name: Use Node.js ${{ matrix.node-version }}
- uses: actions/setup-node@v3
+ uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
@@ -951,7 +951,7 @@ jobs:
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- - uses: actions/cache@v3
+ - uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
@@ -961,7 +961,7 @@ jobs:
- name: Cache Cypress Binary
id: cache-cypress-binary
- uses: actions/cache@v3
+ uses: actions/cache@v4
with:
path: ~/.cache/Cypress
key: binary-${{ matrix.node-version }}-${{ hashFiles('package-lock.json') }}
@@ -1069,11 +1069,11 @@ jobs:
matrix:
node-version: [18.x]
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
# node setup
- name: Use Node.js ${{ matrix.node-version }}
- uses: actions/setup-node@v3
+ uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
@@ -1088,7 +1088,7 @@ jobs:
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- - uses: actions/cache@v3
+ - uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
@@ -1098,7 +1098,7 @@ jobs:
- name: Cache Cypress Binary
id: cache-cypress-binary
- uses: actions/cache@v3
+ uses: actions/cache@v4
with:
path: ~/.cache/Cypress
key: binary-${{ matrix.node-version }}-${{ hashFiles('package-lock.json') }}
@@ -1140,7 +1140,7 @@ jobs:
- uses: actions/upload-artifact@v1
if: failure()
with:
- name: cypress-videos
+ name: cypress-videos-seamless
path: packages/volto/cypress/videos
multilingualseamless:
@@ -1153,11 +1153,11 @@ jobs:
matrix:
node-version: [18.x]
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
# node setup
- name: Use Node.js ${{ matrix.node-version }}
- uses: actions/setup-node@v3
+ uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
@@ -1172,7 +1172,7 @@ jobs:
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- - uses: actions/cache@v3
+ - uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
@@ -1182,7 +1182,7 @@ jobs:
- name: Cache Cypress Binary
id: cache-cypress-binary
- uses: actions/cache@v3
+ uses: actions/cache@v4
with:
path: ~/.cache/Cypress
key: binary-${{ matrix.node-version }}-${{ hashFiles('package-lock.json') }}
diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml
index c6a16acd47..04b8739752 100644
--- a/.github/workflows/changelog.yml
+++ b/.github/workflows/changelog.yml
@@ -12,7 +12,7 @@ jobs:
towncrier:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
with:
# Fetch all history
fetch-depth: '0'
diff --git a/.github/workflows/code-analysis.yml b/.github/workflows/code-analysis.yml
index cdba0307d1..592bd0cb3e 100644
--- a/.github/workflows/code-analysis.yml
+++ b/.github/workflows/code-analysis.yml
@@ -10,11 +10,11 @@ jobs:
name: Prettier
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
# node setup
- name: Use Node.js ${{ env.node-version }}
- uses: actions/setup-node@v3
+ uses: actions/setup-node@v4
with:
node-version: ${{ env.node-version }}
@@ -29,7 +29,7 @@ jobs:
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- - uses: actions/cache@v3
+ - uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
@@ -47,11 +47,11 @@ jobs:
name: ESlint
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
# node setup
- name: Use Node.js ${{ env.node-version }}
- uses: actions/setup-node@v3
+ uses: actions/setup-node@v4
with:
node-version: ${{ env.node-version }}
@@ -66,7 +66,7 @@ jobs:
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- - uses: actions/cache@v3
+ - uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
@@ -87,11 +87,11 @@ jobs:
name: Stylelint
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
# node setup
- name: Use Node.js ${{ env.node-version }}
- uses: actions/setup-node@v3
+ uses: actions/setup-node@v4
with:
node-version: ${{ env.node-version }}
@@ -106,7 +106,7 @@ jobs:
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- - uses: actions/cache@v3
+ - uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
@@ -127,11 +127,11 @@ jobs:
name: i18n
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
# node setup
- name: Use Node.js ${{ env.node-version }}
- uses: actions/setup-node@v3
+ uses: actions/setup-node@v4
with:
node-version: ${{ env.node-version }}
@@ -146,7 +146,7 @@ jobs:
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- - uses: actions/cache@v3
+ - uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml
index 08763d2f3a..987ac42c7c 100644
--- a/.github/workflows/docs.yml
+++ b/.github/workflows/docs.yml
@@ -19,7 +19,7 @@ jobs:
matrix:
python-version: ['3.10']
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
diff --git a/.github/workflows/unit.yml b/.github/workflows/unit.yml
index 9f2ec8ec26..a9cb936cdc 100644
--- a/.github/workflows/unit.yml
+++ b/.github/workflows/unit.yml
@@ -14,11 +14,11 @@ jobs:
matrix:
node-version: [18.x, 20.x]
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
# node setup
- name: Use Node.js ${{ matrix.node-version }}
- uses: actions/setup-node@v3
+ uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
@@ -33,7 +33,7 @@ jobs:
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- - uses: actions/cache@v3
+ - uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
@@ -64,11 +64,11 @@ jobs:
matrix:
node-version: [18.x, 20.x]
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
# node setup
- name: Use Node.js ${{ matrix.node-version }}
- uses: actions/setup-node@v3
+ uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
@@ -83,7 +83,7 @@ jobs:
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- - uses: actions/cache@v3
+ - uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
@@ -105,11 +105,11 @@ jobs:
matrix:
node-version: [18.x, 20.x]
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
# node setup
- name: Use Node.js ${{ matrix.node-version }}
- uses: actions/setup-node@v3
+ uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
@@ -124,7 +124,7 @@ jobs:
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- - uses: actions/cache@v3
+ - uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
@@ -141,10 +141,10 @@ jobs:
name: '@plone/client'
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
- name: Use Node.js ${{ env.node-version }}
- uses: actions/setup-node@v3
+ uses: actions/setup-node@v4
with:
node-version: ${{ env.node-version }}
@@ -159,7 +159,7 @@ jobs:
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- - uses: actions/cache@v3
+ - uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
diff --git a/docs/source/upgrade-guide/index.md b/docs/source/upgrade-guide/index.md
index a89577132b..06427363f5 100644
--- a/docs/source/upgrade-guide/index.md
+++ b/docs/source/upgrade-guide/index.md
@@ -28,6 +28,27 @@ Thus it is safe to run it on top of your project and answer the prompts.
## Upgrading to Volto 18.x.x
+### Volto runs now on React 18.2.0
+
+We have updated Volto to use React 18.
+This has been the latest published stable version since June 2022.
+This aligns Volto with the latests developments in the React ecosystem and opens the door to up to date software and React features, like client side `Suspense` and others:
+
+- Concurrent rendering in client (Suspense)
+- Automatic batching updates
+- Transitions
+- New hooks `useId`, `useTransition`, `useDeferredValue`, `useSyncExternalStore`, and other hooks
+
+### `react-portal` dependency removed
+
+`react-portal` is deprecated and it was removed from Volto.
+The Volto code that relied on it was mainly CMS UI components.
+If your project relies on it, either in your code or the shadowed components you may have, you should update to use the standard React API, `createPortal`.
+You can update your shadows taking the modified components as templates.
+As a last resort, you can install `react-portal` as a dependency of your project.
+However, this is discouraged, because the React 18 rendering could have unexpected side effects.
+It is recommended that you use the React API instead.
+
### ESlint project configuration update
`@plone/registry` and [other packages on which Volto depends](https://github.com/plone/volto/tree/main/packages) are now stand-alone releases in the monorepo structure released in 18.0.0-alpha.4.
diff --git a/packages/coresandbox/package.json b/packages/coresandbox/package.json
index e90e2e480c..aaf007882e 100644
--- a/packages/coresandbox/package.json
+++ b/packages/coresandbox/package.json
@@ -26,17 +26,17 @@
"react"
],
"peerDependencies": {
- "react": "17.0.2",
- "react-dom": "17.0.2",
+ "react": "18.2.0",
+ "react-dom": "18.2.0",
"react-intl": "3.8.0",
"react-redux": "7.2.4",
"semantic-ui-react": "2.0.3"
},
"devDependencies": {
"@plone/types": "workspace:*",
+ "@types/react": "^18",
+ "@types/react-dom": "^18",
"@plone/registry": "workspace:*",
- "@types/react": "^17.0.52",
- "@types/react-dom": "^17",
"@types/react-redux": "^7.1.33"
}
}
diff --git a/packages/registry/news/3221.feature b/packages/registry/news/3221.feature
new file mode 100644
index 0000000000..3260496e2f
--- /dev/null
+++ b/packages/registry/news/3221.feature
@@ -0,0 +1 @@
+Upgrade Volto core to use React 18.2.0 @sneridagh
diff --git a/packages/registry/package.json b/packages/registry/package.json
index f25299a8aa..d728d06749 100644
--- a/packages/registry/package.json
+++ b/packages/registry/package.json
@@ -76,9 +76,11 @@
"@parcel/packager-ts": "2.10.2",
"@parcel/transformer-typescript-types": "2.10.2",
"@plone/types": "workspace:*",
- "@types/react": "^17.0.52",
- "@types/react-dom": "^17",
+ "@types/react": "^18",
+ "@types/react-dom": "^18",
"parcel": "2.10.2",
+ "react": "^18.2.0",
+ "react-dom": "^18.2.0",
"release-it": "16.2.1",
"tsconfig": "workspace:*",
"typescript": "5.2.2",
diff --git a/packages/types/news/3221.feature b/packages/types/news/3221.feature
new file mode 100644
index 0000000000..3260496e2f
--- /dev/null
+++ b/packages/types/news/3221.feature
@@ -0,0 +1 @@
+Upgrade Volto core to use React 18.2.0 @sneridagh
diff --git a/packages/types/package.json b/packages/types/package.json
index 7520438490..7f0eb8bcec 100644
--- a/packages/types/package.json
+++ b/packages/types/package.json
@@ -50,10 +50,12 @@
"devDependencies": {
"@parcel/packager-ts": "2.10.2",
"@parcel/transformer-typescript-types": "2.10.2",
- "@types/react": "^17.0.52",
- "@types/react-dom": "^17",
+ "@types/react": "^18",
+ "@types/react-dom": "^18",
"history": "^5.3.0",
"parcel": "2.10.2",
+ "react": "^18.2.0",
+ "react-dom": "^18.2.0",
"react-intl": "3.8.0",
"release-it": "16.2.1",
"tsconfig": "workspace:*",
diff --git a/packages/volto-slate/news/3221.feature b/packages/volto-slate/news/3221.feature
new file mode 100644
index 0000000000..3260496e2f
--- /dev/null
+++ b/packages/volto-slate/news/3221.feature
@@ -0,0 +1 @@
+Upgrade Volto core to use React 18.2.0 @sneridagh
diff --git a/packages/volto-slate/package.json b/packages/volto-slate/package.json
index 8eadc11fee..512bc8818b 100644
--- a/packages/volto-slate/package.json
+++ b/packages/volto-slate/package.json
@@ -21,9 +21,9 @@
"image-extensions": "1.1.0",
"is-url": "1.2.4",
"jsdom": "^16.6.0",
- "react": "17.0.2",
+ "react": "18.2.0",
"react-intersection-observer": "9.1.0",
- "react-dom": "17.0.2",
+ "react-dom": "18.2.0",
"slate": "0.100.0",
"slate-history": "0.100.0",
"slate-hyperscript": "0.100.0",
diff --git a/packages/volto-slate/src/blocks/Text/PluginSidebar.jsx b/packages/volto-slate/src/blocks/Text/PluginSidebar.jsx
index 3858e9448f..a5a3185a05 100644
--- a/packages/volto-slate/src/blocks/Text/PluginSidebar.jsx
+++ b/packages/volto-slate/src/blocks/Text/PluginSidebar.jsx
@@ -1,16 +1,15 @@
import React from 'react';
-import { Portal } from 'react-portal';
+import { createPortal } from 'react-dom';
const PluginSidebar = ({ children, selected }) => {
return (
<>
- {selected && (
-
- {children}
-
- )}
+ {selected &&
+ __CLIENT__ &&
+ createPortal(
+ <>{children}>,
+ document.getElementById('slate-plugin-sidebar'),
+ )}
>
);
};
diff --git a/packages/volto-slate/src/blocks/Text/extensions/breakList.js b/packages/volto-slate/src/blocks/Text/extensions/breakList.js
index c02e74ec13..b4117a0d8b 100644
--- a/packages/volto-slate/src/blocks/Text/extensions/breakList.js
+++ b/packages/volto-slate/src/blocks/Text/extensions/breakList.js
@@ -77,8 +77,8 @@ export const breakList = (editor) => {
Editor.deleteBackward(editor, { unit: 'line' });
// also account for empty nodes [{text: ''}]
if (Editor.isEmpty(editor, parent)) {
- Transforms.removeNodes(editor, { at: ref.current });
createAndSelectNewBlockAfter(editor, [createEmptyParagraph()]);
+ Transforms.removeNodes(editor, { at: ref.current });
return true;
}
diff --git a/packages/volto-slate/src/blocks/Text/extensions/insertBreak.js b/packages/volto-slate/src/blocks/Text/extensions/insertBreak.js
index 258aa7d382..d767c30ab6 100644
--- a/packages/volto-slate/src/blocks/Text/extensions/insertBreak.js
+++ b/packages/volto-slate/src/blocks/Text/extensions/insertBreak.js
@@ -42,9 +42,9 @@ export const withSplitBlocksOnBreak = (editor) => {
// deconstructToVoltoBlocks
ReactDOM.unstable_batchedUpdates(() => {
const [top, bottom] = splitEditorInTwoFragments(editor);
- setEditorContent(editor, top);
// ReactEditor.blur(editor);
createAndSelectNewBlockAfter(editor, bottom);
+ setEditorContent(editor, top);
});
}
return;
diff --git a/packages/volto-slate/src/editor/SlateEditor.jsx b/packages/volto-slate/src/editor/SlateEditor.jsx
index d59e8b3f4a..fe8457b191 100644
--- a/packages/volto-slate/src/editor/SlateEditor.jsx
+++ b/packages/volto-slate/src/editor/SlateEditor.jsx
@@ -166,7 +166,14 @@ class SlateEditor extends Component {
ReactEditor.focus(editor);
Transforms.select(editor, selection);
} else {
- Transforms.select(editor, Editor.end(editor, []));
+ try {
+ Transforms.select(editor, Editor.end(editor, []));
+ } catch (error) {
+ // Weird error only happening in Cypress
+ // Adding a try/catch
+ // eslint-disable-next-line no-console
+ console.log(error);
+ }
}
this.setState({
diff --git a/packages/volto-slate/src/editor/ui/PositionedToolbar.jsx b/packages/volto-slate/src/editor/ui/PositionedToolbar.jsx
index 93ab6d27d2..1ea7ab68ce 100644
--- a/packages/volto-slate/src/editor/ui/PositionedToolbar.jsx
+++ b/packages/volto-slate/src/editor/ui/PositionedToolbar.jsx
@@ -1,5 +1,5 @@
import React from 'react';
-import { Portal } from 'react-portal';
+import { createPortal } from 'react-dom';
import BasicToolbar from './BasicToolbar';
@@ -20,12 +20,11 @@ const PositionedToolbar = ({ toggleButton, className, children, position }) => {
el.style.left = left;
});
- return (
-
-
- {children}
-
-
+ return createPortal(
+
+ {children}
+ ,
+ document.body,
);
};
diff --git a/packages/volto-slate/src/editor/ui/Toolbar.jsx b/packages/volto-slate/src/editor/ui/Toolbar.jsx
index 2d7406e12f..4e7afc51de 100644
--- a/packages/volto-slate/src/editor/ui/Toolbar.jsx
+++ b/packages/volto-slate/src/editor/ui/Toolbar.jsx
@@ -1,11 +1,11 @@
import cx from 'classnames';
import React, { useRef, useEffect } from 'react';
-import { Portal } from 'react-portal';
import { useSlate } from 'slate-react';
import Separator from './Separator';
import BasicToolbar from './BasicToolbar';
import { Editor, Node } from 'slate';
import { ReactEditor } from 'slate-react';
+import { createPortal } from 'react-dom';
const Toolbar = ({
elementType,
@@ -82,21 +82,20 @@ const Toolbar = ({
)}px`;
});
- return (
-
-
- {children}
- {enableExpando && toggleButton && (
- <>
-
- {toggleButton}
- >
- )}
-
-
+ return createPortal(
+
+ {children}
+ {enableExpando && toggleButton && (
+ <>
+
+ {toggleButton}
+ >
+ )}
+ ,
+ document.body,
);
};
diff --git a/packages/volto/cypress/tests/core/basic/folder-contents.js b/packages/volto/cypress/tests/core/basic/folder-contents.js
index 71dcaf9306..6efb50fe7e 100644
--- a/packages/volto/cypress/tests/core/basic/folder-contents.js
+++ b/packages/volto/cypress/tests/core/basic/folder-contents.js
@@ -130,25 +130,23 @@ describe('Folder Contents Tests', () => {
});
it('Move items to top of folder and bottom of folder', () => {
+ cy.intercept('GET', `/**/@search*`).as('search');
+ cy.intercept('PATCH', `/**/my-folder`).as('reorder');
// creating a Document
- cy.createContent({
- contentType: 'Document',
- contentId: 'child',
- contentTitle: 'My Child',
- path: 'my-folder',
- });
-
- // doing copy paste for dummy data
- cy.get('svg[class="icon unchecked"]').click();
- cy.get('svg[class="icon copy"]').click();
var genArr = Array.from({ length: 56 }, (v, k) => k + 1);
- cy.wrap(genArr).each((index) => {
- cy.get('svg[class="icon paste"]').click({ force: true });
+ genArr.forEach((item) => {
+ cy.createContent({
+ contentType: 'Document',
+ contentTitle: 'My Child',
+ path: 'my-folder',
+ });
});
- cy.wait(2000); // just for clearing of toast
// after adding 56 page I need to add a final page to move around.
// when I add a page
+ cy.visit('/my-folder');
+ cy.wait('@content');
+
cy.get('#toolbar-add').click();
cy.get('#toolbar-add-document').click();
cy.getSlateTitle()
@@ -159,6 +157,7 @@ describe('Folder Contents Tests', () => {
// then a new page has been created
cy.get('#toolbar-save').click();
+ cy.wait('@content');
cy.url().should(
'eq',
Cypress.config().baseUrl + '/my-folder/last-and-first-page',
@@ -171,7 +170,7 @@ describe('Folder Contents Tests', () => {
).click();
cy.findByText('Move to top of folder').click();
cy.url().should('eq', Cypress.config().baseUrl + '/my-folder/contents');
- cy.wait(1000); // waiting for settling of odering or search return
+ cy.wait('@reorder');
// Checking if move to top of folder works or not.
cy.get('table tbody tr:first-child a span').findByText(
@@ -181,6 +180,7 @@ describe('Folder Contents Tests', () => {
'tr[aria-label="/my-folder/last-and-first-page"] svg[class="icon dropdown-popup-trigger"]',
).click();
cy.findByText('Move to bottom of folder').click();
+ cy.wait('@reorder');
// Checking whether moving to bottom of folder works or not.
cy.get('.contents-pagination .menu').findByText('2').click();
@@ -195,7 +195,8 @@ describe('Folder Contents Tests', () => {
cy.get(
'tr[aria-label="/my-folder/last-and-first-page"] svg[class="icon dropdown-popup-trigger"]',
).click();
- // cy.intercept('GET', '/plone/++api++/my-folder/@search').as('getSearch'); // I don't know proper way to wait
+ cy.wait('@search');
+
cy.findByText('Move to top of folder').click();
cy.get('.search.item button').click();
@@ -207,6 +208,8 @@ describe('Folder Contents Tests', () => {
'tr[aria-label="/my-folder/last-and-first-page"] svg[class="icon dropdown-popup-trigger"]',
).click();
cy.findByText('Move to bottom of folder').click();
+ cy.wait('@reorder');
+
cy.get('.contents-pagination .menu').findByText('2').click();
// Checking whether moving to bottom of folder works or not.
diff --git a/packages/volto/cypress/tests/core/blocks/blocks-autofocus.js b/packages/volto/cypress/tests/core/blocks/blocks-autofocus.js
index fed851ad51..ef48d8f8bb 100644
--- a/packages/volto/cypress/tests/core/blocks/blocks-autofocus.js
+++ b/packages/volto/cypress/tests/core/blocks/blocks-autofocus.js
@@ -1,7 +1,7 @@
describe('New Block Auto Focus Tests', () => {
beforeEach(() => {
- cy.intercept('GET', `/**/*?expand*`).as('content');
cy.intercept('GET', '/**/my-page').as('content');
+ cy.intercept('GET', '/**/Document').as('schema');
cy.intercept('PATCH', '*').as('save');
// given a logged in editor and a page in edit mode
@@ -15,12 +15,17 @@ describe('New Block Auto Focus Tests', () => {
cy.visit('/my-page');
cy.wait('@content');
+ cy.wait(500);
+
cy.navigate('/my-page/edit');
+ cy.wait('@schema');
});
it('Press Enter on a description block adds new autofocused default block', () => {
cy.addNewBlock('description');
cy.get('.documentDescription').first().click().type('{enter}');
+ cy.get('.block-editor-description + .block-editor-slate');
+ cy.wait(500);
cy.get('*[class^="block-editor"]')
.eq(2)
.within(() => {
@@ -34,6 +39,8 @@ describe('New Block Auto Focus Tests', () => {
cy.get('.blocks-chooser .title').contains('Text').click({ force: true });
cy.get('.blocks-chooser .text').contains('Text').click({ force: true });
cy.get('.text-slate-editor-inner').first().click().type('{enter}');
+ cy.wait(500);
+ cy.get('.block-editor-slate + .block-editor-slate');
cy.get('*[class^="block-editor"]')
.eq(2)
.within(() => {
@@ -43,7 +50,15 @@ describe('New Block Auto Focus Tests', () => {
it('Press Enter on a image block adds new autofocused default block', () => {
cy.addNewBlock('image');
- cy.get('.block-editor-image').first().click().type('{enter}');
+ // Timing issues ahead :(
+ cy.get('.block-editor-image .no-image-wrapper img')
+ .should('be.visible')
+ .and(($img) => {
+ // "naturalWidth" and "naturalHeight" are set when the image loads
+ expect($img[0].naturalWidth).to.be.greaterThan(0);
+ });
+ cy.get('.block-editor-image').wait(500).click('topLeft').type('{enter}');
+ cy.wait(500);
cy.get('*[class^="block-editor"]')
.eq(2)
.within(() => {
@@ -53,7 +68,15 @@ describe('New Block Auto Focus Tests', () => {
it('Press Enter on a video block adds new autofocused default block', () => {
cy.addNewBlock('video');
+ cy.get('.block-editor-video .message img')
+ .should('be.visible')
+ .and(($img) => {
+ // "naturalWidth" and "naturalHeight" are set when the image loads
+ expect($img[0].naturalWidth).to.be.greaterThan(0);
+ });
cy.get('.block-editor-video').first().click().type('{enter}');
+ cy.get('.block-editor-slate + .block-editor-slate');
+ cy.wait(500);
cy.get('*[class^="block-editor"]')
.eq(2)
.within(() => {
@@ -64,6 +87,7 @@ describe('New Block Auto Focus Tests', () => {
it('Press Enter on a listing block adds new autofocused default block', () => {
cy.addNewBlock('listing');
cy.get('.block-editor-listing').first().click().type('{enter}');
+ cy.wait(500);
cy.get('*[class^="block-editor"]')
.eq(2)
.within(() => {
@@ -74,6 +98,7 @@ describe('New Block Auto Focus Tests', () => {
it('Press Enter on a table of contents block adds new autofocused default block', () => {
cy.addNewBlock('contents');
cy.get('.block-editor-toc').first().click().type('{enter}');
+ cy.wait(500);
cy.get('*[class^="block-editor"]')
.eq(2)
.within(() => {
@@ -83,7 +108,14 @@ describe('New Block Auto Focus Tests', () => {
it('Press Enter on a maps block adds new autofocused default block', () => {
cy.addNewBlock('maps');
+ cy.get('.block-editor-maps .message img')
+ .should('be.visible')
+ .and(($img) => {
+ // "naturalWidth" and "naturalHeight" are set when the image loads
+ expect($img[0].naturalWidth).to.be.greaterThan(0);
+ });
cy.get('.block-editor-maps').first().click().type('{enter}');
+ cy.wait(500);
cy.get('*[class^="block-editor"]')
.eq(2)
.within(() => {
@@ -94,6 +126,7 @@ describe('New Block Auto Focus Tests', () => {
it('Press Enter on a html block adds new autofocused default block', () => {
cy.addNewBlock('html');
cy.get('.block-editor-html').first().click().type('{enter}');
+ cy.wait(500);
cy.get('*[class^="block-editor"]')
.eq(2)
.within(() => {
@@ -104,6 +137,7 @@ describe('New Block Auto Focus Tests', () => {
it('Press Enter on a search block adds new autofocused default block', () => {
cy.addNewBlock('search');
cy.get('.block-editor-search').first().click().type('{enter}');
+ cy.wait(500);
cy.get('*[class^="block-editor"]')
.eq(2)
.within(() => {
diff --git a/packages/volto/cypress/tests/core/blocks/blocks-image.js b/packages/volto/cypress/tests/core/blocks/blocks-image.js
index e96bb1dd21..9b76682372 100644
--- a/packages/volto/cypress/tests/core/blocks/blocks-image.js
+++ b/packages/volto/cypress/tests/core/blocks/blocks-image.js
@@ -15,6 +15,8 @@ describe('Blocks Tests', () => {
cy.visit('/my-page');
cy.wait('@content');
+ cy.wait(500);
+
cy.navigate('/my-page/edit');
cy.wait('@schema');
});
@@ -156,7 +158,7 @@ describe('Blocks Tests', () => {
});
});
- it('Create an image block and initially alt attr is empty', () => {
+ it.only('Create an image block and initially alt attr is empty', () => {
// when I add an image block via upload
cy.get('.content-area .slate-editor [contenteditable=true]', {
timeout: 10000,
diff --git a/packages/volto/cypress/tests/core/blocks/listing/blocks-listing.js b/packages/volto/cypress/tests/core/blocks/listing/blocks-listing.js
index cc4f5e13d8..ab7c82bfcf 100644
--- a/packages/volto/cypress/tests/core/blocks/listing/blocks-listing.js
+++ b/packages/volto/cypress/tests/core/blocks/listing/blocks-listing.js
@@ -445,7 +445,9 @@ describe('Listing Block Tests', () => {
//add listing block
cy.scrollTo('bottom');
- cy.addNewBlock('listing', true);
+ cy.getSlate().click();
+ cy.get('.ui.basic.icon.button.block-add-button').click();
+ cy.get('.ui.basic.icon.button.listing').contains('Listing').click();
//******** add Page Type criteria filter
cy.configureListingWith('Page');
diff --git a/packages/volto/cypress/tests/core/controlpanels/dexterity-controlpanel-layout.js b/packages/volto/cypress/tests/core/controlpanels/dexterity-controlpanel-layout.js
index 35a24d1b65..20b1a097e6 100644
--- a/packages/volto/cypress/tests/core/controlpanels/dexterity-controlpanel-layout.js
+++ b/packages/volto/cypress/tests/core/controlpanels/dexterity-controlpanel-layout.js
@@ -21,7 +21,7 @@ describe('ControlPanel: Dexterity Content-Types Layout', () => {
'Book',
);
- cy.visit('/controlpanel/dexterity-types/book/layout');
+ cy.navigate('/controlpanel/dexterity-types/book/layout');
cy.get('#page-controlpanel-layout').contains(
'Can not edit Layout for Book',
);
diff --git a/packages/volto/jest-setup-afterenv.js b/packages/volto/jest-setup-afterenv.js
new file mode 100644
index 0000000000..8c79262657
--- /dev/null
+++ b/packages/volto/jest-setup-afterenv.js
@@ -0,0 +1,2 @@
+// Jest-crap setup after env T_T
+import '@testing-library/jest-dom';
diff --git a/packages/volto/news/3221.breaking b/packages/volto/news/3221.breaking
new file mode 100644
index 0000000000..3260496e2f
--- /dev/null
+++ b/packages/volto/news/3221.breaking
@@ -0,0 +1 @@
+Upgrade Volto core to use React 18.2.0 @sneridagh
diff --git a/packages/volto/package.json b/packages/volto/package.json
index 582e195212..8529184635 100644
--- a/packages/volto/package.json
+++ b/packages/volto/package.json
@@ -110,6 +110,9 @@
"./test-setup-config.js"
],
"globalSetup": "./global-test-setup.js",
+ "setupFilesAfterEnv": [
+ "/jest-setup-afterenv.js"
+ ],
"globals": {
"__DEV__": true
},
@@ -276,7 +279,7 @@
"razzle-dev-utils": "4.2.18",
"razzle-plugin-scss": "4.2.18",
"rc-time-picker": "3.7.3",
- "react": "17.0.2",
+ "react": "18.2.0",
"react-anchor-link-smooth-scroll": "1.0.12",
"react-animate-height": "2.0.17",
"react-beautiful-dnd": "13.0.0",
@@ -285,17 +288,16 @@
"react-detect-click-outside": "1.1.1",
"react-dnd": "5.0.0",
"react-dnd-html5-backend": "5.0.1",
- "react-dom": "17.0.2",
+ "react-dom": "18.2.0",
"react-dropzone": "11.1.0",
"react-fast-compare": "2.0.4",
"react-image-gallery": "1.2.7",
"react-intersection-observer": "9.1.0",
"react-intl": "3.8.0",
- "react-intl-redux": "2.2.0",
+ "react-intl-redux": "2.3.0",
"react-medium-image-zoom": "3.0.15",
"react-popper": "^2.3.0",
- "react-portal": "4.2.1",
- "react-redux": "7.2.4",
+ "react-redux": "8.1.2",
"react-router": "5.2.0",
"react-router-config": "5.1.1",
"react-router-dom": "5.2.0",
@@ -303,21 +305,21 @@
"react-select": "4.3.1",
"react-select-async-paginate": "0.5.3",
"react-share": "2.3.1",
- "react-side-effect": "2.1.0",
+ "react-side-effect": "2.1.2",
"react-simple-code-editor": "0.7.1",
"react-sortable-hoc": "2.0.0",
- "react-test-renderer": "17.0.2",
+ "react-test-renderer": "18.2.0",
"react-toastify": "5.4.1",
"react-transition-group": "4.4.5",
"react-virtualized": "9.22.3",
"redraft": "0.10.2",
- "redux": "4.1.0",
- "redux-actions": "2.6.5",
+ "redux": "4.2.1",
+ "redux-actions": "3.0.0",
"redux-connect": "10.0.0",
- "redux-devtools-extension": "2.13.8",
- "redux-localstorage-simple": "2.3.1",
+ "redux-devtools-extension": "2.13.9",
+ "redux-localstorage-simple": "2.5.1",
"redux-mock-store": "1.5.4",
- "redux-thunk": "2.3.0",
+ "redux-thunk": "2.4.2",
"rrule": "2.7.1",
"semantic-ui-less": "2.4.1",
"semantic-ui-react": "2.1.5",
@@ -362,13 +364,15 @@
"@storybook/manager-webpack5": "^6.5.15",
"@storybook/react": "^6.5.15",
"@testing-library/cypress": "9.0.0",
- "@testing-library/jest-dom": "5.16.4",
- "@testing-library/react": "12.1.5",
+ "@testing-library/jest-dom": "6.4.1",
+ "@testing-library/react": "14.2.0",
"@testing-library/react-hooks": "8.0.1",
"@types/jest": "^29.5.8",
"@types/lodash": "^4.14.201",
+ "@types/react": "^18",
+ "@types/react-dom": "^18",
"@types/react-router-dom": "^5.3.3",
- "@types/react-test-renderer": "18.0.1",
+ "@types/react-test-renderer": "18.0.7",
"@types/uuid": "^9.0.2",
"@typescript-eslint/eslint-plugin": "6.7.0",
"@typescript-eslint/parser": "6.7.0",
@@ -385,7 +389,7 @@
"jsonwebtoken": "9.0.0",
"react-docgen-typescript-plugin": "^1.0.5",
"react-error-overlay": "6.0.9",
- "react-is": "^16.13.1",
+ "react-is": "^18.2.0",
"release-it": "^16.2.1",
"semver": "^7.5.4",
"tmp": "0.2.1",
diff --git a/packages/volto/src/components/manage/Add/Add.jsx b/packages/volto/src/components/manage/Add/Add.jsx
index d1c14bee17..c16b41e2d7 100644
--- a/packages/volto/src/components/manage/Add/Add.jsx
+++ b/packages/volto/src/components/manage/Add/Add.jsx
@@ -11,7 +11,7 @@ import { compose } from 'redux';
import { keys, isEmpty } from 'lodash';
import { defineMessages, injectIntl } from 'react-intl';
import { Button, Grid, Menu } from 'semantic-ui-react';
-import { Portal } from 'react-portal';
+import { createPortal } from 'react-dom';
import { v4 as uuid } from 'uuid';
import qs from 'query-string';
import { toast } from 'react-toastify';
@@ -366,8 +366,8 @@ class Add extends Component {
}}
global
/>
- {this.state.isClient && (
-
+ {this.state.isClient &&
+ createPortal(
>
}
- />
-
- )}
- {visual && this.state.isClient && (
-
-
-
- )}
+ />,
+ document.getElementById('toolbar'),
+ )}
+ {visual &&
+ this.state.isClient &&
+ createPortal( , document.getElementById('sidebar'))}
);
diff --git a/packages/volto/src/components/manage/Add/Add.test.jsx b/packages/volto/src/components/manage/Add/Add.test.jsx
index 2a1ee56192..4d6500e885 100644
--- a/packages/volto/src/components/manage/Add/Add.test.jsx
+++ b/packages/volto/src/components/manage/Add/Add.test.jsx
@@ -1,5 +1,5 @@
import React from 'react';
-import renderer from 'react-test-renderer';
+import { render } from '@testing-library/react';
import configureStore from 'redux-mock-store';
import { Provider } from 'react-intl-redux';
import config from '@plone/volto/registry';
@@ -16,9 +16,8 @@ beforeAll(() => {
config.settings.loadables = {};
});
-jest.mock('react-portal', () => ({
- Portal: jest.fn(() =>
),
-}));
+jest.mock('../Toolbar/Toolbar', () => jest.fn(() =>
));
+
jest.mock('../Form/Form', () => jest.fn(() =>
));
describe('Add', () => {
@@ -39,13 +38,12 @@ describe('Add', () => {
messages: {},
},
});
- const component = renderer.create(
+ const { container } = render(
,
);
- const json = component.toJSON();
- expect(json).toMatchSnapshot();
+ expect(container).toMatchSnapshot();
});
it('renders an add component', () => {
@@ -67,13 +65,13 @@ describe('Add', () => {
messages: {},
},
});
- const component = renderer.create(
+ const { container } = render(
,
);
- const json = component.toJSON();
- expect(json).toMatchSnapshot();
+
+ expect(container).toMatchSnapshot();
});
it('renders an add component with schema', () => {
@@ -106,12 +104,12 @@ describe('Add', () => {
messages: {},
},
});
- const component = renderer.create(
+ const { container } = render(
,
);
- const json = component.toJSON();
- expect(json).toMatchSnapshot();
+
+ expect(container).toMatchSnapshot();
});
});
diff --git a/packages/volto/src/components/manage/Add/__snapshots__/Add.test.jsx.snap b/packages/volto/src/components/manage/Add/__snapshots__/Add.test.jsx.snap
index 00ad89f369..e0b4e6d306 100644
--- a/packages/volto/src/components/manage/Add/__snapshots__/Add.test.jsx.snap
+++ b/packages/volto/src/components/manage/Add/__snapshots__/Add.test.jsx.snap
@@ -1,7 +1,19 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
-exports[`Add renders an add component 1`] = `
`;
+exports[`Add renders an add component 1`] = `
+
+`;
-exports[`Add renders an add component with schema 1`] = `
`;
+exports[`Add renders an add component with schema 1`] = `
+
+`;
-exports[`Add renders an empty add component 1`] = `
`;
+exports[`Add renders an empty add component 1`] = `
+
+`;
diff --git a/packages/volto/src/components/manage/Aliases/Aliases.jsx b/packages/volto/src/components/manage/Aliases/Aliases.jsx
index 7554a9f20f..15af7a0326 100644
--- a/packages/volto/src/components/manage/Aliases/Aliases.jsx
+++ b/packages/volto/src/components/manage/Aliases/Aliases.jsx
@@ -8,7 +8,7 @@ import { Helmet } from '@plone/volto/helpers';
import { connect } from 'react-redux';
import { compose } from 'redux';
import { Link } from 'react-router-dom';
-import { Portal } from 'react-portal';
+import { createPortal } from 'react-dom';
import {
Button,
Checkbox,
@@ -317,8 +317,8 @@ class Aliases extends Component {
- {this.state.isClient && (
-
+ {this.state.isClient &&
+ createPortal(
}
- />
-
- )}
+ />,
+ document.getElementById('toolbar'),
+ )}
);
}
diff --git a/packages/volto/src/components/manage/Aliases/Aliases.test.jsx b/packages/volto/src/components/manage/Aliases/Aliases.test.jsx
index 31350c8d94..3ded78f739 100644
--- a/packages/volto/src/components/manage/Aliases/Aliases.test.jsx
+++ b/packages/volto/src/components/manage/Aliases/Aliases.test.jsx
@@ -1,5 +1,5 @@
import React from 'react';
-import renderer from 'react-test-renderer';
+import { render } from '@testing-library/react';
import { Provider } from 'react-intl-redux';
import configureMockStore from 'redux-mock-store';
import thunk from 'redux-thunk';
@@ -9,9 +9,8 @@ import Aliases from './Aliases';
const middlewares = [thunk];
const mockStore = configureMockStore(middlewares);
-jest.mock('react-portal', () => ({
- Portal: jest.fn(() =>
),
-}));
+jest.mock('../Toolbar/Toolbar', () => jest.fn(() =>
));
+
jest.mock('../Toolbar/More', () => jest.fn(() =>
));
describe('Aliases', () => {
@@ -45,12 +44,13 @@ describe('Aliases', () => {
messages: {},
},
});
- const component = renderer.create(
+ const { container } = render(
+
,
);
- const json = component.toJSON();
- expect(json).toMatchSnapshot();
+
+ expect(container).toMatchSnapshot();
});
});
diff --git a/packages/volto/src/components/manage/Aliases/__snapshots__/Aliases.test.jsx.snap b/packages/volto/src/components/manage/Aliases/__snapshots__/Aliases.test.jsx.snap
index 85b8d5c307..5bfa3e94a7 100644
--- a/packages/volto/src/components/manage/Aliases/__snapshots__/Aliases.test.jsx.snap
+++ b/packages/volto/src/components/manage/Aliases/__snapshots__/Aliases.test.jsx.snap
@@ -1,96 +1,97 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Aliases renders aliases object control 1`] = `
-
+
- URL Management for
-
- Blog
-
-
-
- Using this form, you can manage alternative urls for an item. This is an easy way to make an item available under two different URLs.
-
-
-
-
+
+
+ id="toolbar"
+ >
+
+
`;
diff --git a/packages/volto/src/components/manage/BlockChooser/BlockChooser.test.jsx b/packages/volto/src/components/manage/BlockChooser/BlockChooser.test.jsx
index 22fd5b5f48..447c20f61d 100644
--- a/packages/volto/src/components/manage/BlockChooser/BlockChooser.test.jsx
+++ b/packages/volto/src/components/manage/BlockChooser/BlockChooser.test.jsx
@@ -1,5 +1,4 @@
import React from 'react';
-import '@testing-library/jest-dom/extend-expect';
import { render, screen } from '@testing-library/react';
import { Provider } from 'react-intl-redux';
import configureStore from 'redux-mock-store';
diff --git a/packages/volto/src/components/manage/BlockChooser/BlockChooserButton.jsx b/packages/volto/src/components/manage/BlockChooser/BlockChooserButton.jsx
index d52389492d..136b413b70 100644
--- a/packages/volto/src/components/manage/BlockChooser/BlockChooserButton.jsx
+++ b/packages/volto/src/components/manage/BlockChooser/BlockChooserButton.jsx
@@ -7,7 +7,7 @@ import config from '@plone/volto/registry';
import { Button, Ref } from 'semantic-ui-react';
import { defineMessages, useIntl } from 'react-intl';
import { usePopper } from 'react-popper';
-import { Portal } from 'react-portal';
+import { createPortal } from 'react-dom';
const messages = defineMessages({
addBlock: {
@@ -115,8 +115,8 @@ const BlockChooserButton = (props) => {
/>
)}
- {addNewBlockOpened && (
-
+ {addNewBlockOpened &&
+ createPortal(
{
navRoot={navRoot}
contentType={contentType}
/>
-
-
- )}
+ ,
+ document.body,
+ )}
>
);
};
diff --git a/packages/volto/src/components/manage/BlockChooser/BlockChooserSearch.test.jsx b/packages/volto/src/components/manage/BlockChooser/BlockChooserSearch.test.jsx
index 7176bdda06..2bc70ced70 100644
--- a/packages/volto/src/components/manage/BlockChooser/BlockChooserSearch.test.jsx
+++ b/packages/volto/src/components/manage/BlockChooser/BlockChooserSearch.test.jsx
@@ -1,5 +1,4 @@
import React from 'react';
-import '@testing-library/jest-dom/extend-expect';
import { render } from '@testing-library/react';
import BlockChooserSearch from './BlockChooserSearch';
import { Provider } from 'react-intl-redux';
diff --git a/packages/volto/src/components/manage/BlockChooser/__snapshots__/BlockChooser.test.jsx.snap b/packages/volto/src/components/manage/BlockChooser/__snapshots__/BlockChooser.test.jsx.snap
index d61323c068..b0f6bc9a54 100644
--- a/packages/volto/src/components/manage/BlockChooser/__snapshots__/BlockChooser.test.jsx.snap
+++ b/packages/volto/src/components/manage/BlockChooser/__snapshots__/BlockChooser.test.jsx.snap
@@ -26,7 +26,6 @@ exports[`BlocksChooser Fallback BlockChooser component onMutateBlock 1`] = `
value=""
/>
-
Image
-
Listing
-
Video
-
@@ -142,7 +138,6 @@ exports[`BlocksChooser Fallback BlockChooser component onMutateBlock 1`] = `
style="height: 36px; width: auto; fill: currentColor;"
/>
Text
-
@@ -186,7 +181,6 @@ exports[`BlocksChooser Fallback BlockChooser component onMutateBlock 1`] = `
style="height: 36px; width: auto; fill: currentColor;"
/>
Image
-
Lead Image Field
-
Video
-
@@ -258,7 +250,6 @@ exports[`BlocksChooser Fallback BlockChooser component onMutateBlock 1`] = `
style="height: 36px; width: auto; fill: currentColor;"
/>
Listing
-
Table of Contents
-
Hero
-
Maps
-
HTML
-
Table
-
@@ -365,7 +351,6 @@ exports[`BlocksChooser renders a BlockChooser component 1`] = `
value=""
/>
-
Image
-
Listing
-
Video
-
@@ -481,7 +463,6 @@ exports[`BlocksChooser renders a BlockChooser component 1`] = `
style="height: 36px; width: auto; fill: currentColor;"
/>
Text
-
@@ -525,7 +506,6 @@ exports[`BlocksChooser renders a BlockChooser component 1`] = `
style="height: 36px; width: auto; fill: currentColor;"
/>
Image
-
Lead Image Field
-
Video
-
@@ -597,7 +575,6 @@ exports[`BlocksChooser renders a BlockChooser component 1`] = `
style="height: 36px; width: auto; fill: currentColor;"
/>
Listing
-
Table of Contents
-
Hero
-
Maps
-
HTML
-
Table
-
diff --git a/packages/volto/src/components/manage/Blocks/Block/Settings.test.jsx b/packages/volto/src/components/manage/Blocks/Block/Settings.test.jsx
index 57b7ea90ca..8cc2a7f301 100644
--- a/packages/volto/src/components/manage/Blocks/Block/Settings.test.jsx
+++ b/packages/volto/src/components/manage/Blocks/Block/Settings.test.jsx
@@ -1,7 +1,6 @@
import React from 'react';
import Settings from './Settings';
import { render } from '@testing-library/react';
-import '@testing-library/jest-dom/extend-expect';
import configureStore from 'redux-mock-store';
import config from '@plone/volto/registry';
import { Provider } from 'react-intl-redux';
diff --git a/packages/volto/src/components/manage/Blocks/Container/NewBlockAddButton.jsx b/packages/volto/src/components/manage/Blocks/Container/NewBlockAddButton.jsx
index 89076a0560..713f518e22 100644
--- a/packages/volto/src/components/manage/Blocks/Container/NewBlockAddButton.jsx
+++ b/packages/volto/src/components/manage/Blocks/Container/NewBlockAddButton.jsx
@@ -5,7 +5,7 @@ import { BlockChooser, Icon } from '@plone/volto/components';
import { useDetectClickOutside } from '@plone/volto/helpers';
import addSVG from '@plone/volto/icons/add.svg';
import { usePopper } from 'react-popper';
-import { Portal } from 'react-portal';
+import { createPortal } from 'react-dom';
const messages = defineMessages({
addBlock: {
@@ -59,24 +59,25 @@ const NewBlockAddButton = (props) => {
- {isOpenMenu ? (
-
-
-
-
-
- ) : null}
+ {isOpenMenu
+ ? createPortal(
+
+
+
,
+ document.body,
+ )
+ : null}
>
);
};
diff --git a/packages/volto/src/components/manage/Blocks/Image/View.test.jsx b/packages/volto/src/components/manage/Blocks/Image/View.test.jsx
index fb073c2f21..81aac59bfd 100644
--- a/packages/volto/src/components/manage/Blocks/Image/View.test.jsx
+++ b/packages/volto/src/components/manage/Blocks/Image/View.test.jsx
@@ -1,5 +1,4 @@
import React from 'react';
-import '@testing-library/jest-dom/extend-expect';
import { render } from '@testing-library/react';
import { MemoryRouter } from 'react-router-dom';
import { Provider } from 'react-intl-redux';
diff --git a/packages/volto/src/components/manage/Blocks/Table/Edit.jsx b/packages/volto/src/components/manage/Blocks/Table/Edit.jsx
index dee0234118..2f00b4ba77 100644
--- a/packages/volto/src/components/manage/Blocks/Table/Edit.jsx
+++ b/packages/volto/src/components/manage/Blocks/Table/Edit.jsx
@@ -8,7 +8,7 @@ import PropTypes from 'prop-types';
import { compose } from 'redux';
import { map, remove } from 'lodash';
import { Button, Segment, Table, Form } from 'semantic-ui-react';
-import { Portal } from 'react-portal';
+import { createPortal } from 'react-dom';
import cx from 'classnames';
import { FormattedMessage, defineMessages, injectIntl } from 'react-intl';
@@ -670,8 +670,9 @@ class Edit extends Component {
)}
- {this.props.selected && this.state.isClient && (
-
+ {this.props.selected &&
+ this.state.isClient &&
+ createPortal(
{
@@ -736,9 +737,9 @@ class Edit extends Component {
onChange={this.toggleCellType}
/>
-
-
- )}
+ ,
+ document.getElementById('sidebar-properties'),
+ )}
);
}
diff --git a/packages/volto/src/components/manage/Blocks/ToC/variations/__snapshots__/DefaultTocRenderer.test.jsx.snap b/packages/volto/src/components/manage/Blocks/ToC/variations/__snapshots__/DefaultTocRenderer.test.jsx.snap
index 59f2bde9df..b1037d169f 100644
--- a/packages/volto/src/components/manage/Blocks/ToC/variations/__snapshots__/DefaultTocRenderer.test.jsx.snap
+++ b/packages/volto/src/components/manage/Blocks/ToC/variations/__snapshots__/DefaultTocRenderer.test.jsx.snap
@@ -1,47 +1,44 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`renders a default toc renderer component 1`] = `
-Array [
- "",
- ,
-]
+ Test level 3
+
+
+
+
+
`;
diff --git a/packages/volto/src/components/manage/Contents/Contents.jsx b/packages/volto/src/components/manage/Contents/Contents.jsx
index c462592977..66805cabdb 100644
--- a/packages/volto/src/components/manage/Contents/Contents.jsx
+++ b/packages/volto/src/components/manage/Contents/Contents.jsx
@@ -7,7 +7,7 @@ import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { compose } from 'redux';
-import { Portal } from 'react-portal';
+import { createPortal } from 'react-dom';
import { Link } from 'react-router-dom';
import {
Button,
@@ -2159,8 +2159,8 @@ class Contents extends Component {
- {this.state.isClient && (
-
+ {this.state.isClient &&
+ createPortal(
}
- />
-
- )}
+ />,
+ document.getElementById('toolbar'),
+ )}
) : (
diff --git a/packages/volto/src/components/manage/Contents/Contents.test.jsx b/packages/volto/src/components/manage/Contents/Contents.test.jsx
index 48f01c1562..87982d36d4 100644
--- a/packages/volto/src/components/manage/Contents/Contents.test.jsx
+++ b/packages/volto/src/components/manage/Contents/Contents.test.jsx
@@ -1,5 +1,5 @@
import React from 'react';
-import renderer from 'react-test-renderer';
+import { render } from '@testing-library/react';
import configureStore from 'redux-mock-store';
import { Provider } from 'react-intl-redux';
import { MemoryRouter } from 'react-router-dom';
@@ -14,9 +14,8 @@ beforeAll(
await require('@plone/volto/helpers/Loadable/Loadable').__setLoadables(),
);
-jest.mock('react-portal', () => ({
- Portal: jest.fn(() =>
),
-}));
+jest.mock('../Toolbar/Toolbar', () => jest.fn(() =>
));
+
jest.mock('../../theme/Pagination/Pagination', () =>
jest.fn(() =>
),
);
@@ -91,14 +90,15 @@ describe('Contents', () => {
messages: {},
},
});
- const component = renderer.create(
+ const { container } = render(
+
,
);
- const json = component.toJSON();
- expect(json).toMatchSnapshot();
+
+ expect(container).toMatchSnapshot();
});
});
diff --git a/packages/volto/src/components/manage/Contents/ContentsPropertiesModal.test.jsx b/packages/volto/src/components/manage/Contents/ContentsPropertiesModal.test.jsx
index dd4a2b65bf..126e695026 100644
--- a/packages/volto/src/components/manage/Contents/ContentsPropertiesModal.test.jsx
+++ b/packages/volto/src/components/manage/Contents/ContentsPropertiesModal.test.jsx
@@ -1,5 +1,5 @@
import React from 'react';
-import renderer from 'react-test-renderer';
+import { render } from '@testing-library/react';
import configureStore from 'redux-mock-store';
import { Provider } from 'react-intl-redux';
@@ -23,7 +23,7 @@ describe('ContentsPropertiesModal', () => {
messages: {},
},
});
- const component = renderer.create(
+ const { container } = render(
{
/>
,
);
- const json = component.toJSON();
- expect(json).toMatchSnapshot();
+
+ expect(container).toMatchSnapshot();
});
});
diff --git a/packages/volto/src/components/manage/Contents/__snapshots__/Contents.test.jsx.snap b/packages/volto/src/components/manage/Contents/__snapshots__/Contents.test.jsx.snap
index a348d4c3db..2c6dd5c65f 100644
--- a/packages/volto/src/components/manage/Contents/__snapshots__/Contents.test.jsx.snap
+++ b/packages/volto/src/components/manage/Contents/__snapshots__/Contents.test.jsx.snap
@@ -1,1067 +1,600 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Contents renders a folder contents view component 1`] = `
-
+
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+ Home
+
- Select columns to show
+ /
+ Blog
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
- Title
-
-
- Actions
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+ Title
+
+
+ Actions
+
+
+
+
+
+
+ class="contents-pagination"
+ >
+
+
-
-
-
+
+
+
+
+
diff --git a/packages/volto/src/components/manage/Contents/__snapshots__/ContentsPropertiesModal.test.jsx.snap b/packages/volto/src/components/manage/Contents/__snapshots__/ContentsPropertiesModal.test.jsx.snap
index 3c382ace86..c460a95329 100644
--- a/packages/volto/src/components/manage/Contents/__snapshots__/ContentsPropertiesModal.test.jsx.snap
+++ b/packages/volto/src/components/manage/Contents/__snapshots__/ContentsPropertiesModal.test.jsx.snap
@@ -1,7 +1,9 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`ContentsPropertiesModal renders a contents properties modal component 1`] = `
-
+
`;
diff --git a/packages/volto/src/components/manage/Controlpanels/AddonsControlpanel.jsx b/packages/volto/src/components/manage/Controlpanels/AddonsControlpanel.jsx
index 1248c90cbf..66e1bc7a06 100644
--- a/packages/volto/src/components/manage/Controlpanels/AddonsControlpanel.jsx
+++ b/packages/volto/src/components/manage/Controlpanels/AddonsControlpanel.jsx
@@ -7,7 +7,7 @@ import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { compose } from 'redux';
import { Link } from 'react-router-dom';
-import { Portal } from 'react-portal';
+import { createPortal } from 'react-dom';
import {
Accordion,
Button,
@@ -550,8 +550,8 @@ class AddonsControlpanel extends Component {
)}
- {this.state.isClient && (
-
+ {this.state.isClient &&
+ createPortal(
>
}
- />
-
- )}
+ />,
+ document.getElementById('toolbar'),
+ )}
);
}
diff --git a/packages/volto/src/components/manage/Controlpanels/AddonsControlpanel.test.jsx b/packages/volto/src/components/manage/Controlpanels/AddonsControlpanel.test.jsx
index 460b69f85e..67ce84f2ac 100644
--- a/packages/volto/src/components/manage/Controlpanels/AddonsControlpanel.test.jsx
+++ b/packages/volto/src/components/manage/Controlpanels/AddonsControlpanel.test.jsx
@@ -1,5 +1,5 @@
import React from 'react';
-import renderer from 'react-test-renderer';
+import { render } from '@testing-library/react';
import configureStore from 'redux-mock-store';
import { Provider } from 'react-intl-redux';
@@ -7,9 +7,7 @@ import AddonsControlpanel from './AddonsControlpanel';
const mockStore = configureStore();
-jest.mock('react-portal', () => ({
- Portal: jest.fn(() =>
),
-}));
+jest.mock('../Toolbar/Toolbar', () => jest.fn(() =>
));
describe('AddonsControlpanel', () => {
it('renders an addon control component', () => {
@@ -57,12 +55,13 @@ describe('AddonsControlpanel', () => {
messages: {},
},
});
- const component = renderer.create(
+ const { container } = render(
+
,
);
- const json = component.toJSON();
- expect(json).toMatchSnapshot();
+
+ expect(container).toMatchSnapshot();
});
});
diff --git a/packages/volto/src/components/manage/Controlpanels/Aliases.jsx b/packages/volto/src/components/manage/Controlpanels/Aliases.jsx
index 6a927d7ae5..6b985ea3d3 100644
--- a/packages/volto/src/components/manage/Controlpanels/Aliases.jsx
+++ b/packages/volto/src/components/manage/Controlpanels/Aliases.jsx
@@ -10,7 +10,7 @@ import { compose } from 'redux';
import { Link } from 'react-router-dom';
import { getBaseUrl, getParentUrl, Helmet } from '@plone/volto/helpers';
import { removeAliases, addAliases, getAliases } from '@plone/volto/actions';
-import { Portal } from 'react-portal';
+import { createPortal } from 'react-dom';
import {
Container,
Button,
@@ -652,8 +652,8 @@ class Aliases extends Component {
- {this.state.isClient && (
-
+ {this.state.isClient &&
+ createPortal(
}
- />
-
- )}
+ />,
+ document.getElementById('toolbar'),
+ )}
);
}
diff --git a/packages/volto/src/components/manage/Controlpanels/Aliases.test.jsx b/packages/volto/src/components/manage/Controlpanels/Aliases.test.jsx
index 661611753f..c6a9a18010 100644
--- a/packages/volto/src/components/manage/Controlpanels/Aliases.test.jsx
+++ b/packages/volto/src/components/manage/Controlpanels/Aliases.test.jsx
@@ -1,5 +1,5 @@
import React from 'react';
-import renderer from 'react-test-renderer';
+import { render } from '@testing-library/react';
import configureMockStore from 'redux-mock-store';
import thunk from 'redux-thunk';
import { Provider } from 'react-intl-redux';
@@ -10,9 +10,7 @@ import { MemoryRouter } from 'react-router';
const middlewares = [thunk];
const mockStore = configureMockStore(middlewares);
-jest.mock('react-portal', () => ({
- Portal: jest.fn(() =>
),
-}));
+jest.mock('../Toolbar/Toolbar', () => jest.fn(() =>
));
describe('Aliases', () => {
it('renders an aliases control component', () => {
@@ -59,14 +57,15 @@ describe('Aliases', () => {
messages: {},
},
});
- const component = renderer.create(
+ const { container } = render(
+
,
);
- const json = component.toJSON();
- expect(json).toMatchSnapshot();
+
+ expect(container).toMatchSnapshot();
});
});
diff --git a/packages/volto/src/components/manage/Controlpanels/ContentType.jsx b/packages/volto/src/components/manage/Controlpanels/ContentType.jsx
index 097dd488ff..6b8edbb9e6 100644
--- a/packages/volto/src/components/manage/Controlpanels/ContentType.jsx
+++ b/packages/volto/src/components/manage/Controlpanels/ContentType.jsx
@@ -8,7 +8,7 @@ import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { compose } from 'redux';
import { getParentUrl } from '@plone/volto/helpers';
-import { Portal } from 'react-portal';
+import { createPortal } from 'react-dom';
import { Button, Header } from 'semantic-ui-react';
import { defineMessages, injectIntl } from 'react-intl';
import { toast } from 'react-toastify';
@@ -210,8 +210,8 @@ class ContentType extends Component {
hideActions
loading={this.props.cpanelRequest.update.loading}
/>
- {this.state.isClient && (
-
+ {this.state.isClient &&
+ createPortal(
>
}
- />
-
- )}
+ />,
+ document.getElementById('toolbar'),
+ )}
);
}
diff --git a/packages/volto/src/components/manage/Controlpanels/ContentType.test.jsx b/packages/volto/src/components/manage/Controlpanels/ContentType.test.jsx
index 63aa9fcd68..159c303936 100644
--- a/packages/volto/src/components/manage/Controlpanels/ContentType.test.jsx
+++ b/packages/volto/src/components/manage/Controlpanels/ContentType.test.jsx
@@ -1,16 +1,14 @@
import React from 'react';
-import renderer from 'react-test-renderer';
import configureStore from 'redux-mock-store';
import { Provider } from 'react-intl-redux';
import { MemoryRouter, Route } from 'react-router-dom';
+import { render } from '@testing-library/react';
import ContentType from './ContentType';
const mockStore = configureStore();
-jest.mock('react-portal', () => ({
- Portal: jest.fn(() =>
),
-}));
+jest.mock('../Toolbar/Toolbar', () => jest.fn(() =>
));
jest.mock('../Form/Form', () => jest.fn(() =>
));
describe('ContentType', () => {
@@ -35,7 +33,8 @@ describe('ContentType', () => {
messages: {},
},
});
- const component = renderer.create(
+
+ const { container } = render(
{
path={'/controlpanel/dexterity-types/:id'}
component={ContentType}
/>
+
,
);
- const json = component.toJSON();
- expect(json).toMatchSnapshot();
+
+ expect(container).toMatchSnapshot();
});
});
diff --git a/packages/volto/src/components/manage/Controlpanels/ContentTypeLayout.jsx b/packages/volto/src/components/manage/Controlpanels/ContentTypeLayout.jsx
index b2754d90ba..3e5cd1a388 100644
--- a/packages/volto/src/components/manage/Controlpanels/ContentTypeLayout.jsx
+++ b/packages/volto/src/components/manage/Controlpanels/ContentTypeLayout.jsx
@@ -14,7 +14,7 @@ import {
getBlocksFieldname,
getBlocksLayoutFieldname,
} from '@plone/volto/helpers';
-import { Portal } from 'react-portal';
+import { createPortal } from 'react-dom';
import { Button, Segment } from 'semantic-ui-react';
import { toast } from 'react-toastify';
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
@@ -343,26 +343,30 @@ class ContentTypeLayout extends Component {
content={this.props.intl.formatMessage(messages.enable)}
/>
-
-
- this.onCancel()}>
-
-
- >
- }
- />
-
+ {this.state.isClient &&
+ createPortal(
+
+ this.onCancel()}
+ >
+
+
+ >
+ }
+ />,
+ document.getElementById('toolbar'),
+ )}
>
);
}
@@ -392,26 +396,30 @@ class ContentTypeLayout extends Component {
content={this.props.intl.formatMessage(messages.enable)}
/>
-
-
- this.onCancel()}>
-
-
- >
- }
- />
-
+ {this.state.isClient &&
+ createPortal(
+
+ this.onCancel()}
+ >
+
+
+ >
+ }
+ />,
+ document.getElementById('toolbar'),
+ )}
>
);
}
@@ -449,50 +457,50 @@ class ContentTypeLayout extends Component {
visual={this.state.visual}
hideActions
/>
-
-
-
-
-
- this.form.current.onSubmit()}
- disabled={this.props.schemaRequest.update.loading}
- loading={this.props.schemaRequest.update.loading}
- >
-
-
- this.onCancel()}
- >
-
-
- >
- }
- />
-
+ {this.state.isClient &&
+ createPortal(
+ ,
+ document.getElementById('sidebar'),
+ )}
+ {this.state.isClient &&
+ createPortal(
+
+ this.form.current.onSubmit()}
+ disabled={this.props.schemaRequest.update.loading}
+ loading={this.props.schemaRequest.update.loading}
+ >
+
+
+ this.onCancel()}
+ >
+
+
+ >
+ }
+ />,
+ document.getElementById('toolbar'),
+ )}
);
}
diff --git a/packages/volto/src/components/manage/Controlpanels/ContentTypeLayout.test.jsx b/packages/volto/src/components/manage/Controlpanels/ContentTypeLayout.test.jsx
index 70127b8477..aee7d78ec6 100644
--- a/packages/volto/src/components/manage/Controlpanels/ContentTypeLayout.test.jsx
+++ b/packages/volto/src/components/manage/Controlpanels/ContentTypeLayout.test.jsx
@@ -1,5 +1,5 @@
import React from 'react';
-import renderer from 'react-test-renderer';
+import { render } from '@testing-library/react';
import configureStore from 'redux-mock-store';
import { Provider } from 'react-intl-redux';
import { MemoryRouter, Route } from 'react-router-dom';
@@ -8,9 +8,8 @@ import ContentTypeLayout from './ContentTypeLayout';
const mockStore = configureStore();
-jest.mock('react-portal', () => ({
- Portal: jest.fn(() =>
),
-}));
+jest.mock('../Toolbar/Toolbar', () => jest.fn(() =>
));
+
jest.mock('../Form/Form', () => jest.fn(() =>
));
describe('ContentTypeLayout', () => {
@@ -38,7 +37,7 @@ describe('ContentTypeLayout', () => {
schema: null,
},
});
- const component = renderer.create(
+ const { container } = render(
{
path={'/controlpanel/dexterity-types/:id/layout'}
component={ContentTypeLayout}
/>
+
,
);
- const json = component.toJSON();
- expect(json).toMatchSnapshot();
+
+ expect(container).toMatchSnapshot();
});
});
diff --git a/packages/volto/src/components/manage/Controlpanels/ContentTypeSchema.jsx b/packages/volto/src/components/manage/Controlpanels/ContentTypeSchema.jsx
index b8ebf1dea0..ab6888140b 100644
--- a/packages/volto/src/components/manage/Controlpanels/ContentTypeSchema.jsx
+++ b/packages/volto/src/components/manage/Controlpanels/ContentTypeSchema.jsx
@@ -12,7 +12,7 @@ import saveSVG from '@plone/volto/icons/save.svg';
import PropTypes from 'prop-types';
import React, { Component } from 'react';
import { defineMessages, injectIntl } from 'react-intl';
-import { Portal } from 'react-portal';
+import { createPortal } from 'react-dom';
import { connect } from 'react-redux';
import { toast } from 'react-toastify';
import { compose } from 'redux';
@@ -283,8 +283,8 @@ class ContentTypeSchema extends Component {
onCancel={this.onCancel}
hideActions
/>
- {this.state.isClient && (
-
+ {this.state.isClient &&
+ createPortal(
>
}
- />
-
- )}
+ />,
+ document.getElementById('toolbar'),
+ )}
);
}
diff --git a/packages/volto/src/components/manage/Controlpanels/ContentTypes.jsx b/packages/volto/src/components/manage/Controlpanels/ContentTypes.jsx
index 4c386c4bce..4759ed6fb2 100644
--- a/packages/volto/src/components/manage/Controlpanels/ContentTypes.jsx
+++ b/packages/volto/src/components/manage/Controlpanels/ContentTypes.jsx
@@ -9,7 +9,7 @@ import { connect } from 'react-redux';
import { compose } from 'redux';
import { Link } from 'react-router-dom';
import { getParentUrl } from '@plone/volto/helpers';
-import { Portal } from 'react-portal';
+import { createPortal } from 'react-dom';
import { last } from 'lodash';
import { Confirm, Container, Table, Button, Header } from 'semantic-ui-react';
import { toast } from 'react-toastify';
@@ -457,8 +457,8 @@ class ContentTypes extends Component {
- {this.state.isClient && (
-
+ {this.state.isClient &&
+ createPortal(
>
}
- />
-
- )}
+ />,
+ document.getElementById('toolbar'),
+ )}
);
}
diff --git a/packages/volto/src/components/manage/Controlpanels/ContentTypes.test.jsx b/packages/volto/src/components/manage/Controlpanels/ContentTypes.test.jsx
index 876aed77df..5289835b93 100644
--- a/packages/volto/src/components/manage/Controlpanels/ContentTypes.test.jsx
+++ b/packages/volto/src/components/manage/Controlpanels/ContentTypes.test.jsx
@@ -1,5 +1,5 @@
import React from 'react';
-import renderer from 'react-test-renderer';
+import { render } from '@testing-library/react';
import configureStore from 'redux-mock-store';
import { Provider } from 'react-intl-redux';
import { MemoryRouter, Route } from 'react-router-dom';
@@ -8,9 +8,8 @@ import ContentTypes from './ContentTypes';
const mockStore = configureStore();
-jest.mock('react-portal', () => ({
- Portal: jest.fn(() =>
),
-}));
+jest.mock('../Toolbar/Toolbar', () => jest.fn(() =>
));
+
jest.mock('../Form/Form', () => jest.fn(() =>
));
describe('ContentTypes', () => {
@@ -60,14 +59,15 @@ describe('ContentTypes', () => {
messages: {},
},
});
- const component = renderer.create(
+ const { container } = render(
+
,
);
- const json = component.toJSON();
- expect(json).toMatchSnapshot();
+
+ expect(container).toMatchSnapshot();
});
});
diff --git a/packages/volto/src/components/manage/Controlpanels/Controlpanel.jsx b/packages/volto/src/components/manage/Controlpanels/Controlpanel.jsx
index a6fc83740f..a55477d787 100644
--- a/packages/volto/src/components/manage/Controlpanels/Controlpanel.jsx
+++ b/packages/volto/src/components/manage/Controlpanels/Controlpanel.jsx
@@ -9,7 +9,7 @@ import { connect } from 'react-redux';
import { compose } from 'redux';
import { withRouter } from 'react-router-dom';
import { Helmet } from '@plone/volto/helpers';
-import { Portal } from 'react-portal';
+import { createPortal } from 'react-dom';
import { Button, Container } from 'semantic-ui-react';
import { defineMessages, injectIntl } from 'react-intl';
import { toast } from 'react-toastify';
@@ -167,8 +167,8 @@ class Controlpanel extends Component {
loading={this.props.updateRequest.loading}
/>
- {this.state.isClient && (
-
+ {this.state.isClient &&
+ createPortal(
>
}
- />
-
- )}
+ />,
+ document.getElementById('toolbar'),
+ )}
);
}
diff --git a/packages/volto/src/components/manage/Controlpanels/Controlpanel.test.jsx b/packages/volto/src/components/manage/Controlpanels/Controlpanel.test.jsx
index d03d87e2d6..1ee6a98c11 100644
--- a/packages/volto/src/components/manage/Controlpanels/Controlpanel.test.jsx
+++ b/packages/volto/src/components/manage/Controlpanels/Controlpanel.test.jsx
@@ -1,5 +1,5 @@
import React from 'react';
-import renderer from 'react-test-renderer';
+import { render } from '@testing-library/react';
import configureStore from 'redux-mock-store';
import { Provider } from 'react-intl-redux';
import { MemoryRouter, Route } from 'react-router-dom';
@@ -8,9 +8,8 @@ import Controlpanel from './Controlpanel';
const mockStore = configureStore();
-jest.mock('react-portal', () => ({
- Portal: jest.fn(() =>
),
-}));
+jest.mock('../Toolbar/Toolbar', () => jest.fn(() =>
));
+
jest.mock('../Form/Form', () => jest.fn(() =>
));
describe('Controlpanel', () => {
@@ -36,14 +35,15 @@ describe('Controlpanel', () => {
messages: {},
},
});
- const component = renderer.create(
+ const { container } = render(
+
,
);
- const json = component.toJSON();
- expect(json).toMatchSnapshot();
+
+ expect(container).toMatchSnapshot();
});
});
diff --git a/packages/volto/src/components/manage/Controlpanels/Controlpanels.jsx b/packages/volto/src/components/manage/Controlpanels/Controlpanels.jsx
index 263be3b02f..d2751c0142 100644
--- a/packages/volto/src/components/manage/Controlpanels/Controlpanels.jsx
+++ b/packages/volto/src/components/manage/Controlpanels/Controlpanels.jsx
@@ -8,7 +8,7 @@ import { concat, filter, last, map, sortBy, uniqBy } from 'lodash';
import PropTypes from 'prop-types';
import { useEffect, useState } from 'react';
import { FormattedMessage, defineMessages, useIntl } from 'react-intl';
-import { Portal } from 'react-portal';
+import { createPortal } from 'react-dom';
import { connect } from 'react-redux';
import { Link } from 'react-router-dom';
import { compose } from 'redux';
@@ -260,8 +260,8 @@ function Controlpanels({
- {isClient && (
-
+ {isClient &&
+ createPortal(
}
- />
-
- )}
+ />,
+ document.getElementById('toolbar'),
+ )}
);
}
diff --git a/packages/volto/src/components/manage/Controlpanels/Controlpanels.test.jsx b/packages/volto/src/components/manage/Controlpanels/Controlpanels.test.jsx
index 23c9d83392..10ce403043 100644
--- a/packages/volto/src/components/manage/Controlpanels/Controlpanels.test.jsx
+++ b/packages/volto/src/components/manage/Controlpanels/Controlpanels.test.jsx
@@ -1,7 +1,7 @@
import React from 'react';
import { Provider } from 'react-intl-redux';
import { MemoryRouter } from 'react-router-dom';
-import renderer from 'react-test-renderer';
+import { render } from '@testing-library/react';
import configureStore from 'redux-mock-store';
import config from '@plone/volto/registry';
@@ -9,9 +9,7 @@ import Controlpanels from './Controlpanels';
const mockStore = configureStore();
-jest.mock('react-portal', () => ({
- Portal: jest.fn(() =>
),
-}));
+jest.mock('../Toolbar/Toolbar', () => jest.fn(() =>
));
jest.mock('./VersionOverview', () =>
jest.fn(() =>
),
@@ -73,15 +71,16 @@ describe('Controlpanels', () => {
messages: {},
},
});
- const component = renderer.create(
+ const { container } = render(
+
,
);
- const json = component.toJSON();
- expect(json).toMatchSnapshot();
+
+ expect(container).toMatchSnapshot();
});
it('renders an additional control panel', () => {
@@ -127,14 +126,15 @@ describe('Controlpanels', () => {
component: FooComponent,
},
];
- const component = renderer.create(
+ const { container } = render(
+
,
);
- const json = component.toJSON();
- expect(json).toMatchSnapshot();
+
+ expect(container).toMatchSnapshot();
});
});
diff --git a/packages/volto/src/components/manage/Controlpanels/DatabaseInformation.jsx b/packages/volto/src/components/manage/Controlpanels/DatabaseInformation.jsx
index ec17c9b8ce..04b29655ad 100644
--- a/packages/volto/src/components/manage/Controlpanels/DatabaseInformation.jsx
+++ b/packages/volto/src/components/manage/Controlpanels/DatabaseInformation.jsx
@@ -7,7 +7,7 @@ import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { compose } from 'redux';
import { Link } from 'react-router-dom';
-import { Portal } from 'react-portal';
+import { createPortal } from 'react-dom';
import { Container, Divider, Message, Segment, Table } from 'semantic-ui-react';
import { FormattedMessage, defineMessages, injectIntl } from 'react-intl';
@@ -216,8 +216,8 @@ class DatabaseInformation extends Component {
- {this.state.isClient && (
-
+ {this.state.isClient &&
+ createPortal(
>
}
- />
-
- )}
+ />,
+ document.getElementById('toolbar'),
+ )}
) : null;
}
diff --git a/packages/volto/src/components/manage/Controlpanels/Groups/GroupsControlpanel.jsx b/packages/volto/src/components/manage/Controlpanels/Groups/GroupsControlpanel.jsx
index 95505c9030..42bffa4768 100644
--- a/packages/volto/src/components/manage/Controlpanels/Groups/GroupsControlpanel.jsx
+++ b/packages/volto/src/components/manage/Controlpanels/Groups/GroupsControlpanel.jsx
@@ -30,7 +30,7 @@ import { find, map, pull } from 'lodash';
import PropTypes from 'prop-types';
import React, { Component } from 'react';
import { FormattedMessage, injectIntl } from 'react-intl';
-import { Portal } from 'react-portal';
+import { createPortal } from 'react-dom';
import { connect } from 'react-redux';
import { toast } from 'react-toastify';
@@ -575,8 +575,8 @@ class GroupsControlpanel extends Component {
- {this.state.isClient && (
-
+ {this.state.isClient &&
+ createPortal(
>
}
- />
-
- )}
+ />,
+ document.getElementById('toolbar'),
+ )}
);
}
diff --git a/packages/volto/src/components/manage/Controlpanels/Groups/GroupsControlpanel.test.jsx b/packages/volto/src/components/manage/Controlpanels/Groups/GroupsControlpanel.test.jsx
index f6bf548d90..561aab0507 100644
--- a/packages/volto/src/components/manage/Controlpanels/Groups/GroupsControlpanel.test.jsx
+++ b/packages/volto/src/components/manage/Controlpanels/Groups/GroupsControlpanel.test.jsx
@@ -1,14 +1,13 @@
import React from 'react';
-import renderer from 'react-test-renderer';
+import { render } from '@testing-library/react';
import configureStore from 'redux-mock-store';
import { Provider } from 'react-intl-redux';
import GroupsControlpanel from './GroupsControlpanel';
const mockStore = configureStore();
-jest.mock('react-portal', () => ({
- Portal: jest.fn(() =>
),
-}));
+jest.mock('../../Toolbar/Toolbar', () => jest.fn(() =>
));
+
describe('UsersControlpanel', () => {
it('renders a user control component', () => {
const store = mockStore({
@@ -25,12 +24,13 @@ describe('UsersControlpanel', () => {
messages: {},
},
});
- const component = renderer.create(
+ const { container } = render(
+
,
);
- const json = component.toJSON();
- expect(json).toMatchSnapshot();
+
+ expect(container).toMatchSnapshot();
});
});
diff --git a/packages/volto/src/components/manage/Controlpanels/Groups/__snapshots__/GroupsControlpanel.test.jsx.snap b/packages/volto/src/components/manage/Controlpanels/Groups/__snapshots__/GroupsControlpanel.test.jsx.snap
index 6a7e41b64b..36ba594690 100644
--- a/packages/volto/src/components/manage/Controlpanels/Groups/__snapshots__/GroupsControlpanel.test.jsx.snap
+++ b/packages/volto/src/components/manage/Controlpanels/Groups/__snapshots__/GroupsControlpanel.test.jsx.snap
@@ -1,128 +1,121 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`UsersControlpanel renders a user control component 1`] = `
-
+
-
- Groups
-
-
- Groups are logical collections of users, such as departments and business units. Groups are not directly related to permissions on a global level, you normally use Roles for that - and let certain Groups have a particular role. The symbol
- plone-svgundefined",
- }
- }
- onClick={null}
- style={
- Object {
- "fill": "#007EB1",
- "height": "20px",
- "width": "auto",
- }
- }
- viewBox=""
- xmlns=""
- />
- indicates a role inherited from membership in another group.
-
+ class="container"
+ />
-
-
+
+ Groups are logical collections of users, such as departments and business units. Groups are not directly related to permissions on a global level, you normally use Roles for that - and let certain Groups have a particular role. The symbol
+
+
+ plone-svg
+
+ undefined
+
+ indicates a role inherited from membership in another group.
+
+
-
-
-
-
-
+
+
-
-
-
-
- Groupname
-
-
- Actions
-
-
-
-
-
-
-
-
+
+ Groupname
+
+
+ Actions
+
+
+
+
+
+
-
-
+
+
+ id="toolbar"
+ >
+
+
`;
diff --git a/packages/volto/src/components/manage/Controlpanels/ModerateComments.jsx b/packages/volto/src/components/manage/Controlpanels/ModerateComments.jsx
index 182ce40ae0..d5036a50d2 100644
--- a/packages/volto/src/components/manage/Controlpanels/ModerateComments.jsx
+++ b/packages/volto/src/components/manage/Controlpanels/ModerateComments.jsx
@@ -9,7 +9,7 @@ import { connect } from 'react-redux';
import { compose } from 'redux';
import { Link } from 'react-router-dom';
import { getParentUrl, Helmet } from '@plone/volto/helpers';
-import { Portal } from 'react-portal';
+import { createPortal } from 'react-dom';
import { Container, Button, Table } from 'semantic-ui-react';
import { FormattedMessage, defineMessages, injectIntl } from 'react-intl';
@@ -267,8 +267,8 @@ class ModerateComments extends Component {
- {this.state.isClient && (
-
+ {this.state.isClient &&
+ createPortal(
}
- />
-
- )}
+ />,
+ document.getElementById('toolbar'),
+ )}
);
}
diff --git a/packages/volto/src/components/manage/Controlpanels/ModerateComments.test.jsx b/packages/volto/src/components/manage/Controlpanels/ModerateComments.test.jsx
index ff5f785dcd..d5c79af439 100644
--- a/packages/volto/src/components/manage/Controlpanels/ModerateComments.test.jsx
+++ b/packages/volto/src/components/manage/Controlpanels/ModerateComments.test.jsx
@@ -1,5 +1,5 @@
import React from 'react';
-import renderer from 'react-test-renderer';
+import { render } from '@testing-library/react';
import configureStore from 'redux-mock-store';
import { Provider } from 'react-intl-redux';
@@ -7,9 +7,8 @@ import ModerateComments from './ModerateComments';
const mockStore = configureStore();
-jest.mock('react-portal', () => ({
- Portal: jest.fn(() =>
),
-}));
+jest.mock('../Toolbar/Toolbar', () => jest.fn(() =>
));
+
jest.mock('../../theme/Comments/CommentEditModal', () =>
jest.fn(() =>
),
);
@@ -31,12 +30,13 @@ describe('ModerateComments', () => {
messages: {},
},
});
- const component = renderer.create(
+ const { container } = render(
+
,
);
- const json = component.toJSON();
- expect(json).toMatchSnapshot();
+
+ expect(container).toMatchSnapshot();
});
});
diff --git a/packages/volto/src/components/manage/Controlpanels/Relations/Relations.jsx b/packages/volto/src/components/manage/Controlpanels/Relations/Relations.jsx
index f71caa058d..73c56efa41 100644
--- a/packages/volto/src/components/manage/Controlpanels/Relations/Relations.jsx
+++ b/packages/volto/src/components/manage/Controlpanels/Relations/Relations.jsx
@@ -1,10 +1,10 @@
/**
* Relations Control Panel
*/
-import React, { useEffect } from 'react';
+import React, { useEffect, useState } from 'react';
import { find } from 'lodash';
import { useSelector } from 'react-redux';
-import { Portal } from 'react-portal';
+import { createPortal } from 'react-dom';
import { useHistory } from 'react-router';
import { Link, useLocation } from 'react-router-dom';
import { FormattedMessage, useIntl } from 'react-intl';
@@ -23,6 +23,12 @@ const RelationsControlPanel = () => {
const location = useLocation();
const dispatch = useDispatch();
+ const [isClient, setIsClient] = useState(false);
+
+ useEffect(() => {
+ setIsClient(true);
+ }, []);
+
const brokenRelations = useSelector(
(state) => state.relations?.stats?.data?.broken,
);
@@ -88,8 +94,8 @@ const RelationsControlPanel = () => {
)}
- {__CLIENT__ && (
-
+ {isClient &&
+ createPortal(
{
}
- />
-
- )}
+ />,
+ document.getElementById('toolbar'),
+ )}
>
);
};
diff --git a/packages/volto/src/components/manage/Controlpanels/Rules/AddRule.jsx b/packages/volto/src/components/manage/Controlpanels/Rules/AddRule.jsx
index 31df68dbc0..85aba340be 100644
--- a/packages/volto/src/components/manage/Controlpanels/Rules/AddRule.jsx
+++ b/packages/volto/src/components/manage/Controlpanels/Rules/AddRule.jsx
@@ -9,7 +9,7 @@ import { connect } from 'react-redux';
import { compose } from 'redux';
import { Link } from 'react-router-dom';
import { getBaseUrl, getParentUrl, Helmet } from '@plone/volto/helpers';
-import { Portal } from 'react-portal';
+import { createPortal } from 'react-dom';
import {
Button,
Checkbox,
@@ -331,8 +331,8 @@ class AddRule extends Component {
- {this.state.isClient && (
-
+ {this.state.isClient &&
+ createPortal(
}
- />
-
- )}
+ />,
+ document.getElementById('toolbar'),
+ )}
);
}
diff --git a/packages/volto/src/components/manage/Controlpanels/Rules/AddRule.test.jsx b/packages/volto/src/components/manage/Controlpanels/Rules/AddRule.test.jsx
index 982d8798f6..5f83ebaef8 100644
--- a/packages/volto/src/components/manage/Controlpanels/Rules/AddRule.test.jsx
+++ b/packages/volto/src/components/manage/Controlpanels/Rules/AddRule.test.jsx
@@ -1,5 +1,5 @@
import React from 'react';
-import renderer from 'react-test-renderer';
+import { render } from '@testing-library/react';
import { Provider } from 'react-intl-redux';
import configureMockStore from 'redux-mock-store';
import thunk from 'redux-thunk';
@@ -9,9 +9,7 @@ import AddRule from './AddRule';
const middlewares = [thunk];
const mockStore = configureMockStore(middlewares);
-jest.mock('react-portal', () => ({
- Portal: jest.fn(() =>
),
-}));
+jest.mock('../../Toolbar/Toolbar', () => jest.fn(() =>
));
describe('AddRule', () => {
it('renders rules add interface', () => {
@@ -21,12 +19,13 @@ describe('AddRule', () => {
messages: {},
},
});
- const component = renderer.create(
+ const { container } = render(
+
,
);
- const json = component.toJSON();
- expect(json).toMatchSnapshot();
+
+ expect(container).toMatchSnapshot();
});
});
diff --git a/packages/volto/src/components/manage/Controlpanels/Rules/ConfigureRule.jsx b/packages/volto/src/components/manage/Controlpanels/Rules/ConfigureRule.jsx
index 4f92673898..65887da7f3 100644
--- a/packages/volto/src/components/manage/Controlpanels/Rules/ConfigureRule.jsx
+++ b/packages/volto/src/components/manage/Controlpanels/Rules/ConfigureRule.jsx
@@ -9,7 +9,7 @@ import { connect } from 'react-redux';
import { compose } from 'redux';
import { Link } from 'react-router-dom';
import { getBaseUrl, getParentUrl, Helmet } from '@plone/volto/helpers';
-import { Portal } from 'react-portal';
+import { createPortal } from 'react-dom';
import {
Button,
Card,
@@ -847,8 +847,8 @@ class ConfigureRule extends Component {
action="edit"
/>
)}
- {this.state.isClient && (
-
+ {this.state.isClient &&
+ createPortal(
}
- />
-
- )}
+ />,
+ document.getElementById('toolbar'),
+ )}
);
}
diff --git a/packages/volto/src/components/manage/Controlpanels/Rules/ConfigureRule.test.jsx b/packages/volto/src/components/manage/Controlpanels/Rules/ConfigureRule.test.jsx
index ed9babcd14..9516fcc64b 100644
--- a/packages/volto/src/components/manage/Controlpanels/Rules/ConfigureRule.test.jsx
+++ b/packages/volto/src/components/manage/Controlpanels/Rules/ConfigureRule.test.jsx
@@ -1,5 +1,5 @@
import React from 'react';
-import renderer from 'react-test-renderer';
+import { render } from '@testing-library/react';
import { Provider } from 'react-intl-redux';
import configureMockStore from 'redux-mock-store';
import thunk from 'redux-thunk';
@@ -9,9 +9,7 @@ import ConfigureRule from './ConfigureRule';
const middlewares = [thunk];
const mockStore = configureMockStore(middlewares);
-jest.mock('react-portal', () => ({
- Portal: jest.fn(() =>
),
-}));
+jest.mock('../../Toolbar/Toolbar', () => jest.fn(() =>
));
describe('ConfigureRule', () => {
it('renders rules configure interface', () => {
@@ -21,14 +19,15 @@ describe('ConfigureRule', () => {
messages: {},
},
});
- const component = renderer.create(
+ const { container } = render(
+
,
);
- const json = component.toJSON();
- expect(json).toMatchSnapshot();
+
+ expect(container).toMatchSnapshot();
});
});
diff --git a/packages/volto/src/components/manage/Controlpanels/Rules/EditRule.jsx b/packages/volto/src/components/manage/Controlpanels/Rules/EditRule.jsx
index 025e53993d..b8cd8a9124 100644
--- a/packages/volto/src/components/manage/Controlpanels/Rules/EditRule.jsx
+++ b/packages/volto/src/components/manage/Controlpanels/Rules/EditRule.jsx
@@ -9,7 +9,7 @@ import { connect } from 'react-redux';
import { compose } from 'redux';
import { Link } from 'react-router-dom';
import { getParentUrl, Helmet, getBaseUrl } from '@plone/volto/helpers';
-import { Portal } from 'react-portal';
+import { createPortal } from 'react-dom';
import {
Button,
Checkbox,
@@ -367,8 +367,8 @@ class EditRule extends Component {
- {this.state.isClient && (
-
+ {this.state.isClient &&
+ createPortal(
}
- />
-
- )}
+ />,
+ document.getElementById('toolbar'),
+ )}
);
}
diff --git a/packages/volto/src/components/manage/Controlpanels/Rules/EditRule.test.jsx b/packages/volto/src/components/manage/Controlpanels/Rules/EditRule.test.jsx
index b62949c0bc..100aa9a64b 100644
--- a/packages/volto/src/components/manage/Controlpanels/Rules/EditRule.test.jsx
+++ b/packages/volto/src/components/manage/Controlpanels/Rules/EditRule.test.jsx
@@ -1,5 +1,5 @@
import React from 'react';
-import renderer from 'react-test-renderer';
+import { render } from '@testing-library/react';
import { Provider } from 'react-intl-redux';
import configureMockStore from 'redux-mock-store';
import thunk from 'redux-thunk';
@@ -9,9 +9,7 @@ import EditRule from './EditRule';
const middlewares = [thunk];
const mockStore = configureMockStore(middlewares);
-jest.mock('react-portal', () => ({
- Portal: jest.fn(() =>
),
-}));
+jest.mock('../../Toolbar/Toolbar', () => jest.fn(() =>
));
describe('EditRule', () => {
it('renders rules edit interface', () => {
@@ -21,12 +19,13 @@ describe('EditRule', () => {
messages: {},
},
});
- const component = renderer.create(
+ const { container } = render(
+
,
);
- const json = component.toJSON();
- expect(json).toMatchSnapshot();
+
+ expect(container).toMatchSnapshot();
});
});
diff --git a/packages/volto/src/components/manage/Controlpanels/Rules/Rules.jsx b/packages/volto/src/components/manage/Controlpanels/Rules/Rules.jsx
index f8060a4ca1..0f3545d919 100644
--- a/packages/volto/src/components/manage/Controlpanels/Rules/Rules.jsx
+++ b/packages/volto/src/components/manage/Controlpanels/Rules/Rules.jsx
@@ -9,7 +9,7 @@ import { connect } from 'react-redux';
import { compose } from 'redux';
import { Link } from 'react-router-dom';
import { getBaseUrl, getParentUrl, Helmet } from '@plone/volto/helpers';
-import { Portal } from 'react-portal';
+import { createPortal } from 'react-dom';
import {
Button,
Checkbox,
@@ -420,8 +420,8 @@ class Rules extends Component {
- {this.state.isClient && (
-
+ {this.state.isClient &&
+ createPortal(
}
- />
-
- )}
+ />,
+ document.getElementById('toolbar'),
+ )}
);
}
diff --git a/packages/volto/src/components/manage/Controlpanels/Rules/Rules.test.jsx b/packages/volto/src/components/manage/Controlpanels/Rules/Rules.test.jsx
index fe86ede91e..2a2813b7c6 100644
--- a/packages/volto/src/components/manage/Controlpanels/Rules/Rules.test.jsx
+++ b/packages/volto/src/components/manage/Controlpanels/Rules/Rules.test.jsx
@@ -1,5 +1,5 @@
import React from 'react';
-import renderer from 'react-test-renderer';
+import { render } from '@testing-library/react';
import { Provider } from 'react-intl-redux';
import configureMockStore from 'redux-mock-store';
import thunk from 'redux-thunk';
@@ -9,9 +9,7 @@ import Rules from './Rules';
const middlewares = [thunk];
const mockStore = configureMockStore(middlewares);
-jest.mock('react-portal', () => ({
- Portal: jest.fn(() =>
),
-}));
+jest.mock('../../Toolbar/Toolbar', () => jest.fn(() =>
));
describe('Rules', () => {
it('renders rules control panel control', () => {
@@ -64,12 +62,13 @@ describe('Rules', () => {
messages: {},
},
});
- const component = renderer.create(
+ const { container } = render(
+
,
);
- const json = component.toJSON();
- expect(json).toMatchSnapshot();
+
+ expect(container).toMatchSnapshot();
});
});
diff --git a/packages/volto/src/components/manage/Controlpanels/Rules/__snapshots__/AddRule.test.jsx.snap b/packages/volto/src/components/manage/Controlpanels/Rules/__snapshots__/AddRule.test.jsx.snap
index be2bd126a8..b85d427f10 100644
--- a/packages/volto/src/components/manage/Controlpanels/Rules/__snapshots__/AddRule.test.jsx.snap
+++ b/packages/volto/src/components/manage/Controlpanels/Rules/__snapshots__/AddRule.test.jsx.snap
@@ -1,242 +1,197 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`AddRule renders rules add interface 1`] = `
-
+
-
-
- Add Rule
-
-
- Use the form below to define the new content rule
-
-
-
-
+
+ Use the form below to define the new content rule
+
+
+
- Title
- -
- Please set a descriptive title for the rule.
+
+ Title
+ -
+ Please set a descriptive title for the rule.
+
-
-
- Description
- -
- Enter a short description of the rule and its purpose.
+
+ Description
+ -
+ Enter a short description of the rule and its purpose.
+
-
-
- Triggering event
- -
- The rule will execute when the following event occurs.
+
+ Triggering event
+ -
+ The rule will execute when the following event occurs.
+
-
-
-
-
+
+
-
-
- Enabled
-
+
+
+
+ Enabled
+
+
+
+ Whether or not the rule is currently enabled
+
-
- Whether or not the rule is currently enabled
-
-
-
-
-
- Stop Executing rules
-
+
+
+
+ Stop Executing rules
+
+
+
+ Whether or not execution of further rules should stop after this rule is executed
+
-
- Whether or not execution of further rules should stop after this rule is executed
-
-
-
-
-
- Cascading rule
-
+
+
+
+ Cascading rule
+
+
+
+ Whether or not other rules should be triggered by the actions launched by this rule. Activate this only if you are sure this won't create infinite loops
+
-
- Whether or not other rules should be triggered by the actions launched by this rule. Activate this only if you are sure this won't create infinite loops
-
-
-
-
- Save
-
-
- Cancel
-
+
+ Save
+
+
+ Cancel
+
+
+
-
-
-
+
+
+ id="toolbar"
+ >
+
+
`;
diff --git a/packages/volto/src/components/manage/Controlpanels/Rules/__snapshots__/ConfigureRule.test.jsx.snap b/packages/volto/src/components/manage/Controlpanels/Rules/__snapshots__/ConfigureRule.test.jsx.snap
index f2a98c51aa..25bbc75cdb 100644
--- a/packages/volto/src/components/manage/Controlpanels/Rules/__snapshots__/ConfigureRule.test.jsx.snap
+++ b/packages/volto/src/components/manage/Controlpanels/Rules/__snapshots__/ConfigureRule.test.jsx.snap
@@ -1,184 +1,152 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`ConfigureRule renders rules configure interface 1`] = `
-
+
-
-
- Configure Content Rule:
-
-
-
-
-
- Rules execute when a triggering event occurs. Rule actions will only be invoked if all the rule's conditions are met. You can add new actions and conditions using the buttons below.
-
-
+ Configure Content Rule:
+
+
+
+ Rules execute when a triggering event occurs. Rule actions will only be invoked if all the rule's conditions are met. You can add new actions and conditions using the buttons below.
+
+
-
- If all of the following conditions are met:
-
-
- Condition:
+
+ If all of the following conditions are met:
+
+ Condition:
+
- Select condition
+
+ Select condition
+
+
+
-
-
+
+ Add
+
-
- Add
-
-
-
-
- Perform the following actions:
-
-
- Action:
+
+ Perform the following actions:
+
+ Action:
+
- Select action
+
+ Select action
+
+
+
-
-
+
+ Add
+
-
- Add
-
-
-
-
- Assignments
-
- This rule is assigned to the following locations:
+
+
+ Assignments
+
+ This rule is assigned to the following locations:
+
-
-
+
+
-
-
-
-
+ id="toolbar"
+ >
+
+
`;
diff --git a/packages/volto/src/components/manage/Controlpanels/Rules/__snapshots__/EditRule.test.jsx.snap b/packages/volto/src/components/manage/Controlpanels/Rules/__snapshots__/EditRule.test.jsx.snap
index 4920f93180..931b391418 100644
--- a/packages/volto/src/components/manage/Controlpanels/Rules/__snapshots__/EditRule.test.jsx.snap
+++ b/packages/volto/src/components/manage/Controlpanels/Rules/__snapshots__/EditRule.test.jsx.snap
@@ -1,242 +1,197 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`EditRule renders rules edit interface 1`] = `
-
+
-
-
- Edit Rule
-
-
- Use the form below to define the new content rule
-
-
-
-
+
+ Use the form below to define the new content rule
+
+
+
- Title
- -
- Please set a descriptive title for the rule.
+
+ Title
+ -
+ Please set a descriptive title for the rule.
+
-
-
- Description
- -
- Enter a short description of the rule and its purpose.
+
+ Description
+ -
+ Enter a short description of the rule and its purpose.
+
-
-
- Triggering event
- -
- The rule will execute when the following event occurs.
+
+ Triggering event
+ -
+ The rule will execute when the following event occurs.
+
-
-
-
-
+
+
-
-
- Enabled
-
+
+
+
+ Enabled
+
+
+
+ Whether or not the rule is currently enabled
+
-
- Whether or not the rule is currently enabled
-
-
-
-
-
- Stop Executing rules
-
+
+
+
+ Stop Executing rules
+
+
+
+ Whether or not execution of further rules should stop after this rule is executed
+
-
- Whether or not execution of further rules should stop after this rule is executed
-
-
-
-
-
- Cascading rule
-
+
+
+
+ Cascading rule
+
+
+
+ Whether or not other rules should be triggered by the actions launched by this rule. Activate this only if you are sure this won't create infinite loops
+
-
- Whether or not other rules should be triggered by the actions launched by this rule. Activate this only if you are sure this won't create infinite loops
-
-
-
-
- Save
-
-
- Cancel
-
+
+ Save
+
+
+ Cancel
+
+
+
-
-
-
+
+
+ id="toolbar"
+ >
+
+
`;
diff --git a/packages/volto/src/components/manage/Controlpanels/Rules/__snapshots__/Rules.test.jsx.snap b/packages/volto/src/components/manage/Controlpanels/Rules/__snapshots__/Rules.test.jsx.snap
index 6badfd410f..dbdbfaefb5 100644
--- a/packages/volto/src/components/manage/Controlpanels/Rules/__snapshots__/Rules.test.jsx.snap
+++ b/packages/volto/src/components/manage/Controlpanels/Rules/__snapshots__/Rules.test.jsx.snap
@@ -1,93 +1,92 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Rules renders rules control panel control 1`] = `
-
+
-
-
- Content Rules
-
-
- Use the form below to define, change or remove content rules. Rules will automatically perform actions on content when certain triggers take place. After defining rules, you may want to go to a folder to assign them, using the 'rules' item in the actions menu.
-
-
- Filter Rules:
+ Content Rules
-
-
-
-
+
+ Add content rule
+
+
-
-
+
+
+ id="toolbar"
+ >
+
+
`;
diff --git a/packages/volto/src/components/manage/Controlpanels/Rules/components/VariableModal.test.jsx b/packages/volto/src/components/manage/Controlpanels/Rules/components/VariableModal.test.jsx.removed
similarity index 71%
rename from packages/volto/src/components/manage/Controlpanels/Rules/components/VariableModal.test.jsx
rename to packages/volto/src/components/manage/Controlpanels/Rules/components/VariableModal.test.jsx.removed
index 4d6bb73ab2..3d7220e637 100644
--- a/packages/volto/src/components/manage/Controlpanels/Rules/components/VariableModal.test.jsx
+++ b/packages/volto/src/components/manage/Controlpanels/Rules/components/VariableModal.test.jsx.removed
@@ -1,5 +1,5 @@
import React from 'react';
-import renderer from 'react-test-renderer';
+import { render } from '@testing-library/react';
import { Provider } from 'react-intl-redux';
import configureMockStore from 'redux-mock-store';
import thunk from 'redux-thunk';
@@ -9,9 +9,8 @@ import VariableModal from './VariableModal';
const middlewares = [thunk];
const mockStore = configureMockStore(middlewares);
-jest.mock('react-portal', () => ({
- Portal: jest.fn(() =>
),
-}));
+jest.mock('../Toolbar/Toolbar', () => jest.fn(() =>
));
+
describe('VariableModal', () => {
it('renders rules add interface', () => {
@@ -21,12 +20,12 @@ describe('VariableModal', () => {
messages: {},
},
});
- const component = renderer.create(
+ const { container } = render(
,
);
- const json = component.toJSON();
- expect(json).toMatchSnapshot();
+
+ expect(container).toMatchSnapshot();
});
});
diff --git a/packages/volto/src/components/manage/Controlpanels/Rules/components/__snapshots__/VariableModal.test.jsx.snap b/packages/volto/src/components/manage/Controlpanels/Rules/components/__snapshots__/VariableModal.test.jsx.snap
deleted file mode 100644
index 45338eec4d..0000000000
--- a/packages/volto/src/components/manage/Controlpanels/Rules/components/__snapshots__/VariableModal.test.jsx.snap
+++ /dev/null
@@ -1,8 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`VariableModal renders rules add interface 1`] = `
-
-
-
-
-`;
diff --git a/packages/volto/src/components/manage/Controlpanels/UndoControlpanel.jsx b/packages/volto/src/components/manage/Controlpanels/UndoControlpanel.jsx
index 62bbef85e3..3b95e2dd4a 100644
--- a/packages/volto/src/components/manage/Controlpanels/UndoControlpanel.jsx
+++ b/packages/volto/src/components/manage/Controlpanels/UndoControlpanel.jsx
@@ -7,7 +7,7 @@ import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { compose } from 'redux';
import { Link } from 'react-router-dom';
-import { Portal } from 'react-portal';
+import { createPortal } from 'react-dom';
import { Container, Segment, Table, Menu, Input } from 'semantic-ui-react';
import { FormattedMessage, defineMessages, injectIntl } from 'react-intl';
import { Icon, Toolbar, Form, Toast } from '@plone/volto/components';
@@ -702,8 +702,8 @@ class UndoControlpanel extends Component {
)}
- {this.state.isClient && (
-
+ {this.state.isClient &&
+ createPortal(
>
}
- />
-
- )}
+ />,
+ document.getElementById('toolbar'),
+ )}
);
}
diff --git a/packages/volto/src/components/manage/Controlpanels/UndoControlpanel.test.jsx b/packages/volto/src/components/manage/Controlpanels/UndoControlpanel.test.jsx
index 61d65fcc2c..ba7261c78e 100644
--- a/packages/volto/src/components/manage/Controlpanels/UndoControlpanel.test.jsx
+++ b/packages/volto/src/components/manage/Controlpanels/UndoControlpanel.test.jsx
@@ -1,5 +1,5 @@
import React from 'react';
-import renderer from 'react-test-renderer';
+import { render } from '@testing-library/react';
import configureStore from 'redux-mock-store';
import { Provider } from 'react-intl-redux';
@@ -7,9 +7,8 @@ import UndoControlpanel from './UndoControlpanel';
const mockStore = configureStore();
-jest.mock('react-portal', () => ({
- Portal: jest.fn(() =>
),
-}));
+jest.mock('../Toolbar/Toolbar', () => jest.fn(() =>
));
+
jest.mock('../Form/Form', () => jest.fn(() =>
));
describe('UndoControlpanel', () => {
@@ -84,12 +83,13 @@ describe('UndoControlpanel', () => {
messages: {},
},
});
- const component = renderer.create(
+ const { container } = render(
+
,
);
- const json = component.toJSON();
- expect(json).toMatchSnapshot();
+
+ expect(container).toMatchSnapshot();
});
});
diff --git a/packages/volto/src/components/manage/Controlpanels/UpgradeControlPanel.jsx b/packages/volto/src/components/manage/Controlpanels/UpgradeControlPanel.jsx
index b415db3597..fe1efd6c55 100644
--- a/packages/volto/src/components/manage/Controlpanels/UpgradeControlPanel.jsx
+++ b/packages/volto/src/components/manage/Controlpanels/UpgradeControlPanel.jsx
@@ -7,7 +7,7 @@ import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { compose } from 'redux';
import { Link } from 'react-router-dom';
-import { Portal } from 'react-portal';
+import { createPortal } from 'react-dom';
import {
Button,
Container,
@@ -311,8 +311,8 @@ class UpgradeControlPanel extends Component {
) : null}
- {this.state.isClient && (
-
+ {this.state.isClient &&
+ createPortal(
>
}
- />
-
- )}
+ />,
+ document.getElementById('toolbar'),
+ )}
) : null;
}
diff --git a/packages/volto/src/components/manage/Controlpanels/Users/UserGroupMembershipControlPanel.jsx b/packages/volto/src/components/manage/Controlpanels/Users/UserGroupMembershipControlPanel.jsx
index 6195610e7f..0acb553959 100644
--- a/packages/volto/src/components/manage/Controlpanels/Users/UserGroupMembershipControlPanel.jsx
+++ b/packages/volto/src/components/manage/Controlpanels/Users/UserGroupMembershipControlPanel.jsx
@@ -2,9 +2,9 @@
* User Control Panel [user group membership management]
* TODO Enrich with features of user control panel. Then replace user control panel.
*/
-import React, { useEffect } from 'react';
+import React, { useEffect, useState } from 'react';
import { find } from 'lodash';
-import { Portal } from 'react-portal';
+import { createPortal } from 'react-dom';
import { useHistory } from 'react-router';
import { Link, useLocation } from 'react-router-dom';
import { FormattedMessage, useIntl } from 'react-intl';
@@ -45,6 +45,12 @@ const UserGroupMembershipPanel = () => {
id: 'plone_setup',
});
+ const [isClient, setIsClient] = useState(false);
+
+ useEffect(() => {
+ setIsClient(true);
+ }, []);
+
useEffect(() => {
dispatch(listActions('/'));
}, [dispatch]);
@@ -57,7 +63,7 @@ const UserGroupMembershipPanel = () => {
dispatch(getSystemInformation());
}, [dispatch]);
- if (__CLIENT__ && !ploneSetupAction) {
+ if (isClient && !ploneSetupAction) {
return ;
}
@@ -108,8 +114,8 @@ const UserGroupMembershipPanel = () => {
- {__CLIENT__ && (
-
+ {isClient &&
+ createPortal(
{
>
}
- />
-
- )}
+ />,
+ document.getElementById('toolbar'),
+ )}
>
);
};
diff --git a/packages/volto/src/components/manage/Controlpanels/Users/UserGroupMembershipControlPanel.test.jsx b/packages/volto/src/components/manage/Controlpanels/Users/UserGroupMembershipControlPanel.test.jsx
index 2d9a74030d..26343e85fb 100644
--- a/packages/volto/src/components/manage/Controlpanels/Users/UserGroupMembershipControlPanel.test.jsx
+++ b/packages/volto/src/components/manage/Controlpanels/Users/UserGroupMembershipControlPanel.test.jsx
@@ -1,5 +1,5 @@
import React from 'react';
-import renderer from 'react-test-renderer';
+import { render } from '@testing-library/react';
import configureStore from 'redux-mock-store';
import { Provider } from 'react-intl-redux';
import { MemoryRouter } from 'react-router-dom';
@@ -7,9 +7,8 @@ import { MemoryRouter } from 'react-router-dom';
import UserGroupMembershipControlPanel from './UserGroupMembershipControlPanel';
const mockStore = configureStore();
-jest.mock('react-portal', () => ({
- Portal: jest.fn(() =>
),
-}));
+jest.mock('../../Toolbar/Toolbar', () => jest.fn(() =>
));
+
describe('UserGroupMembershipControlPanel', () => {
it('renders a user group membership control component', () => {
const store = mockStore({
@@ -49,14 +48,15 @@ describe('UserGroupMembershipControlPanel', () => {
messages: {},
},
});
- const component = renderer.create(
+ const { container } = render(
+
,
);
- const json = component.toJSON();
- expect(json).toMatchSnapshot();
+
+ expect(container).toMatchSnapshot();
});
});
diff --git a/packages/volto/src/components/manage/Controlpanels/Users/UsersControlpanel.jsx b/packages/volto/src/components/manage/Controlpanels/Users/UsersControlpanel.jsx
index a8f8e6687b..f76fba2b80 100644
--- a/packages/volto/src/components/manage/Controlpanels/Users/UsersControlpanel.jsx
+++ b/packages/volto/src/components/manage/Controlpanels/Users/UsersControlpanel.jsx
@@ -32,7 +32,7 @@ import { find, map, pull, difference } from 'lodash';
import PropTypes from 'prop-types';
import React, { Component } from 'react';
import { FormattedMessage, injectIntl } from 'react-intl';
-import { Portal } from 'react-portal';
+import { createPortal } from 'react-dom';
import { connect } from 'react-redux';
import { toast } from 'react-toastify';
import { bindActionCreators, compose } from 'redux';
@@ -619,8 +619,8 @@ class UsersControlpanel extends Component {
- {this.state.isClient && (
-
+ {this.state.isClient &&
+ createPortal(
>
}
- />
-
- )}
+ />,
+ document.getElementById('toolbar'),
+ )}
);
}
diff --git a/packages/volto/src/components/manage/Controlpanels/Users/UsersControlpanel.test.jsx b/packages/volto/src/components/manage/Controlpanels/Users/UsersControlpanel.test.jsx
index 49286f9c15..eca583e177 100644
--- a/packages/volto/src/components/manage/Controlpanels/Users/UsersControlpanel.test.jsx
+++ b/packages/volto/src/components/manage/Controlpanels/Users/UsersControlpanel.test.jsx
@@ -1,14 +1,13 @@
import React from 'react';
-import renderer from 'react-test-renderer';
+import { render } from '@testing-library/react';
import configureStore from 'redux-mock-store';
import { Provider } from 'react-intl-redux';
import UsersControlpanel from './UsersControlpanel';
const mockStore = configureStore();
-jest.mock('react-portal', () => ({
- Portal: jest.fn(() =>
),
-}));
+jest.mock('../../Toolbar/Toolbar', () => jest.fn(() =>
));
+
describe('UsersControlpanel', () => {
it('renders a user control component', () => {
const store = mockStore({
@@ -29,12 +28,13 @@ describe('UsersControlpanel', () => {
messages: {},
},
});
- const component = renderer.create(
+ const { container } = render(
+
,
);
- const json = component.toJSON();
- expect(json).toMatchSnapshot();
+
+ expect(container).toMatchSnapshot();
});
});
diff --git a/packages/volto/src/components/manage/Controlpanels/Users/__snapshots__/UserGroupMembershipControlPanel.test.jsx.snap b/packages/volto/src/components/manage/Controlpanels/Users/__snapshots__/UserGroupMembershipControlPanel.test.jsx.snap
index 383fc4159d..3da50c6b65 100644
--- a/packages/volto/src/components/manage/Controlpanels/Users/__snapshots__/UserGroupMembershipControlPanel.test.jsx.snap
+++ b/packages/volto/src/components/manage/Controlpanels/Users/__snapshots__/UserGroupMembershipControlPanel.test.jsx.snap
@@ -1,37 +1,40 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`UserGroupMembershipControlPanel renders a user group membership control component 1`] = `
-
-
- Unauthorized
-
-
-
+
- You are trying to access a protected resource, please
-
+ Unauthorized
+
+
+
- log in
-
- first.
-
-
- If you are certain you have the correct web address but are encountering an error, please contact the
-
- Site Administration
-
- .
-
-
- Thank you.
-
+ You are trying to access a protected resource, please
+
+ log in
+
+ first.
+
+
+ If you are certain you have the correct web address but are encountering an error, please contact the
+
+ Site Administration
+
+ .
+
+
+ Thank you.
+
+
+
`;
diff --git a/packages/volto/src/components/manage/Controlpanels/Users/__snapshots__/UsersControlpanel.test.jsx.snap b/packages/volto/src/components/manage/Controlpanels/Users/__snapshots__/UsersControlpanel.test.jsx.snap
index 5e68f9ca78..3e42328f02 100644
--- a/packages/volto/src/components/manage/Controlpanels/Users/__snapshots__/UsersControlpanel.test.jsx.snap
+++ b/packages/volto/src/components/manage/Controlpanels/Users/__snapshots__/UsersControlpanel.test.jsx.snap
@@ -1,124 +1,117 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`UsersControlpanel renders a user control component 1`] = `
-
+
-
- Users
-
-
- Note that roles set here apply directly to a user. The symbol
- plone-svgundefined",
- }
- }
- onClick={null}
- style={
- Object {
- "fill": "#007EB1",
- "height": "20px",
- "width": "auto",
- }
- }
- viewBox=""
- xmlns=""
- />
- indicates a role inherited from membership in a group.
-
+ class="container"
+ />
-
-
+
+ Note that roles set here apply directly to a user. The symbol
+
+
+ plone-svg
+
+ undefined
+
+ indicates a role inherited from membership in a group.
+
+
-
-
-
-
-
+
+
-
-
-
- User name
-
-
- Actions
-
-
-
-
-
-
-
+
+ User name
+
+
+ Actions
+
+
+
+
+
-
-
+
+
+ id="toolbar"
+ >
+
+
`;
diff --git a/packages/volto/src/components/manage/Controlpanels/__snapshots__/AddonsControlpanel.test.jsx.snap b/packages/volto/src/components/manage/Controlpanels/__snapshots__/AddonsControlpanel.test.jsx.snap
index 78ea65bb56..5e191feca7 100644
--- a/packages/volto/src/components/manage/Controlpanels/__snapshots__/AddonsControlpanel.test.jsx.snap
+++ b/packages/volto/src/components/manage/Controlpanels/__snapshots__/AddonsControlpanel.test.jsx.snap
@@ -1,221 +1,195 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`AddonsControlpanel renders an addon control component 1`] = `
-
+
- Add-ons Settings
-
-
- Updates available
+ Add-ons Settings
- Update installed addons
-
-
-
- Activate and deactivate add-ons in the lists below.
-
- To make new add-ons show up here, add them to your configuration, build, and restart the server process. For detailed instructions see
- Â
-
+ Update installed addons
+
+
- Installing a third party add-on
-
- .
-
-
- Available
- :
+
+ To make new add-ons show up here, add them to your configuration, build, and restart the server process. For detailed instructions see
+ Â
+
+ Installing a third party add-on
+
+ .
+
- 1
+ Available
+ :
+
+ 1
+
-
-
-
-
- Something Else
-
-
+ class="accordion ui"
+ >
+ class="ui divider"
+ />
+
- Does other things…
+ Something Else
+
-
+ Does other things…
+
+
- Install
-
+
+ Install
+
+
+
+ Latest version
+ : Â
+ 1.0.0
+
- Latest version
- : Â
- 1.0.0
-
+ class="ui divider"
+ />
-
-
-
- Installed
- :
- 1
+ Installed
+ :
+
+ 1
+
-
-
-
-
- Whatever
-
- Update
-
-
-
+ class="accordion ui"
+ >
+ class="ui divider"
+ />
+
- Does stuff and junk…
+ Whatever
+
+ Update
+
+
-
+ Does stuff and junk…
+
+
- Update from version to
-
-
+ Update from version to
+
+
+ Uninstall
+
+
+
- Uninstall
-
+ Installed version
+ : Â
+ 1.0.0
+
- Installed version
- : Â
- 1.0.0
-
+ class="ui divider"
+ />
-
+ id="toolbar"
+ >
+
+
`;
diff --git a/packages/volto/src/components/manage/Controlpanels/__snapshots__/Aliases.test.jsx.snap b/packages/volto/src/components/manage/Controlpanels/__snapshots__/Aliases.test.jsx.snap
index 3faa80d47e..79e00ac7e7 100644
--- a/packages/volto/src/components/manage/Controlpanels/__snapshots__/Aliases.test.jsx.snap
+++ b/packages/volto/src/components/manage/Controlpanels/__snapshots__/Aliases.test.jsx.snap
@@ -1,518 +1,440 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Aliases renders an aliases control component 1`] = `
-
+
-
-
- URL Management
-
-
+ URL Management
+
+
- Alternative url path (Required)
-
-
- Enter the absolute path where the alternative url should exist. The path must start with '/'. Only urls that result in a 404 not found page will result in a redirect occurring.
-
-
+
+ Enter the absolute path where the alternative url should exist. The path must start with '/'. Only urls that result in a 404 not found page will result in a redirect occurring.
+
+
-
-
- Target Path (Required)
-
-
- Enter the absolute path of the target. The path must start with '/'. Target must exist or be an existing alternative url path to the target.
-
-
+
+ Enter the absolute path of the target. The path must start with '/'. Target must exist or be an existing alternative url path to the target.
+
+
+
+ Add
+
-
- Add
-
-
-
-
-
-
+
- All existing alternative urls for this site
-
-
- Filter by prefix
-
-
-
-
- Manually or automatically added?
-
-
-
-
-
-
-
-
- Filter
-
-
- Alternative url path → target url path (date and time of creation, manually created yes/no)
-
-
-
-
-
- Select
-
-
- Alias
-
-
- Target
-
-
- Date
-
-
- Manual
-
-
-
+
+ Both
+
+
+
+
+
-
-
-
-
-
-
-
-
- /eventsalias
-
-
-
-
- /events
-
-
-
-
- 2022-05-16T11:52:35+00:00
-
-
-
-
- true
-
-
-
-
+
+ Automatically
+
+
+
+
+
+
+ Filter
+
+
+
+
+
-
-
-
-
-
-
-
- /eventsgreatalias
-
-
-
+
+ Alias
+
+
+ Target
+
+
+ Date
+
+
+ Manual
+
+
+
-
- /events
-
-
-
+
+
+
+
+
+
+
+ /eventsalias
+
+
+
+
+ /events
+
+
+
+
+ 2022-05-16T11:52:35+00:00
+
+
+
+
+ true
+
+
+
+
-
- 2022-05-17T09:38:19+00:00
-
-
-
+
+
+
+
+
+
+
+ /eventsgreatalias
+
+
+
+
+ /events
+
+
+
+
+ 2022-05-17T09:38:19+00:00
+
+
+
+
+ true
+
+
+
+
-
- true
-
-
-
-
+
+
+
+
+
+
+
+ /eventsincredible
+
+
+
+
+ /events
+
+
+
+
+ 2022-05-17T09:38:35+00:00
+
+
+
+
+ true
+
+
+
+
+
+
+
-
-
-
-
+
+ Remove selected
+
-
- Remove selected
-
-
-
-
-
+
+
+
+
+ id="toolbar"
+ >
+
+
`;
diff --git a/packages/volto/src/components/manage/Controlpanels/__snapshots__/ContentType.test.jsx.snap b/packages/volto/src/components/manage/Controlpanels/__snapshots__/ContentType.test.jsx.snap
index ec12264619..4f14e1a276 100644
--- a/packages/volto/src/components/manage/Controlpanels/__snapshots__/ContentType.test.jsx.snap
+++ b/packages/volto/src/components/manage/Controlpanels/__snapshots__/ContentType.test.jsx.snap
@@ -1,20 +1,26 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`ContentType renders dexterity content-type component 1`] = `
-
`;
diff --git a/packages/volto/src/components/manage/Controlpanels/__snapshots__/ContentTypeLayout.test.jsx.snap b/packages/volto/src/components/manage/Controlpanels/__snapshots__/ContentTypeLayout.test.jsx.snap
index 05ca0ff67e..e4adb1612b 100644
--- a/packages/volto/src/components/manage/Controlpanels/__snapshots__/ContentTypeLayout.test.jsx.snap
+++ b/packages/volto/src/components/manage/Controlpanels/__snapshots__/ContentTypeLayout.test.jsx.snap
@@ -1,3 +1,10 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
-exports[`ContentTypeLayout renders dexterity content-type layout component 1`] = `
`;
+exports[`ContentTypeLayout renders dexterity content-type layout component 1`] = `
+
+`;
diff --git a/packages/volto/src/components/manage/Controlpanels/__snapshots__/ContentTypes.test.jsx.snap b/packages/volto/src/components/manage/Controlpanels/__snapshots__/ContentTypes.test.jsx.snap
index e1b6dced61..1a4e81fdba 100644
--- a/packages/volto/src/components/manage/Controlpanels/__snapshots__/ContentTypes.test.jsx.snap
+++ b/packages/volto/src/components/manage/Controlpanels/__snapshots__/ContentTypes.test.jsx.snap
@@ -1,367 +1,249 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`ContentTypes renders dexterity content-types controlpanel component 1`] = `
-
+
-
-
+
-
- Dexterity Content Types
-
-
-
+
+
+
+
+
+
+
+ id="toolbar"
+ >
+
+
`;
diff --git a/packages/volto/src/components/manage/Controlpanels/__snapshots__/Controlpanel.test.jsx.snap b/packages/volto/src/components/manage/Controlpanels/__snapshots__/Controlpanel.test.jsx.snap
index 8d62cd5bef..c496e9059b 100644
--- a/packages/volto/src/components/manage/Controlpanels/__snapshots__/Controlpanel.test.jsx.snap
+++ b/packages/volto/src/components/manage/Controlpanels/__snapshots__/Controlpanel.test.jsx.snap
@@ -1,18 +1,24 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Controlpanel renders a controlpanel component 1`] = `
-
+
+ class="ui container"
+ >
+
+
+ id="toolbar"
+ >
+
+
`;
diff --git a/packages/volto/src/components/manage/Controlpanels/__snapshots__/Controlpanels.test.jsx.snap b/packages/volto/src/components/manage/Controlpanels/__snapshots__/Controlpanels.test.jsx.snap
index de99eecd17..7c585afada 100644
--- a/packages/volto/src/components/manage/Controlpanels/__snapshots__/Controlpanels.test.jsx.snap
+++ b/packages/volto/src/components/manage/Controlpanels/__snapshots__/Controlpanels.test.jsx.snap
@@ -1,1157 +1,834 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Controlpanels renders a controlpanels component 1`] = `
-
+
- Site Setup
-
-
- General
-
-
+ Site Setup
+
+
+ General
+
+
-
+
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
+
+ Date and Time
+
+
+
+
+
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
+
+ URL Management
+
+
+
+
+
-
-
-
-
-
+
+
+ Undo
+
+
+
+
-
-
- Content
-
-
+ Content
+
+
-
-
+
+ Content Rules
+
+
+
+
+
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
+
+ Moderate Comments
+
+
+
+
+
-
-
-
-
-
+
+
+ Relations
+
+
+
+
-
-
- Security
-
-
-
-
- Users
-
-
+ Users
+
+
-
+
-
-
-
-
-
-
-
-
+
+ User Group Membership
+
+
+
+
+
-
-
-
-
-
+
+
+ Users
+
+
+
+
-
-
- Version Overview
+
+ Version Overview
+
+
-
+
`;
exports[`Controlpanels renders an additional control panel 1`] = `
-
+
- Site Setup
-
-
- Security
-
-
+ Site Setup
+
+
+ Security
+
+
-
-
- Add-on Configuration
-
-
+ Add-on Configuration
+
+
-
-
- General
-
-
+ General
+
+
-
+
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
+
+ URL Management
+
+
+
+
+
-
-
-
-
-
+
+
+ Undo
+
+
+
+
-
-
- Content
-
-
+ Content
+
+
-
-
+
+ Content Rules
+
+
+
+
+
-
-
-
-
-
-
-
-
+
+ Moderate Comments
+
+
+
+
+
-
-
-
-
-
+
+
+ Relations
+
+
+
+
-
-
- Users
-
-
+ Users
+
+
-
+
-
-
-
-
-
-
-
-
+
+ User Group Membership
+
+
+
+
+
-
-
-
-
-
+
+
+ Users
+
+
+
+
-
-
- Version Overview
+
+ Version Overview
+
+
-
+ id="toolbar"
+ >
+
+
`;
diff --git a/packages/volto/src/components/manage/Controlpanels/__snapshots__/ModerateComments.test.jsx.snap b/packages/volto/src/components/manage/Controlpanels/__snapshots__/ModerateComments.test.jsx.snap
index 2c3c5473a4..41a8a9da88 100644
--- a/packages/volto/src/components/manage/Controlpanels/__snapshots__/ModerateComments.test.jsx.snap
+++ b/packages/volto/src/components/manage/Controlpanels/__snapshots__/ModerateComments.test.jsx.snap
@@ -1,68 +1,74 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`ModerateComments renders a moderate comments component 1`] = `
-
`;
diff --git a/packages/volto/src/components/manage/Controlpanels/__snapshots__/UndoControlpanel.test.jsx.snap b/packages/volto/src/components/manage/Controlpanels/__snapshots__/UndoControlpanel.test.jsx.snap
index 5f3f74bc51..44d370a5b8 100644
--- a/packages/volto/src/components/manage/Controlpanels/__snapshots__/UndoControlpanel.test.jsx.snap
+++ b/packages/volto/src/components/manage/Controlpanels/__snapshots__/UndoControlpanel.test.jsx.snap
@@ -1,452 +1,414 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`UndoControlpanel renders undo controlpanel component 1`] = `
-
+
- Undo Controlpanel
-
-
-
+ class="ui segment primary"
+ >
+ Undo Controlpanel
+
-
+
+ id="toolbar"
+ >
+
+
`;
diff --git a/packages/volto/src/components/manage/Delete/Delete.jsx b/packages/volto/src/components/manage/Delete/Delete.jsx
index 805c6ac0a8..50da8f9b2e 100644
--- a/packages/volto/src/components/manage/Delete/Delete.jsx
+++ b/packages/volto/src/components/manage/Delete/Delete.jsx
@@ -1,7 +1,7 @@
import { useEffect, useState } from 'react';
import { useDispatch, useSelector, shallowEqual } from 'react-redux';
import { useHistory, useLocation } from 'react-router-dom';
-import { Portal } from 'react-portal';
+import { createPortal } from 'react-dom';
import { Button, Container, List, Segment } from 'semantic-ui-react';
import { FormattedMessage, defineMessages, useIntl } from 'react-intl';
import qs from 'query-string';
@@ -110,15 +110,15 @@ const Delete = () => {
- {isClient && (
-
+ {isClient &&
+ createPortal(
}
- />
-
- )}
+ />,
+ document.getElementById('toolbar'),
+ )}
);
}
diff --git a/packages/volto/src/components/manage/Delete/Delete.test.jsx b/packages/volto/src/components/manage/Delete/Delete.test.jsx
index 7069d32a4e..cd1376c2c5 100644
--- a/packages/volto/src/components/manage/Delete/Delete.test.jsx
+++ b/packages/volto/src/components/manage/Delete/Delete.test.jsx
@@ -1,5 +1,5 @@
import React from 'react';
-import renderer from 'react-test-renderer';
+import { render } from '@testing-library/react';
import configureStore from 'redux-mock-store';
import { Provider } from 'react-intl-redux';
import { MemoryRouter } from 'react-router-dom';
@@ -8,9 +8,7 @@ import Delete from './Delete';
const mockStore = configureStore();
-jest.mock('react-portal', () => ({
- Portal: jest.fn(() =>
),
-}));
+jest.mock('../Toolbar/Toolbar', () => jest.fn(() =>
));
describe('Delete', () => {
it('renders an empty delete component', () => {
@@ -27,15 +25,16 @@ describe('Delete', () => {
messages: {},
},
});
- const component = renderer.create(
+ const { container } = render(
+
,
);
- const json = component.toJSON();
- expect(json).toMatchSnapshot();
+
+ expect(container).toMatchSnapshot();
});
it('renders a delete component', () => {
@@ -54,14 +53,15 @@ describe('Delete', () => {
messages: {},
},
});
- const component = renderer.create(
+ const { container } = render(
+
,
);
- const json = component.toJSON();
- expect(json).toMatchSnapshot();
+
+ expect(container).toMatchSnapshot();
});
});
diff --git a/packages/volto/src/components/manage/Delete/__snapshots__/Delete.test.jsx.snap b/packages/volto/src/components/manage/Delete/__snapshots__/Delete.test.jsx.snap
index 737742ef56..0d903b147c 100644
--- a/packages/volto/src/components/manage/Delete/__snapshots__/Delete.test.jsx.snap
+++ b/packages/volto/src/components/manage/Delete/__snapshots__/Delete.test.jsx.snap
@@ -1,70 +1,78 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Delete renders a delete component 1`] = `
-
+
- Do you really want to delete this item?
-
-
+ Do you really want to delete this item?
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+ id="toolbar"
+ >
+
+
`;
-exports[`Delete renders an empty delete component 1`] = `
`;
+exports[`Delete renders an empty delete component 1`] = `
+
+`;
diff --git a/packages/volto/src/components/manage/Diff/Diff.jsx b/packages/volto/src/components/manage/Diff/Diff.jsx
index c7302970cf..6b5b1caf21 100644
--- a/packages/volto/src/components/manage/Diff/Diff.jsx
+++ b/packages/volto/src/components/manage/Diff/Diff.jsx
@@ -11,7 +11,7 @@ import { compose } from 'redux';
import { filter, isEqual, map } from 'lodash';
import { Container, Button, Dropdown, Grid, Table } from 'semantic-ui-react';
import { Link, withRouter } from 'react-router-dom';
-import { Portal } from 'react-portal';
+import { createPortal } from 'react-dom';
import { FormattedMessage, defineMessages, injectIntl } from 'react-intl';
import qs from 'query-string';
@@ -333,8 +333,8 @@ class Diff extends Component {
view={this.props.view}
/>
)}
- {this.state.isClient && (
-
+ {this.state.isClient &&
+ createPortal(
}
- />
-
- )}
+ />,
+ document.getElementById('toolbar'),
+ )}
);
}
diff --git a/packages/volto/src/components/manage/Diff/Diff.test.jsx b/packages/volto/src/components/manage/Diff/Diff.test.jsx
index 9da87ed980..c0a890a19d 100644
--- a/packages/volto/src/components/manage/Diff/Diff.test.jsx
+++ b/packages/volto/src/components/manage/Diff/Diff.test.jsx
@@ -8,9 +8,7 @@ import Diff from './Diff';
const mockStore = configureStore();
-jest.mock('react-portal', () => ({
- Portal: jest.fn(() =>
),
-}));
+jest.mock('../Toolbar/Toolbar', () => jest.fn(() =>
));
jest.mock('@plone/volto/helpers/Loadable/Loadable');
beforeAll(
@@ -75,6 +73,7 @@ describe('Diff', () => {
+
,
);
diff --git a/packages/volto/src/components/manage/Diff/__snapshots__/Diff.test.jsx.snap b/packages/volto/src/components/manage/Diff/__snapshots__/Diff.test.jsx.snap
index 65383def7a..8512803d3c 100644
--- a/packages/volto/src/components/manage/Diff/__snapshots__/Diff.test.jsx.snap
+++ b/packages/volto/src/components/manage/Diff/__snapshots__/Diff.test.jsx.snap
@@ -269,6 +269,10 @@ exports[`Diff renders a diff component 1`] = `
+
+
);
}
diff --git a/packages/volto/src/components/manage/Edit/Edit.test.jsx b/packages/volto/src/components/manage/Edit/Edit.test.jsx
index 5e28911e95..28eff96b95 100644
--- a/packages/volto/src/components/manage/Edit/Edit.test.jsx
+++ b/packages/volto/src/components/manage/Edit/Edit.test.jsx
@@ -1,5 +1,5 @@
import React from 'react';
-import renderer from 'react-test-renderer';
+import { render } from '@testing-library/react';
import configureStore from 'redux-mock-store';
import { Provider } from 'react-intl-redux';
import jwt from 'jsonwebtoken';
@@ -8,9 +8,9 @@ import { __test__ as Edit } from './Edit';
const mockStore = configureStore();
-jest.mock('react-portal', () => ({
- Portal: jest.fn(() =>
),
-}));
+jest.mock('../Toolbar/Toolbar', () => jest.fn(() =>
));
+jest.mock('../Sidebar/Sidebar', () => jest.fn(() => ));
+
jest.mock('../Form/Form', () => jest.fn(() =>
));
describe('Edit', () => {
@@ -50,13 +50,15 @@ describe('Edit', () => {
messages: {},
},
});
- const component = renderer.create(
+ const { container } = render(
+
+
,
);
- const json = component.toJSON();
- expect(json).toMatchSnapshot();
+
+ expect(container).toMatchSnapshot();
});
it('renders an edit component', () => {
@@ -97,12 +99,14 @@ describe('Edit', () => {
messages: {},
},
});
- const component = renderer.create(
+ const { container } = render(
+
+
,
);
- const json = component.toJSON();
- expect(json).toMatchSnapshot();
+
+ expect(container).toMatchSnapshot();
});
});
diff --git a/packages/volto/src/components/manage/Edit/__snapshots__/Edit.test.jsx.snap b/packages/volto/src/components/manage/Edit/__snapshots__/Edit.test.jsx.snap
index e8df203414..67d8997fd5 100644
--- a/packages/volto/src/components/manage/Edit/__snapshots__/Edit.test.jsx.snap
+++ b/packages/volto/src/components/manage/Edit/__snapshots__/Edit.test.jsx.snap
@@ -1,33 +1,53 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Edit renders an edit component 1`] = `
-
+
+ id="page-edit"
+ >
+
+
+ id="sidebar"
+ >
+
+
`;
exports[`Edit renders an empty edit component 1`] = `
-
+
+ id="page-edit"
+ >
+
+
+ id="sidebar"
+ >
+
+
`;
diff --git a/packages/volto/src/components/manage/Form/BlockDataForm.test.jsx b/packages/volto/src/components/manage/Form/BlockDataForm.test.jsx
index 6c77dc20f7..e0abf26532 100644
--- a/packages/volto/src/components/manage/Form/BlockDataForm.test.jsx
+++ b/packages/volto/src/components/manage/Form/BlockDataForm.test.jsx
@@ -1,7 +1,6 @@
import React from 'react';
import BlockDataForm from './BlockDataForm';
import { render } from '@testing-library/react';
-import '@testing-library/jest-dom/extend-expect';
import configureStore from 'redux-mock-store';
import config from '@plone/volto/registry';
import { Provider } from 'react-intl-redux';
diff --git a/packages/volto/src/components/manage/Form/Form.jsx b/packages/volto/src/components/manage/Form/Form.jsx
index 6ffc4020b0..40b8ae599a 100644
--- a/packages/volto/src/components/manage/Form/Form.jsx
+++ b/packages/volto/src/components/manage/Form/Form.jsx
@@ -31,7 +31,7 @@ import isBoolean from 'lodash/isBoolean';
import PropTypes from 'prop-types';
import React, { Component } from 'react';
import { injectIntl } from 'react-intl';
-import { Portal } from 'react-portal';
+import { createPortal } from 'react-dom';
import { connect } from 'react-redux';
import {
Accordion,
@@ -238,6 +238,7 @@ class Form extends Component {
isClient: false,
// Ensure focus remain in field after change
inFocus: {},
+ sidebarMetadataIsAvailable: false,
};
this.onChangeField = this.onChangeField.bind(this);
this.onSelectBlock = this.onSelectBlock.bind(this);
@@ -313,6 +314,13 @@ class Form extends Component {
// Reset focus field
this.props.resetMetadataFocus();
}
+
+ if (
+ !this.state.sidebarMetadataIsAvailable &&
+ document.getElementById('sidebar-metadata')
+ ) {
+ this.setState(() => ({ sidebarMetadataIsAvailable: true }));
+ }
}
/**
@@ -712,10 +720,10 @@ class Form extends Component {
editable={this.props.editable}
isMainForm={this.props.editable}
/>
- {this.state.isClient && this.props.editable && (
-
+ {this.state.isClient &&
+ this.state.sidebarMetadataIsAvailable &&
+ this.props.editable &&
+ createPortal(
))}
-
-
- )}
+ ,
+ document.getElementById('sidebar-metadata'),
+ )}
- {this.state.isClient && (
-
+ {this.state.isClient &&
+ createPortal(
}
- />
-
- )}
+ />,
+ document.getElementById('toolbar'),
+ )}
);
}
diff --git a/packages/volto/src/components/manage/History/History.test.jsx b/packages/volto/src/components/manage/History/History.test.jsx
index c0ddab5703..164e699399 100644
--- a/packages/volto/src/components/manage/History/History.test.jsx
+++ b/packages/volto/src/components/manage/History/History.test.jsx
@@ -1,5 +1,5 @@
import React from 'react';
-import renderer from 'react-test-renderer';
+import { render } from '@testing-library/react';
import configureStore from 'redux-mock-store';
import { StaticRouter } from 'react-router-dom';
import { Provider } from 'react-intl-redux';
@@ -9,9 +9,7 @@ import FakeTimers from '@sinonjs/fake-timers';
import History from './History';
const mockStore = configureStore();
-jest.mock('react-portal', () => ({
- Portal: jest.fn(() =>
),
-}));
+jest.mock('../Toolbar/Toolbar', () => jest.fn(() =>
));
const FIXED_SYSTEM_TIME = '2017-04-23T15:38:00.000Z';
@@ -87,13 +85,14 @@ describe('History', () => {
messages: {},
},
});
- const component = renderer.create(
+ const { container } = render(
+
,
);
- const json = component.toJSON();
- expect(json).toMatchSnapshot();
+
+ expect(container).toMatchSnapshot();
});
it('redirects if unassigned', () => {
@@ -153,13 +152,14 @@ describe('History', () => {
messages: {},
},
});
- const component = renderer.create(
+ const { container } = render(
+
,
);
- const json = component.toJSON();
- expect(json).toMatchSnapshot();
+
+ expect(container).toMatchSnapshot();
});
it('redirects if unassigned, no token gives unauthorized', () => {
@@ -217,14 +217,15 @@ describe('History', () => {
messages: {},
},
});
- const component = renderer.create(
+ const { container } = render(
+
,
);
- const json = component.toJSON();
- expect(json).toMatchSnapshot();
+
+ expect(container).toMatchSnapshot();
});
});
diff --git a/packages/volto/src/components/manage/History/__snapshots__/History.test.jsx.snap b/packages/volto/src/components/manage/History/__snapshots__/History.test.jsx.snap
index af2888cab6..975b25879e 100644
--- a/packages/volto/src/components/manage/History/__snapshots__/History.test.jsx.snap
+++ b/packages/volto/src/components/manage/History/__snapshots__/History.test.jsx.snap
@@ -1,265 +1,268 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`History redirects if unassigned 1`] = `
-
-
- Forbidden
-
-
+
- We apologize for the inconvenience, but you don't have permissions on this resource.
-
+
+ Forbidden
+
+
+ We apologize for the inconvenience, but you don't have permissions on this resource.
+
+
+
`;
exports[`History redirects if unassigned, no token gives unauthorized 1`] = `
-
-
- Unauthorized
-
-
-
+
- You are trying to access a protected resource, please
-
+ Unauthorized
+
+
+
- log in
-
- first.
-
-
- If you are certain you have the correct web address but are encountering an error, please contact the
-
- Site Administration
-
- .
-
-
- Thank you.
-
+ You are trying to access a protected resource, please
+
+ log in
+
+ first.
+
+
+ If you are certain you have the correct web address but are encountering an error, please contact the
+
+ Site Administration
+
+ .
+
+
+ Thank you.
+
+
+
`;
exports[`History renders a history component 1`] = `
-
+
- History of
-
- Blog
-
-
-
- You can view the history of your item below.
-
-
-
-
-
- #
-
-
- What
-
-
- Who
-
-
- When
-
-
- Change Note
-
-
-
-
-
+ Blog
+
+
+
+ You can view the history of your item below.
+
+
-
-
-
-
-
-
- Publish
- (Private → Published)
-
-
-
- Web Admin
-
-
-
- 4/19/2017
-
-
-
-
-
-
-
-
+
+ What
+
+
+ Who
+
+
+ When
+
+
+ Change Note
+
+
+
+
+
-
-
-
-
-
- Edited
-
-
-
- Web Admin
-
-
-
- 4/19/2017
-
-
-
- Changed text
-
-
+
+
+
+ Publish
+ (Private → Published)
+
+
+
+ Web Admin
+
+
+
+ 4/19/2017
+
+
+
+
+
+
-
+
+
+
+
+ Edited
+
+
+
+ Web Admin
+
+
+
+ 4/19/2017
+
+
+
+ Changed text
+
+
-
-
-
-
-
-
-
-
-
-
- Create
- (Private)
-
-
-
+
+
+
+
+
+
- Web Admin
-
-
-
- 4/19/2017
-
-
-
-
-
-
-
-
-
+
+
+
+
+ Create
+ (Private)
+
+
+
+ Web Admin
+
+
+
+ 4/19/2017
+
+
+
+
+
+
+
+
+ id="toolbar"
+ >
+
+
`;
diff --git a/packages/volto/src/components/manage/LinksToItem/LinksToItem.jsx b/packages/volto/src/components/manage/LinksToItem/LinksToItem.jsx
index bc93a24055..a8ad6915cd 100644
--- a/packages/volto/src/components/manage/LinksToItem/LinksToItem.jsx
+++ b/packages/volto/src/components/manage/LinksToItem/LinksToItem.jsx
@@ -2,11 +2,11 @@
* LinksToItem component
* @module components/manage/LinksToItem/LinksToItem
*/
-import { useEffect } from 'react';
+import React, { useEffect, useState } from 'react';
import { find } from 'lodash';
import { Helmet } from '@plone/volto/helpers';
import { Link } from 'react-router-dom';
-import { Portal } from 'react-portal';
+import { createPortal } from 'react-dom';
import { Container, Segment, Table } from 'semantic-ui-react';
import { FormattedMessage, defineMessages, useIntl } from 'react-intl';
import { useDispatch, useSelector } from 'react-redux';
@@ -19,7 +19,6 @@ import {
UniversalLink,
Unauthorized,
} from '@plone/volto/components';
-import { compose } from 'redux';
import { getBaseUrl } from '@plone/volto/helpers';
import backSVG from '@plone/volto/icons/back.svg';
@@ -57,6 +56,12 @@ const LinksToItem = (props) => {
id: 'plone_setup',
});
+ const [isClient, setIsClient] = useState(false);
+
+ useEffect(() => {
+ setIsClient(true);
+ }, []);
+
useEffect(() => {
dispatch(queryRelations(null, false, itempath, null, [itempath]));
}, [dispatch, itempath]);
@@ -101,41 +106,46 @@ const LinksToItem = (props) => {
{
- {Object.keys(links_ordered).map((relationtype) => {
+ {Object.keys(links_ordered).map((relationtype, index) => {
+ // TODO: keys driven by links_ordered[relationtype][index]['@id'])
return [].concat(
[
-
-
- {relationtype === 'isReferencing' ? (
-
- ) : relationtype === 'relatedItems' ? (
-
- ) : (
- <>
+
+
+
+ {relationtype === 'isReferencing' ? (
{relationtype} }}
+ id="Linking this item with hyperlink in text"
+ defaultMessage="Linking this item with hyperlink in text"
/>
- >
- )}
-
-
-
-
-
-
-
- ,
+ ) : relationtype === 'relatedItems' ? (
+
+ ) : (
+ <>
+ {relationtype},
+ }}
+ />
+ >
+ )}
+
+
+
+
+
+
+
+
+ ,
],
links_ordered[relationtype].map((link) => {
return (
@@ -173,8 +183,8 @@ const LinksToItem = (props) => {
)}
- {__CLIENT__ && (
-
+ {isClient &&
+ createPortal(
{
>
>
}
- />
-
- )}
+ />,
+ document.getElementById('toolbar'),
+ )}
);
};
export const __test__ = LinksToItem;
-export default compose(
- asyncConnect([
- {
- key: 'actions',
- // Dispatch async/await to make the operation synchronous, otherwise it returns
- // before the promise is resolved
- promise: async ({ location, store: { dispatch } }) =>
- await dispatch(listActions(getBaseUrl(location.pathname))),
+
+export default asyncConnect([
+ {
+ key: 'content',
+ // Dispatch async/await to make the operation synchronous, otherwise it returns
+ // before the promise is resolved
+ promise: async ({ location, store: { dispatch } }) => {
+ const pathname = getBaseUrl(location.pathname);
+ return await dispatch(getContent(pathname));
},
- ]),
-)(LinksToItem);
+ },
+ {
+ key: 'actions',
+ // Dispatch async/await to make the operation synchronous, otherwise it returns
+ // before the promise is resolved
+ promise: async ({ location, store: { dispatch } }) =>
+ await dispatch(listActions(getBaseUrl(location.pathname))),
+ },
+ {
+ key: 'relations',
+ // Dispatch async/await to make the operation synchronous, otherwise it returns
+ // before the promise is resolved
+ promise: async ({ location, store: { dispatch } }) => {
+ const pathname = getBaseUrl(location.pathname);
+ return await dispatch(
+ queryRelations(null, false, pathname, null, [pathname]),
+ );
+ },
+ },
+])(LinksToItem);
diff --git a/packages/volto/src/components/manage/LinksToItem/LinksToItem.test.jsx b/packages/volto/src/components/manage/LinksToItem/LinksToItem.test.jsx
index 4c590cbbcc..210bd35124 100644
--- a/packages/volto/src/components/manage/LinksToItem/LinksToItem.test.jsx
+++ b/packages/volto/src/components/manage/LinksToItem/LinksToItem.test.jsx
@@ -1,5 +1,5 @@
import React from 'react';
-import renderer from 'react-test-renderer';
+import { render } from '@testing-library/react';
import { Provider } from 'react-intl-redux';
import configureMockStore from 'redux-mock-store';
import thunk from 'redux-thunk';
@@ -10,9 +10,8 @@ import { __test__ as LinksToItem } from './LinksToItem';
const middlewares = [thunk];
const mockStore = configureMockStore(middlewares);
-jest.mock('react-portal', () => ({
- Portal: jest.fn(() =>
),
-}));
+jest.mock('../Toolbar/Toolbar', () => jest.fn(() =>
));
+
jest.mock('../Toolbar/More', () => jest.fn(() =>
));
describe('LinksToItem', () => {
@@ -99,14 +98,15 @@ describe('LinksToItem', () => {
messages: {},
},
});
- const component = renderer.create(
+ const { container } = render(
+
,
);
- const json = component.toJSON();
- expect(json).toMatchSnapshot();
+
+ expect(container).toMatchSnapshot();
});
});
diff --git a/packages/volto/src/components/manage/LinksToItem/__snapshots__/LinksToItem.test.jsx.snap b/packages/volto/src/components/manage/LinksToItem/__snapshots__/LinksToItem.test.jsx.snap
index 71a4163128..45741837c2 100644
--- a/packages/volto/src/components/manage/LinksToItem/__snapshots__/LinksToItem.test.jsx.snap
+++ b/packages/volto/src/components/manage/LinksToItem/__snapshots__/LinksToItem.test.jsx.snap
@@ -1,142 +1,142 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`LinksToItem renders "links and references" view 1`] = `
-
+
- Content that links to or references
-
- page #1
-
-
-
-
-
+ page #1
+
+
+
+
-
- Linking this item with hyperlink in text
-
-
- Review state
-
-
- Type
-
-
-
-
+ Linking this item with hyperlink in text
+
+
+ Review state
+
+
+ Type
+
+
+
-
-
- Basil
+
+ Basil
+
+
+
+
+
+ published
-
-
-
-
- published
-
-
-
-
- Document
-
-
-
-
-
- Referencing this item as related item
-
-
- Review state
-
-
+
+
+ Document
+
+
+
+
- Type
-
-
-
-
+ Referencing this item as related item
+
+
+ Review state
+
+
+ Type
+
+
+
-
-
- Cucumber
+
+ Cucumber
+
+
+
+
+
+ published
-
-
-
-
- published
-
-
-
-
- Document
-
-
-
-
-
+
+
+
+ Document
+
+
+
+
+
+
+ id="toolbar"
+ >
+
+
`;
diff --git a/packages/volto/src/components/manage/Multilingual/CreateTranslation.test.jsx b/packages/volto/src/components/manage/Multilingual/CreateTranslation.test.jsx
deleted file mode 100644
index 56ff1b32a1..0000000000
--- a/packages/volto/src/components/manage/Multilingual/CreateTranslation.test.jsx
+++ /dev/null
@@ -1,46 +0,0 @@
-import React from 'react';
-import renderer from 'react-test-renderer';
-import configureStore from 'redux-mock-store';
-import { Provider } from 'react-intl-redux';
-import { MemoryRouter } from 'react-router-dom';
-import config from '@plone/volto/registry';
-
-import CreateTranslation from './CreateTranslation';
-
-beforeAll(() => {
- config.settings.isMultilingual = true;
- config.settings.supportedLanguages = ['de', 'es'];
-});
-
-const mockStore = configureStore();
-
-describe('CreateTranslation', () => {
- it('renders a CreateTranslation component', () => {
- const store = mockStore({
- intl: {
- locale: 'en',
- messages: {},
- },
- translations: {
- translationLocation: '/es',
- },
- });
- const component = renderer.create(
-
-
-
-
- ,
- );
- const json = component.toJSON();
- expect(json).toMatchSnapshot();
- });
-});
diff --git a/packages/volto/src/components/manage/Multilingual/ManageTranslations.jsx b/packages/volto/src/components/manage/Multilingual/ManageTranslations.jsx
index a375b98e89..37fe9a11dc 100644
--- a/packages/volto/src/components/manage/Multilingual/ManageTranslations.jsx
+++ b/packages/volto/src/components/manage/Multilingual/ManageTranslations.jsx
@@ -1,4 +1,4 @@
-import React from 'react';
+import React, { useEffect, useState } from 'react';
import { Button, Container, Segment, Table } from 'semantic-ui-react';
import { Helmet } from '@plone/volto/helpers';
import { flattenToAppURL, getBaseUrl, langmap } from '@plone/volto/helpers';
@@ -15,7 +15,7 @@ import {
} from '@plone/volto/actions';
import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
import { useSelector, useDispatch } from 'react-redux';
-import { Portal } from 'react-portal';
+import { createPortal } from 'react-dom';
import { toast } from 'react-toastify';
import addSVG from '@plone/volto/icons/add.svg';
@@ -64,6 +64,12 @@ const ManageTranslations = (props) => {
const content = useSelector((state) => state.content.data);
const dispatch = useDispatch();
+ const [isClient, setIsClient] = useState(false);
+
+ useEffect(() => {
+ setIsClient(true);
+ }, []);
+
const { isObjectBrowserOpen, openObjectBrowser } = props;
const currentSelectedItem = React.useRef(null);
@@ -269,8 +275,8 @@ const ManageTranslations = (props) => {
)}
- {__CLIENT__ && (
-
+ {isClient &&
+ createPortal(
{
/>
}
- />
-
- )}
+ />,
+ document.getElementById('toolbar'),
+ )}
);
diff --git a/packages/volto/src/components/manage/Multilingual/ManageTranslations.test.jsx b/packages/volto/src/components/manage/Multilingual/ManageTranslations.test.jsx
index a8d51b4101..f4a85720ad 100644
--- a/packages/volto/src/components/manage/Multilingual/ManageTranslations.test.jsx
+++ b/packages/volto/src/components/manage/Multilingual/ManageTranslations.test.jsx
@@ -1,5 +1,5 @@
import React from 'react';
-import renderer from 'react-test-renderer';
+import { render } from '@testing-library/react';
import configureStore from 'redux-mock-store';
import { Provider } from 'react-intl-redux';
import { MemoryRouter } from 'react-router-dom';
@@ -12,9 +12,7 @@ beforeAll(() => {
config.settings.supportedLanguages = ['de', 'es'];
});
-jest.mock('react-portal', () => ({
- Portal: jest.fn(() =>
),
-}));
+jest.mock('../Toolbar/Toolbar', () => jest.fn(() =>
));
const mockStore = configureStore();
@@ -36,7 +34,7 @@ describe('ManageTranslations', () => {
},
},
});
- const component = renderer.create(
+ const { container } = render(
{
},
}}
/>
+
,
);
- const json = component.toJSON();
- expect(json).toMatchSnapshot();
+
+ expect(container).toMatchSnapshot();
});
});
diff --git a/packages/volto/src/components/manage/Multilingual/__snapshots__/CreateTranslation.test.jsx.snap b/packages/volto/src/components/manage/Multilingual/__snapshots__/CreateTranslation.test.jsx.snap
deleted file mode 100644
index 6676d8b34e..0000000000
--- a/packages/volto/src/components/manage/Multilingual/__snapshots__/CreateTranslation.test.jsx.snap
+++ /dev/null
@@ -1,3 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`CreateTranslation renders a CreateTranslation component 1`] = `null`;
diff --git a/packages/volto/src/components/manage/Multilingual/__snapshots__/ManageTranslations.test.jsx.snap b/packages/volto/src/components/manage/Multilingual/__snapshots__/ManageTranslations.test.jsx.snap
index af4ba1ee3a..c91ee38455 100644
--- a/packages/volto/src/components/manage/Multilingual/__snapshots__/ManageTranslations.test.jsx.snap
+++ b/packages/volto/src/components/manage/Multilingual/__snapshots__/ManageTranslations.test.jsx.snap
@@ -1,212 +1,160 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`ManageTranslations renders a ManageTranslations component 1`] = `
-
+
- Manage translations for
-
- My page
-
-
-
-
-
-
- Language
-
-
- Path
-
-
- Tools
-
-
-
-
+ My page
+
+
+
-
-
- Deutsch
-
-
-
+ Language
+
+
+ Path
+
+
-
-
-
-
+
+
+
+
-
+ Deutsch
+
+
-
-
-
-
+
+
-
-
-
-
-
-
-
-
- Español
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
+
-
-
-
-
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/packages/volto/src/components/manage/Preferences/ChangePassword.jsx b/packages/volto/src/components/manage/Preferences/ChangePassword.jsx
index ca817592f6..b686ca0c9f 100644
--- a/packages/volto/src/components/manage/Preferences/ChangePassword.jsx
+++ b/packages/volto/src/components/manage/Preferences/ChangePassword.jsx
@@ -9,7 +9,7 @@ import { Helmet } from '@plone/volto/helpers';
import { connect } from 'react-redux';
import { compose } from 'redux';
import { Link, withRouter } from 'react-router-dom';
-import { Portal } from 'react-portal';
+import { createPortal } from 'react-dom';
import { defineMessages, injectIntl } from 'react-intl';
import { Container } from 'semantic-ui-react';
import jwtDecode from 'jwt-decode';
@@ -195,8 +195,8 @@ class ChangePassword extends Component {
onCancel={this.onCancel}
loading={this.props.loading}
/>
- {this.state.isClient && (
-
+ {this.state.isClient &&
+ createPortal(
}
- />
-
- )}
+ />,
+ document.getElementById('toolbar'),
+ )}
);
}
diff --git a/packages/volto/src/components/manage/Preferences/ChangePassword.test.jsx b/packages/volto/src/components/manage/Preferences/ChangePassword.test.jsx
index 48f71c5aa4..7746c796f2 100644
--- a/packages/volto/src/components/manage/Preferences/ChangePassword.test.jsx
+++ b/packages/volto/src/components/manage/Preferences/ChangePassword.test.jsx
@@ -1,5 +1,5 @@
import React from 'react';
-import renderer from 'react-test-renderer';
+import { render } from '@testing-library/react';
import { Provider } from 'react-intl-redux';
import configureStore from 'redux-mock-store';
import jwt from 'jsonwebtoken';
@@ -9,9 +9,7 @@ import ChangePassword from './ChangePassword';
const mockStore = configureStore();
-jest.mock('react-portal', () => ({
- Portal: jest.fn(() =>
),
-}));
+jest.mock('../Toolbar/Toolbar', () => jest.fn(() =>
));
describe('ChangePassword', () => {
it('renders a change password component', () => {
@@ -36,14 +34,15 @@ describe('ChangePassword', () => {
},
},
});
- const component = renderer.create(
+ const { container } = render(
+
,
);
- const json = component.toJSON();
- expect(json).toMatchSnapshot();
+
+ expect(container).toMatchSnapshot();
});
});
diff --git a/packages/volto/src/components/manage/Preferences/PersonalInformation.test.jsx b/packages/volto/src/components/manage/Preferences/PersonalInformation.test.jsx
index 52eac28cee..b7abdfaf81 100644
--- a/packages/volto/src/components/manage/Preferences/PersonalInformation.test.jsx
+++ b/packages/volto/src/components/manage/Preferences/PersonalInformation.test.jsx
@@ -18,9 +18,7 @@ const userSchema = {
loading: false,
};
-jest.mock('react-portal', () => ({
- Portal: jest.fn(() =>
),
-}));
+jest.mock('../Toolbar/Toolbar', () => jest.fn(() =>
));
describe('PersonalInformation', () => {
it('renders a personal information component', async () => {
diff --git a/packages/volto/src/components/manage/Preferences/PersonalPreferences.test.jsx b/packages/volto/src/components/manage/Preferences/PersonalPreferences.test.jsx
index 97ed07e951..8a72fe0d9f 100644
--- a/packages/volto/src/components/manage/Preferences/PersonalPreferences.test.jsx
+++ b/packages/volto/src/components/manage/Preferences/PersonalPreferences.test.jsx
@@ -8,9 +8,7 @@ import PersonalPreferences from './PersonalPreferences';
const mockStore = configureStore();
-jest.mock('react-portal', () => ({
- Portal: jest.fn(() =>
),
-}));
+jest.mock('../Toolbar/Toolbar', () => jest.fn(() =>
));
jest.mock('@plone/volto/helpers/Loadable/Loadable');
beforeAll(
diff --git a/packages/volto/src/components/manage/Preferences/__snapshots__/ChangePassword.test.jsx.snap b/packages/volto/src/components/manage/Preferences/__snapshots__/ChangePassword.test.jsx.snap
index ef3e37d8c5..1dbacb73fa 100644
--- a/packages/volto/src/components/manage/Preferences/__snapshots__/ChangePassword.test.jsx.snap
+++ b/packages/volto/src/components/manage/Preferences/__snapshots__/ChangePassword.test.jsx.snap
@@ -1,113 +1,92 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`ChangePassword renders a change password component 1`] = `
-
+
-
-
-
- Current password
- -
- Enter your current password.
+
+ Current password
+ -
+ Enter your current password.
+
+
+ New password
+ -
+ Enter your new password. Minimum 8 characters.
+
+
+ Confirm password
+ -
+ Re-enter the password. Make sure the passwords are identical.
+
- New password
- -
- Enter your new password. Minimum 8 characters.
+
+
+
+
+
+
-
- Confirm password
- -
- Re-enter the password. Make sure the passwords are identical.
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+ id="toolbar"
+ >
+
+
`;
diff --git a/packages/volto/src/components/manage/Rules/Rules.jsx b/packages/volto/src/components/manage/Rules/Rules.jsx
index cc0aacf11f..f47c14c567 100644
--- a/packages/volto/src/components/manage/Rules/Rules.jsx
+++ b/packages/volto/src/components/manage/Rules/Rules.jsx
@@ -8,7 +8,7 @@ import { Helmet } from '@plone/volto/helpers';
import { connect } from 'react-redux';
import { compose } from 'redux';
import { Link } from 'react-router-dom';
-import { Portal } from 'react-portal';
+import { createPortal } from 'react-dom';
import {
Button,
Checkbox,
@@ -484,8 +484,8 @@ class Rules extends Component {
)}
- {this.state.isClient && (
-
+ {this.state.isClient &&
+ createPortal(
}
- />
-
- )}
+ />,
+ document.getElementById('toolbar'),
+ )}
);
}
diff --git a/packages/volto/src/components/manage/Rules/Rules.test.jsx b/packages/volto/src/components/manage/Rules/Rules.test.jsx
index fad9e8a3ab..ba8f414ce4 100644
--- a/packages/volto/src/components/manage/Rules/Rules.test.jsx
+++ b/packages/volto/src/components/manage/Rules/Rules.test.jsx
@@ -1,5 +1,5 @@
import React from 'react';
-import renderer from 'react-test-renderer';
+import { render } from '@testing-library/react';
import { Provider } from 'react-intl-redux';
import configureMockStore from 'redux-mock-store';
import thunk from 'redux-thunk';
@@ -9,9 +9,8 @@ import Rules from './Rules';
const middlewares = [thunk];
const mockStore = configureMockStore(middlewares);
-jest.mock('react-portal', () => ({
- Portal: jest.fn(() =>
),
-}));
+jest.mock('../Toolbar/Toolbar', () => jest.fn(() =>
));
+
jest.mock('../Toolbar/More', () => jest.fn(() =>
));
describe('Rules', () => {
@@ -65,12 +64,13 @@ describe('Rules', () => {
messages: {},
},
});
- const component = renderer.create(
+ const { container } = render(
+
,
);
- const json = component.toJSON();
- expect(json).toMatchSnapshot();
+
+ expect(container).toMatchSnapshot();
});
});
diff --git a/packages/volto/src/components/manage/Rules/__snapshots__/Rules.test.jsx.snap b/packages/volto/src/components/manage/Rules/__snapshots__/Rules.test.jsx.snap
index cdc03912ae..8562329969 100644
--- a/packages/volto/src/components/manage/Rules/__snapshots__/Rules.test.jsx.snap
+++ b/packages/volto/src/components/manage/Rules/__snapshots__/Rules.test.jsx.snap
@@ -1,29 +1,35 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Rules renders rules object control 1`] = `
-
+
- Content rules for
-
- Blog
-
-
-
- The following content rules are active in this Page. Use the content rules control panel to create new rules or delete or modify existing ones.
+
+ Content rules for
+
+ Blog
+
+
+
+ The following content rules are active in this Page. Use the content rules control panel to create new rules or delete or modify existing ones.
+
+ id="toolbar"
+ >
+
+
`;
diff --git a/packages/volto/src/components/manage/Sharing/Sharing.jsx b/packages/volto/src/components/manage/Sharing/Sharing.jsx
index 31d715ad0a..b50ece9658 100644
--- a/packages/volto/src/components/manage/Sharing/Sharing.jsx
+++ b/packages/volto/src/components/manage/Sharing/Sharing.jsx
@@ -10,7 +10,7 @@ import { connect } from 'react-redux';
import { compose } from 'redux';
import { Link, withRouter } from 'react-router-dom';
import { find, isEqual, map } from 'lodash';
-import { Portal } from 'react-portal';
+import { createPortal } from 'react-dom';
import {
Button,
Checkbox,
@@ -505,8 +505,8 @@ class SharingComponent extends Component {
- {this.state.isClient && (
-
+ {this.state.isClient &&
+ createPortal(
}
- />
-
- )}
+ />,
+ document.getElementById('toolbar'),
+ )}
);
}
diff --git a/packages/volto/src/components/manage/Sharing/Sharing.test.jsx b/packages/volto/src/components/manage/Sharing/Sharing.test.jsx
index 9e0cafbfff..4924fe2379 100644
--- a/packages/volto/src/components/manage/Sharing/Sharing.test.jsx
+++ b/packages/volto/src/components/manage/Sharing/Sharing.test.jsx
@@ -1,5 +1,5 @@
import React from 'react';
-import renderer from 'react-test-renderer';
+import { render } from '@testing-library/react';
import configureStore from 'redux-mock-store';
import { Provider } from 'react-intl-redux';
import jwt from 'jsonwebtoken';
@@ -10,9 +10,7 @@ import Sharing from './Sharing';
const mockStore = configureStore();
-jest.mock('react-portal', () => ({
- Portal: jest.fn(() =>
),
-}));
+jest.mock('../Toolbar/Toolbar', () => jest.fn(() =>
));
describe('Sharing', () => {
it('renders a sharing component', () => {
@@ -57,16 +55,18 @@ describe('Sharing', () => {
messages: {},
},
});
- const component = renderer.create(
+
+ const { container } = render(
+
,
);
- const json = component.toJSON();
- expect(json).toMatchSnapshot();
+
+ expect(container).toMatchSnapshot();
});
});
diff --git a/packages/volto/src/components/manage/Sharing/__snapshots__/Sharing.test.jsx.snap b/packages/volto/src/components/manage/Sharing/__snapshots__/Sharing.test.jsx.snap
index f56ecded12..b9502bffc7 100644
--- a/packages/volto/src/components/manage/Sharing/__snapshots__/Sharing.test.jsx.snap
+++ b/packages/volto/src/components/manage/Sharing/__snapshots__/Sharing.test.jsx.snap
@@ -1,217 +1,186 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Sharing renders a sharing component 1`] = `
-
+
- Sharing for
-
- Blog
-
-
-
- You can control who can view and edit your item using the list below.
-
-
-
-
+ Blog
+
+
+
+ You can control who can view and edit your item using the list below.
+
+
-
-
-
-
-
+
+
-
-
-
- Name
-
-
- Can add
-
-
-
-
-
+ Name
+
+
+ Can add
+
+
+
+
-
-
+
+
+ John Doe
+ (john-doe)
+
+
-
- John Doe
- (john-doe)
-
-
-
-
-
-
+
+
+
+
+ By default, permissions from the container of this item are inherited. If you disable this, only the explicitly defined sharing permissions will be valid. In the overview, the symbol
+
+ indicates an inherited value. Similarly, the symbol
+
+ indicates a global role, which is managed by the site administrator.
+
-
- By default, permissions from the container of this item are inherited. If you disable this, only the explicitly defined sharing permissions will be valid. In the overview, the symbol
-
- indicates an inherited value. Similarly, the symbol
-
- indicates a global role, which is managed by the site administrator.
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+ id="toolbar"
+ >
+
+
`;
diff --git a/packages/volto/src/components/manage/Sidebar/ObjectBrowser.jsx b/packages/volto/src/components/manage/Sidebar/ObjectBrowser.jsx
index 0a31dcd486..a509550b95 100644
--- a/packages/volto/src/components/manage/Sidebar/ObjectBrowser.jsx
+++ b/packages/volto/src/components/manage/Sidebar/ObjectBrowser.jsx
@@ -98,7 +98,7 @@ const withObjectBrowser = (WrappedComponent) =>
{
panes={[
!!documentTab && {
menuItem: {
+ key: 'documentTab',
as: 'button',
className: 'ui button',
content: type || intl.formatMessage(messages.document),
@@ -152,6 +153,7 @@ const Sidebar = (props) => {
},
!!blockTab && {
menuItem: {
+ key: 'blockTab',
as: 'button',
className: 'ui button',
content: intl.formatMessage(messages.block),
diff --git a/packages/volto/src/components/manage/Sidebar/SidebarPopup.jsx b/packages/volto/src/components/manage/Sidebar/SidebarPopup.jsx
index 14cd922a1f..58d6897fc3 100644
--- a/packages/volto/src/components/manage/Sidebar/SidebarPopup.jsx
+++ b/packages/volto/src/components/manage/Sidebar/SidebarPopup.jsx
@@ -1,5 +1,5 @@
import React from 'react';
-import { Portal } from 'react-portal';
+import { createPortal } from 'react-dom';
import { CSSTransition } from 'react-transition-group';
import PropTypes from 'prop-types';
import { doesNodeContainClick } from 'semantic-ui-react/dist/commonjs/lib';
@@ -32,9 +32,13 @@ const SidebarPopup = (props) => {
classNames="overlay-container"
unmountOnExit
>
-
-
-
+ <>
+ {document?.body &&
+ createPortal(
+
,
+ document?.body,
+ )}
+ >
)}
{
classNames="sidebar-container"
unmountOnExit
>
-
- {
- e.stopPropagation();
- }}
- onKeyDown={(e) => {
- e.stopPropagation();
- }}
- ref={asideElement}
- key="sidebarpopup"
- className="sidebar-container"
- style={{ overflowY: 'auto' }}
- >
- {children}
-
-
+ <>
+ {createPortal(
+ {
+ e.stopPropagation();
+ }}
+ onKeyDown={(e) => {
+ e.stopPropagation();
+ }}
+ ref={asideElement}
+ key="sidebarpopup"
+ className="sidebar-container"
+ style={{ overflowY: 'auto' }}
+ >
+ {children}
+ ,
+ document.body,
+ )}
+ >
>
);
diff --git a/packages/volto/src/components/manage/Sidebar/SidebarPortal.jsx b/packages/volto/src/components/manage/Sidebar/SidebarPortal.jsx
index c99cb92fef..f77b80c2a7 100644
--- a/packages/volto/src/components/manage/Sidebar/SidebarPortal.jsx
+++ b/packages/volto/src/components/manage/Sidebar/SidebarPortal.jsx
@@ -1,6 +1,6 @@
import React from 'react';
import PropTypes from 'prop-types';
-import { Portal } from 'react-portal';
+import { createPortal } from 'react-dom';
/**
* Portal that wraps Sidebar components
@@ -16,8 +16,9 @@ const SidebarPortal = ({ children, selected, tab = 'sidebar-properties' }) => {
return (
<>
- {selected && (
-
+ {isClient &&
+ selected &&
+ createPortal(
-
- )}
+ ,
+ document.getElementById(tab),
+ )}
>
);
};
diff --git a/packages/volto/src/components/manage/Sidebar/__snapshots__/SidebarPopup.test.jsx.snap b/packages/volto/src/components/manage/Sidebar/__snapshots__/SidebarPopup.test.jsx.snap
index 6d383e2cda..8144871def 100644
--- a/packages/volto/src/components/manage/Sidebar/__snapshots__/SidebarPopup.test.jsx.snap
+++ b/packages/volto/src/components/manage/Sidebar/__snapshots__/SidebarPopup.test.jsx.snap
@@ -8,23 +8,29 @@ exports[`sidebar popup is not rendered when the block is not selected 1`] = `
timeout={500}
unmountOnExit={true}
>
-
-
+ >
+
+ Tested, but you shouldn't see this in the snapshot!
+
+ ,
+ "containerInfo": ,
+ "implementation": null,
+ "key": null,
+ }
+
`;
@@ -37,23 +43,29 @@ exports[`sidebar popup is rendered when the block is selected 1`] = `
timeout={500}
unmountOnExit={true}
>
-
-
+ Object {
+ "$$typeof": Symbol(react.portal),
+ "children":
-
+ >
+
+ Tested!
+
+ ,
+ "containerInfo": ,
+ "implementation": null,
+ "key": null,
+ }
+
`;
diff --git a/packages/volto/src/components/manage/Sidebar/__snapshots__/SidebarPortal.test.jsx.snap b/packages/volto/src/components/manage/Sidebar/__snapshots__/SidebarPortal.test.jsx.snap
index d90ec6d71b..8ef45208d7 100644
--- a/packages/volto/src/components/manage/Sidebar/__snapshots__/SidebarPortal.test.jsx.snap
+++ b/packages/volto/src/components/manage/Sidebar/__snapshots__/SidebarPortal.test.jsx.snap
@@ -2,34 +2,4 @@
exports[`sidebar portal is not rendered when the block is not selected 1`] = ` `;
-exports[`sidebar portal is rendered when the block is selected 1`] = `
-
-
-
-
-
-`;
+exports[`sidebar portal is rendered when the block is selected 1`] = ` `;
diff --git a/packages/volto/src/components/manage/Widgets/FileWidget.jsx b/packages/volto/src/components/manage/Widgets/FileWidget.jsx
index 34db736933..b168d37d43 100644
--- a/packages/volto/src/components/manage/Widgets/FileWidget.jsx
+++ b/packages/volto/src/components/manage/Widgets/FileWidget.jsx
@@ -112,7 +112,7 @@ const FileWidget = (props) => {
if (imageMimetypes.includes(fields[1])) {
setFileType(true);
let imagePreview = document.getElementById(`field-${id}-image`);
- imagePreview.src = reader.result;
+ if (imagePreview) imagePreview.src = reader.result;
} else {
setFileType(false);
}
diff --git a/packages/volto/src/components/manage/Widgets/ObjectBrowserWidget.test.jsx b/packages/volto/src/components/manage/Widgets/ObjectBrowserWidget.test.jsx
index 70e1a4a53b..2783a93d5a 100644
--- a/packages/volto/src/components/manage/Widgets/ObjectBrowserWidget.test.jsx
+++ b/packages/volto/src/components/manage/Widgets/ObjectBrowserWidget.test.jsx
@@ -1,5 +1,5 @@
import React from 'react';
-import renderer from 'react-test-renderer';
+import { render } from '@testing-library/react';
import configureStore from 'redux-mock-store';
import { Provider } from 'react-intl-redux';
import ObjectBrowserWidget from './ObjectBrowserWidget';
@@ -14,7 +14,7 @@ test('renders a objectBrowser widget component', () => {
messages: {},
},
});
- const component = renderer.create(
+ const { container } = render(
{
,
);
- const json = component.toJSON();
- expect(json).toMatchSnapshot();
+
+ expect(container).toMatchSnapshot();
});
diff --git a/packages/volto/src/components/manage/Widgets/ObjectListWidget.test.js b/packages/volto/src/components/manage/Widgets/ObjectListWidget.test.js
index 161549dee1..8332bf129d 100644
--- a/packages/volto/src/components/manage/Widgets/ObjectListWidget.test.js
+++ b/packages/volto/src/components/manage/Widgets/ObjectListWidget.test.js
@@ -2,7 +2,6 @@ import React from 'react';
import { Provider } from 'react-intl-redux';
import { render } from '@testing-library/react';
import configureStore from 'redux-mock-store';
-import '@testing-library/jest-dom/extend-expect';
import ObjectListWidget from './ObjectListWidget';
jest.mock('@plone/volto/helpers/Loadable/Loadable');
diff --git a/packages/volto/src/components/manage/Widgets/ObjectWidget.test.jsx b/packages/volto/src/components/manage/Widgets/ObjectWidget.test.jsx
index b182d3f2bc..6f0d2d9e22 100644
--- a/packages/volto/src/components/manage/Widgets/ObjectWidget.test.jsx
+++ b/packages/volto/src/components/manage/Widgets/ObjectWidget.test.jsx
@@ -3,7 +3,6 @@ import renderer from 'react-test-renderer';
import configureStore from 'redux-mock-store';
import { Provider } from 'react-intl-redux';
import { render, fireEvent } from '@testing-library/react';
-import '@testing-library/jest-dom/extend-expect';
import ObjectWidget from './ObjectWidget';
const mockStore = configureStore();
diff --git a/packages/volto/src/components/manage/Widgets/SchemaWidget.test.jsx b/packages/volto/src/components/manage/Widgets/SchemaWidget.test.jsx
index 44b19cc1a0..4ded955e95 100644
--- a/packages/volto/src/components/manage/Widgets/SchemaWidget.test.jsx
+++ b/packages/volto/src/components/manage/Widgets/SchemaWidget.test.jsx
@@ -1,5 +1,5 @@
import React from 'react';
-import renderer from 'react-test-renderer';
+import { render } from '@testing-library/react';
import configureStore from 'redux-mock-store';
import { Provider } from 'react-intl-redux';
@@ -21,7 +21,7 @@ test('renders a schema widget component', () => {
},
});
- const component = renderer.create(
+ const { container } = render(
{
/>
,
);
- const json = component.toJSON();
- expect(json).toMatchSnapshot();
+
+ expect(container).toMatchSnapshot();
});
diff --git a/packages/volto/src/components/manage/Widgets/SchemaWidgetFieldset.test.jsx b/packages/volto/src/components/manage/Widgets/SchemaWidgetFieldset.test.jsx
index 95af6d1e0c..62667d8373 100644
--- a/packages/volto/src/components/manage/Widgets/SchemaWidgetFieldset.test.jsx
+++ b/packages/volto/src/components/manage/Widgets/SchemaWidgetFieldset.test.jsx
@@ -1,6 +1,6 @@
import React from 'react';
import { DragDropContext, Droppable } from 'react-beautiful-dnd';
-import renderer from 'react-test-renderer';
+import { render } from '@testing-library/react';
import SchemaWidgetFieldsetComponent from './SchemaWidgetFieldset';
jest.mock('@plone/volto/helpers/Loadable/Loadable');
@@ -10,7 +10,7 @@ beforeAll(
);
test('renders a contents item component', () => {
- const component = renderer.create(
+ const { container } = render(
x}>
{(provided, snapshot) => (
@@ -28,7 +28,7 @@ test('renders a contents item component', () => {
onShowEditFieldset={(x) => x}
onShowDeleteFieldset={(x) => x}
onClick={(x) => x}
- getItemStyle={(x) => x}
+ getItemStyle={(x) => ({})}
isDraggable={false}
isDisabled={false}
/>
@@ -38,6 +38,6 @@ test('renders a contents item component', () => {
,
);
- const json = component.toJSON();
- expect(json).toMatchSnapshot();
+
+ expect(container).toMatchSnapshot();
});
diff --git a/packages/volto/src/components/manage/Widgets/UrlWidget.test.jsx b/packages/volto/src/components/manage/Widgets/UrlWidget.test.jsx
index e9625d4f3f..35dfe39c35 100644
--- a/packages/volto/src/components/manage/Widgets/UrlWidget.test.jsx
+++ b/packages/volto/src/components/manage/Widgets/UrlWidget.test.jsx
@@ -1,5 +1,5 @@
import React from 'react';
-import renderer from 'react-test-renderer';
+import { render } from '@testing-library/react';
import configureStore from 'redux-mock-store';
import { Provider } from 'react-intl-redux';
@@ -15,7 +15,7 @@ test('renders an url widget component', () => {
},
});
- const component = renderer.create(
+ const { container } = render(
{
/>
,
);
- const json = component.toJSON();
- expect(json).toMatchSnapshot();
+
+ expect(container).toMatchSnapshot();
});
diff --git a/packages/volto/src/components/manage/Widgets/VocabularyTermsWidget.test.jsx b/packages/volto/src/components/manage/Widgets/VocabularyTermsWidget.test.jsx
index 1d505fbe27..32e5ff4008 100644
--- a/packages/volto/src/components/manage/Widgets/VocabularyTermsWidget.test.jsx
+++ b/packages/volto/src/components/manage/Widgets/VocabularyTermsWidget.test.jsx
@@ -1,5 +1,5 @@
import React from 'react';
-import renderer from 'react-test-renderer';
+import { render } from '@testing-library/react';
import configureStore from 'redux-mock-store';
import { Provider } from 'react-intl-redux';
@@ -55,7 +55,7 @@ test('renders a dictionary widget component', () => {
},
],
};
- const component = renderer.create(
+ const { container } = render(
{
/>
,
);
- const json = component.toJSON();
- expect(json).toMatchSnapshot();
+
+ expect(container).toMatchSnapshot();
});
diff --git a/packages/volto/src/components/manage/Widgets/__snapshots__/ArrayWidget.test.jsx.snap b/packages/volto/src/components/manage/Widgets/__snapshots__/ArrayWidget.test.jsx.snap
index a5b5ac4d20..5a9dbbe75c 100644
--- a/packages/volto/src/components/manage/Widgets/__snapshots__/ArrayWidget.test.jsx.snap
+++ b/packages/volto/src/components/manage/Widgets/__snapshots__/ArrayWidget.test.jsx.snap
@@ -251,9 +251,7 @@ exports[`renders an array widget component 1`] = `
"whiteSpace": "pre",
}
}
- >
-
-
+ />
diff --git a/packages/volto/src/components/manage/Widgets/__snapshots__/ObjectBrowserWidget.test.jsx.snap b/packages/volto/src/components/manage/Widgets/__snapshots__/ObjectBrowserWidget.test.jsx.snap
index 0b08cefc6c..5704b6974f 100644
--- a/packages/volto/src/components/manage/Widgets/__snapshots__/ObjectBrowserWidget.test.jsx.snap
+++ b/packages/volto/src/components/manage/Widgets/__snapshots__/ObjectBrowserWidget.test.jsx.snap
@@ -1,74 +1,60 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`renders a objectBrowser widget component 1`] = `
-
+
-
- My field
-
+
+ My field
+
+
-
-
- No items selected
+
+ No items selected
+
+
+
+
-
-
-
-
diff --git a/packages/volto/src/components/manage/Widgets/__snapshots__/SchemaWidget.test.jsx.snap b/packages/volto/src/components/manage/Widgets/__snapshots__/SchemaWidget.test.jsx.snap
index 4ff936138b..0f8e642ef6 100644
--- a/packages/volto/src/components/manage/Widgets/__snapshots__/SchemaWidget.test.jsx.snap
+++ b/packages/volto/src/components/manage/Widgets/__snapshots__/SchemaWidget.test.jsx.snap
@@ -2,130 +2,99 @@
exports[`renders a schema widget component 1`] = `
-
+
-
-
+ style="background: transparent;"
+ />
-
- Add field
-
-
-
-
+ Add field
+
+
+
-
-
+
+
+
+
diff --git a/packages/volto/src/components/manage/Widgets/__snapshots__/SchemaWidgetFieldset.test.jsx.snap b/packages/volto/src/components/manage/Widgets/__snapshots__/SchemaWidgetFieldset.test.jsx.snap
index 2ef48dc97a..6b64777f79 100644
--- a/packages/volto/src/components/manage/Widgets/__snapshots__/SchemaWidgetFieldset.test.jsx.snap
+++ b/packages/volto/src/components/manage/Widgets/__snapshots__/SchemaWidgetFieldset.test.jsx.snap
@@ -1,39 +1,34 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`renders a contents item component 1`] = `
-
`;
diff --git a/packages/volto/src/components/manage/Widgets/__snapshots__/TokenWidget.test.jsx.snap b/packages/volto/src/components/manage/Widgets/__snapshots__/TokenWidget.test.jsx.snap
index 3040534bdf..2d2d3857df 100644
--- a/packages/volto/src/components/manage/Widgets/__snapshots__/TokenWidget.test.jsx.snap
+++ b/packages/volto/src/components/manage/Widgets/__snapshots__/TokenWidget.test.jsx.snap
@@ -103,9 +103,7 @@ exports[`renders a token widget component 1`] = `
"whiteSpace": "pre",
}
}
- >
-
-
+ />
diff --git a/packages/volto/src/components/manage/Widgets/__snapshots__/UrlWidget.test.jsx.snap b/packages/volto/src/components/manage/Widgets/__snapshots__/UrlWidget.test.jsx.snap
index 3695fbc0c9..7b3e2e5222 100644
--- a/packages/volto/src/components/manage/Widgets/__snapshots__/UrlWidget.test.jsx.snap
+++ b/packages/volto/src/components/manage/Widgets/__snapshots__/UrlWidget.test.jsx.snap
@@ -1,77 +1,61 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`renders an url widget component 1`] = `
-
+
-
- My Url
-
+
+ My Url
+
+
-
-
diff --git a/packages/volto/src/components/manage/Widgets/__snapshots__/VocabularyTermsWidget.test.jsx.snap b/packages/volto/src/components/manage/Widgets/__snapshots__/VocabularyTermsWidget.test.jsx.snap
index 7fbf01c87a..1874373aa8 100644
--- a/packages/volto/src/components/manage/Widgets/__snapshots__/VocabularyTermsWidget.test.jsx.snap
+++ b/packages/volto/src/components/manage/Widgets/__snapshots__/VocabularyTermsWidget.test.jsx.snap
@@ -1,386 +1,257 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`renders a dictionary widget component 1`] = `
-
+
@@ -108,11 +100,8 @@ exports[`ContextNavigation renders a navigation component with an active item wh
href="/folder2/folder21"
title=""
>
-
Folder21
-
-
-
Doc211
-
-
-
@@ -167,11 +151,7 @@ exports[`ContextNavigation renders a navigation component with an active item wh
`;
-exports[`ContextNavigation renders a navigation component with only one active item even if there are similar item names 1`] = `
-
-
-
-`;
+exports[`ContextNavigation renders a navigation component with only one active item even if there are similar item names 1`] = `
`;
exports[`ContextNavigation renders a navigation slot component without active items 1`] = `
@@ -198,11 +178,8 @@ exports[`ContextNavigation renders a navigation slot component without active it
class="contenttype-undefined"
href="/front-page"
>
-
Welcome to Plone!
-
-
-
Blog
-
-
-
Users
-
-
diff --git a/packages/volto/src/components/theme/Pagination/__snapshots__/Pagination.test.jsx.snap b/packages/volto/src/components/theme/Pagination/__snapshots__/Pagination.test.jsx.snap
index d7816b0a8e..70e8398a6f 100644
--- a/packages/volto/src/components/theme/Pagination/__snapshots__/Pagination.test.jsx.snap
+++ b/packages/volto/src/components/theme/Pagination/__snapshots__/Pagination.test.jsx.snap
@@ -30,7 +30,6 @@ exports[`Pagination renders no pagination when only 1 page 1`] = `
viewBox=""
xmlns=""
/>
-
-
-
-
diff --git a/packages/volto/src/components/theme/Search/Search.jsx b/packages/volto/src/components/theme/Search/Search.jsx
index e6d0341662..e5b9c17e74 100644
--- a/packages/volto/src/components/theme/Search/Search.jsx
+++ b/packages/volto/src/components/theme/Search/Search.jsx
@@ -10,7 +10,7 @@ import { compose } from 'redux';
import { UniversalLink } from '@plone/volto/components';
import { asyncConnect } from '@plone/volto/helpers';
import { FormattedMessage } from 'react-intl';
-import { Portal } from 'react-portal';
+import { createPortal } from 'react-dom';
import { Container, Pagination, Button, Header } from 'semantic-ui-react';
import qs from 'query-string';
import classNames from 'classnames';
@@ -309,15 +309,15 @@ class Search extends Component {
- {this.state.isClient && (
-
+ {this.state.isClient &&
+ createPortal(
}
- />
-
- )}
+ />,
+ document.getElementById('toolbar'),
+ )}
);
}
diff --git a/packages/volto/src/components/theme/Search/Search.test.jsx b/packages/volto/src/components/theme/Search/Search.test.jsx
index b5d2416169..86a5a6cb00 100644
--- a/packages/volto/src/components/theme/Search/Search.test.jsx
+++ b/packages/volto/src/components/theme/Search/Search.test.jsx
@@ -1,5 +1,5 @@
import React from 'react';
-import renderer from 'react-test-renderer';
+import { render } from '@testing-library/react';
import configureStore from 'redux-mock-store';
import { Provider } from 'react-intl-redux';
import { MemoryRouter } from 'react-router-dom';
@@ -8,9 +8,10 @@ import { __test__ as Search } from './Search';
const mockStore = configureStore();
-jest.mock('react-portal', () => ({
- Portal: jest.fn(() =>
),
-}));
+jest.mock('../../manage/Toolbar/Toolbar', () =>
+ jest.fn(() =>
),
+);
+
jest.mock('./SearchTags', () => jest.fn(() =>
));
describe('Search', () => {
@@ -27,15 +28,16 @@ describe('Search', () => {
const history = {
location: { pathname: '/blog', search: '?SearchableText=blog' },
};
- const component = renderer.create(
+ const { container } = render(
+
,
);
- const json = component.toJSON();
- expect(json).toMatchSnapshot();
+
+ expect(container).toMatchSnapshot();
});
it('renders a search component', () => {
@@ -59,14 +61,15 @@ describe('Search', () => {
const history = {
location: { pathname: '/blog', search: '?SearchableText=blog' },
};
- const component = renderer.create(
+ const { container } = render(
+
,
);
- const json = component.toJSON();
- expect(json).toMatchSnapshot();
+
+ expect(container).toMatchSnapshot();
});
});
diff --git a/packages/volto/src/components/theme/Search/__snapshots__/Search.test.jsx.snap b/packages/volto/src/components/theme/Search/__snapshots__/Search.test.jsx.snap
index c65a7fb602..3f2a0de48f 100644
--- a/packages/volto/src/components/theme/Search/__snapshots__/Search.test.jsx.snap
+++ b/packages/volto/src/components/theme/Search/__snapshots__/Search.test.jsx.snap
@@ -1,120 +1,126 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Search renders a search component 1`] = `
-
+
-
-
-
- Search results for
-
- blog
-
-
-
-
- No results found
-
-
-
-
-
+ Search results for
+
+ blog
+
+
-
- My blog
-
+ id="search-tags"
+ />
+
+ No results found
-
-
-
-
-
+
+ Blog
+
+
+
+
+ My blog
+
+
+
+
+
+
+
+
+ id="toolbar"
+ >
+
+
`;
exports[`Search renders an empty search component 1`] = `
-
+
-
-
-
- Search results for
-
- blog
-
-
-
+ id="toolbar"
+ >
+
+
`;
diff --git a/packages/volto/src/components/theme/SlotRenderer/SlotRenderer.test.jsx b/packages/volto/src/components/theme/SlotRenderer/SlotRenderer.test.jsx
index 0f09535e5a..ac915dee89 100644
--- a/packages/volto/src/components/theme/SlotRenderer/SlotRenderer.test.jsx
+++ b/packages/volto/src/components/theme/SlotRenderer/SlotRenderer.test.jsx
@@ -1,5 +1,4 @@
import React from 'react';
-import '@testing-library/jest-dom/extend-expect';
import { render } from '@testing-library/react';
import { MemoryRouter } from 'react-router-dom';
import SlotRenderer from './SlotRenderer';
diff --git a/packages/volto/src/components/theme/View/View.jsx b/packages/volto/src/components/theme/View/View.jsx
index ae9d97b53b..418897e5f0 100644
--- a/packages/volto/src/components/theme/View/View.jsx
+++ b/packages/volto/src/components/theme/View/View.jsx
@@ -8,7 +8,7 @@ import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { compose } from 'redux';
import { Redirect } from 'react-router-dom';
-import { Portal } from 'react-portal';
+import { createPortal } from 'react-dom';
import { injectIntl } from 'react-intl';
import qs from 'query-string';
@@ -269,11 +269,11 @@ class View extends Component {
{this.props.content.allow_discussion && (
)}
- {this.state.isClient && (
-
- } />
-
- )}
+ {this.state.isClient &&
+ createPortal(
+ } />,
+ document.getElementById('toolbar'),
+ )}
);
}
diff --git a/packages/volto/src/components/theme/View/View.test.jsx b/packages/volto/src/components/theme/View/View.test.jsx
index 0fd4580099..0ecb074695 100644
--- a/packages/volto/src/components/theme/View/View.test.jsx
+++ b/packages/volto/src/components/theme/View/View.test.jsx
@@ -1,5 +1,5 @@
import React, { useEffect } from 'react';
-import renderer from 'react-test-renderer';
+import { render } from '@testing-library/react';
import configureStore from 'redux-mock-store';
import { Provider } from 'react-intl-redux';
@@ -25,9 +25,10 @@ beforeAll(() => {
const mockStore = configureStore();
-jest.mock('react-portal', () => ({
- Portal: jest.fn(() =>
),
-}));
+jest.mock('../../manage/Toolbar/Toolbar', () =>
+ jest.fn(() =>
),
+);
+
jest.mock('../SocialSharing/SocialSharing', () =>
jest.fn(() =>
),
);
@@ -150,13 +151,14 @@ describe('View', () => {
messages: {},
},
});
- const component = renderer.create(
+ const { container } = render(
+
,
);
- const json = component.toJSON();
- expect(json).toMatchSnapshot();
+
+ expect(container).toMatchSnapshot();
});
it('renders a summary view', () => {
@@ -170,13 +172,14 @@ describe('View', () => {
messages: {},
},
});
- const component = renderer.create(
+ const { container } = render(
+
,
);
- const json = component.toJSON();
- expect(json).toMatchSnapshot();
+
+ expect(container).toMatchSnapshot();
});
it('renders a tabular view', () => {
@@ -190,13 +193,14 @@ describe('View', () => {
messages: {},
},
});
- const component = renderer.create(
+ const { container } = render(
+
,
);
- const json = component.toJSON();
- expect(json).toMatchSnapshot();
+
+ expect(container).toMatchSnapshot();
});
it('renders a document view', () => {
@@ -210,13 +214,14 @@ describe('View', () => {
messages: {},
},
});
- const component = renderer.create(
+ const { container } = render(
+
,
);
- const json = component.toJSON();
- expect(json).toMatchSnapshot();
+
+ expect(container).toMatchSnapshot();
});
it('renders a new view element if the @id changed', () => {
@@ -238,16 +243,18 @@ describe('View', () => {
messages: {},
},
});
- const component = renderer.create(
+ const { rerender } = render(
+
,
);
expect(instanceCount).toBe(1);
store.getState().content.data['@id'] = '/b';
- component.update(
+ rerender(
+
,
);
expect(instanceCount).toBe(2);
diff --git a/packages/volto/src/components/theme/View/__snapshots__/View.test.jsx.snap b/packages/volto/src/components/theme/View/__snapshots__/View.test.jsx.snap
index 49a539fd4e..6a915aa342 100644
--- a/packages/volto/src/components/theme/View/__snapshots__/View.test.jsx.snap
+++ b/packages/volto/src/components/theme/View/__snapshots__/View.test.jsx.snap
@@ -1,69 +1,94 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`View renders a document view 1`] = `
-
+
-
-
-
+ id="view"
+ >
+
+
+
+
+
+ id="toolbar"
+ >
+
+
`;
exports[`View renders a summary view 1`] = `
-
-
-
-
+
+ id="view"
+ >
+
+
+
+
+
+ id="toolbar"
+ >
+
+
`;
exports[`View renders a tabular view 1`] = `
-
+
+ id="view"
+ >
+
+
+
+
+
-
-
+ id="toolbar"
+ >
+
+
+
+`;
+
+exports[`View renders an empty view 1`] = `
+
`;
-
-exports[`View renders an empty view 1`] = ` `;
diff --git a/packages/volto/src/components/theme/Widgets/__snapshots__/ArrayWidget.test.js.snap b/packages/volto/src/components/theme/Widgets/__snapshots__/ArrayWidget.test.js.snap
index 5606114c33..14acae810a 100644
--- a/packages/volto/src/components/theme/Widgets/__snapshots__/ArrayWidget.test.js.snap
+++ b/packages/volto/src/components/theme/Widgets/__snapshots__/ArrayWidget.test.js.snap
@@ -4,7 +4,6 @@ exports[`ArrayWidget renders a full vocabulary array view widget component 1`] =
-
Foo
@@ -19,7 +18,6 @@ exports[`ArrayWidget renders a full vocabulary array view widget component with
-
Foo
@@ -38,7 +36,6 @@ exports[`ArrayWidget renders a simple array view widget component 1`] = `
-
foo
@@ -53,7 +50,6 @@ exports[`ArrayWidget renders a vocabulary array view widget component 1`] = `
-
Foo
@@ -64,4 +60,4 @@ exports[`ArrayWidget renders a vocabulary array view widget component 1`] = `
`;
-exports[`ArrayWidget renders an empty array view widget component 1`] = `""`;
+exports[`ArrayWidget renders an empty array view widget component 1`] = `null`;
diff --git a/packages/volto/src/components/theme/Widgets/__snapshots__/BooleanWidget.test.js.snap b/packages/volto/src/components/theme/Widgets/__snapshots__/BooleanWidget.test.js.snap
index 530cb8978b..6731e6cdbe 100644
--- a/packages/volto/src/components/theme/Widgets/__snapshots__/BooleanWidget.test.js.snap
+++ b/packages/volto/src/components/theme/Widgets/__snapshots__/BooleanWidget.test.js.snap
@@ -36,4 +36,4 @@ exports[`BooleanWidget renders a boolean true view widget component with childre
`;
-exports[`BooleanWidget renders an empty boolean view widget component 1`] = `""`;
+exports[`BooleanWidget renders an empty boolean view widget component 1`] = `null`;
diff --git a/packages/volto/src/components/theme/Widgets/__snapshots__/DateWidget.test.js.snap b/packages/volto/src/components/theme/Widgets/__snapshots__/DateWidget.test.js.snap
index 535c64414d..7dfb2d2935 100644
--- a/packages/volto/src/components/theme/Widgets/__snapshots__/DateWidget.test.js.snap
+++ b/packages/volto/src/components/theme/Widgets/__snapshots__/DateWidget.test.js.snap
@@ -26,4 +26,4 @@ exports[`DateWidget renders a date view widget component with children 1`] = `
`;
-exports[`DateWidget renders an empty date view widget component 1`] = `""`;
+exports[`DateWidget renders an empty date view widget component 1`] = `null`;
diff --git a/packages/volto/src/components/theme/Widgets/__snapshots__/DatetimeWidget.test.js.snap b/packages/volto/src/components/theme/Widgets/__snapshots__/DatetimeWidget.test.js.snap
index 86947ef154..6f97180b22 100644
--- a/packages/volto/src/components/theme/Widgets/__snapshots__/DatetimeWidget.test.js.snap
+++ b/packages/volto/src/components/theme/Widgets/__snapshots__/DatetimeWidget.test.js.snap
@@ -26,4 +26,4 @@ exports[`DatetimeWidget renders a date view widget component with children 1`] =
`;
-exports[`DatetimeWidget renders an empty date view widget component 1`] = `""`;
+exports[`DatetimeWidget renders an empty date view widget component 1`] = `null`;
diff --git a/packages/volto/src/components/theme/Widgets/__snapshots__/DescriptionWidget.test.js.snap b/packages/volto/src/components/theme/Widgets/__snapshots__/DescriptionWidget.test.js.snap
index 61e322ff75..e7b55c5f45 100644
--- a/packages/volto/src/components/theme/Widgets/__snapshots__/DescriptionWidget.test.js.snap
+++ b/packages/volto/src/components/theme/Widgets/__snapshots__/DescriptionWidget.test.js.snap
@@ -18,4 +18,4 @@ exports[`DescriptionWidget renders a description view widget component with chil
`;
-exports[`DescriptionWidget renders an empty description view widget component 1`] = `""`;
+exports[`DescriptionWidget renders an empty description view widget component 1`] = `null`;
diff --git a/packages/volto/src/components/theme/Widgets/__snapshots__/EmailWidget.test.js.snap b/packages/volto/src/components/theme/Widgets/__snapshots__/EmailWidget.test.js.snap
index 1a6eebaa10..e43bb4ed46 100644
--- a/packages/volto/src/components/theme/Widgets/__snapshots__/EmailWidget.test.js.snap
+++ b/packages/volto/src/components/theme/Widgets/__snapshots__/EmailWidget.test.js.snap
@@ -26,4 +26,4 @@ exports[`EmailWidget renders an email view widget component with children 1`] =
`;
-exports[`EmailWidget renders an empty email view widget component 1`] = `""`;
+exports[`EmailWidget renders an empty email view widget component 1`] = `null`;
diff --git a/packages/volto/src/components/theme/Widgets/__snapshots__/FileWidget.test.js.snap b/packages/volto/src/components/theme/Widgets/__snapshots__/FileWidget.test.js.snap
index f37b373c4d..c1ded79bd9 100644
--- a/packages/volto/src/components/theme/Widgets/__snapshots__/FileWidget.test.js.snap
+++ b/packages/volto/src/components/theme/Widgets/__snapshots__/FileWidget.test.js.snap
@@ -47,4 +47,4 @@ exports[`FileWidget renders a simple file view widget component 1`] = `
`;
-exports[`FileWidget renders an empty file view widget component 1`] = `""`;
+exports[`FileWidget renders an empty file view widget component 1`] = `null`;
diff --git a/packages/volto/src/components/theme/Widgets/__snapshots__/ImageWidget.test.js.snap b/packages/volto/src/components/theme/Widgets/__snapshots__/ImageWidget.test.js.snap
index 7d2e6d47ca..47437e40d1 100644
--- a/packages/volto/src/components/theme/Widgets/__snapshots__/ImageWidget.test.js.snap
+++ b/packages/volto/src/components/theme/Widgets/__snapshots__/ImageWidget.test.js.snap
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
-exports[`ImageWidget renders an empty image view widget component 1`] = `""`;
+exports[`ImageWidget renders an empty image view widget component 1`] = `null`;
exports[`ImageWidget renders an image view widget component 1`] = `
`;
-exports[`PasswordWidget renders an empty password view widget component 1`] = `""`;
+exports[`PasswordWidget renders an empty password view widget component 1`] = `null`;
diff --git a/packages/volto/src/components/theme/Widgets/__snapshots__/RelationWidget.test.js.snap b/packages/volto/src/components/theme/Widgets/__snapshots__/RelationWidget.test.js.snap
index d7c722318c..7fbf15d328 100644
--- a/packages/volto/src/components/theme/Widgets/__snapshots__/RelationWidget.test.js.snap
+++ b/packages/volto/src/components/theme/Widgets/__snapshots__/RelationWidget.test.js.snap
@@ -92,4 +92,4 @@ exports[`RelationWidget renders a relation view widget component 1`] = `
`;
-exports[`RelationWidget renders an empty relation view widget component 1`] = `""`;
+exports[`RelationWidget renders an empty relation view widget component 1`] = `null`;
diff --git a/packages/volto/src/components/theme/Widgets/__snapshots__/RelationsWidget.test.js.snap b/packages/volto/src/components/theme/Widgets/__snapshots__/RelationsWidget.test.js.snap
index 4b2b53ac47..7f5a2f0070 100644
--- a/packages/volto/src/components/theme/Widgets/__snapshots__/RelationsWidget.test.js.snap
+++ b/packages/volto/src/components/theme/Widgets/__snapshots__/RelationsWidget.test.js.snap
@@ -264,4 +264,4 @@ exports[`RelationsWidget renders a vocabulary relations view widget component 1`
`;
-exports[`RelationsWidget renders an empty relations view widget component 1`] = `""`;
+exports[`RelationsWidget renders an empty relations view widget component 1`] = `null`;
diff --git a/packages/volto/src/components/theme/Widgets/__snapshots__/RichTextWidget.test.js.snap b/packages/volto/src/components/theme/Widgets/__snapshots__/RichTextWidget.test.js.snap
index 565d050626..00ea582f44 100644
--- a/packages/volto/src/components/theme/Widgets/__snapshots__/RichTextWidget.test.js.snap
+++ b/packages/volto/src/components/theme/Widgets/__snapshots__/RichTextWidget.test.js.snap
@@ -22,4 +22,4 @@ exports[`RichTextWidget renders a rich text view widget component with children
/>
`;
-exports[`RichTextWidget renders an empty rich text view widget component 1`] = `""`;
+exports[`RichTextWidget renders an empty rich text view widget component 1`] = `null`;
diff --git a/packages/volto/src/components/theme/Widgets/__snapshots__/SelectWidget.test.js.snap b/packages/volto/src/components/theme/Widgets/__snapshots__/SelectWidget.test.js.snap
index e5d9e555b6..dd913ad14c 100644
--- a/packages/volto/src/components/theme/Widgets/__snapshots__/SelectWidget.test.js.snap
+++ b/packages/volto/src/components/theme/Widgets/__snapshots__/SelectWidget.test.js.snap
@@ -26,4 +26,4 @@ exports[`SelectWidget renders a select view widget component 1`] = `
`;
-exports[`SelectWidget renders an empty select view widget component 1`] = `""`;
+exports[`SelectWidget renders an empty select view widget component 1`] = `null`;
diff --git a/packages/volto/src/components/theme/Widgets/__snapshots__/TextWidget.test.js.snap b/packages/volto/src/components/theme/Widgets/__snapshots__/TextWidget.test.js.snap
index 5129b795b8..35aab38e8d 100644
--- a/packages/volto/src/components/theme/Widgets/__snapshots__/TextWidget.test.js.snap
+++ b/packages/volto/src/components/theme/Widgets/__snapshots__/TextWidget.test.js.snap
@@ -28,4 +28,4 @@ exports[`TextWidget renders a text view widget component with children 1`] = `
`;
-exports[`TextWidget renders an empty text view widget component 1`] = `""`;
+exports[`TextWidget renders an empty text view widget component 1`] = `null`;
diff --git a/packages/volto/src/components/theme/Widgets/__snapshots__/TitleWidget.test.js.snap b/packages/volto/src/components/theme/Widgets/__snapshots__/TitleWidget.test.js.snap
index efd0541d37..c911ccadae 100644
--- a/packages/volto/src/components/theme/Widgets/__snapshots__/TitleWidget.test.js.snap
+++ b/packages/volto/src/components/theme/Widgets/__snapshots__/TitleWidget.test.js.snap
@@ -18,4 +18,4 @@ exports[`TitleWidget renders a title view widget component with children 1`] = `
`;
-exports[`TitleWidget renders an empty title view widget component 1`] = `""`;
+exports[`TitleWidget renders an empty title view widget component 1`] = `null`;
diff --git a/packages/volto/src/components/theme/Widgets/__snapshots__/TokenWidget.test.js.snap b/packages/volto/src/components/theme/Widgets/__snapshots__/TokenWidget.test.js.snap
index ca60a25602..c651a7a33e 100644
--- a/packages/volto/src/components/theme/Widgets/__snapshots__/TokenWidget.test.js.snap
+++ b/packages/volto/src/components/theme/Widgets/__snapshots__/TokenWidget.test.js.snap
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
-exports[`TokenWidget renders an empty tags view widget component 1`] = `""`;
+exports[`TokenWidget renders an empty tags view widget component 1`] = `null`;
exports[`TokenWidget renders tags view widget component 1`] = `
`;
-exports[`UrlWidget renders an empty URL view widget component 1`] = `""`;
+exports[`UrlWidget renders an empty URL view widget component 1`] = `null`;
diff --git a/packages/volto/src/helpers/AsyncConnect/AsyncConnect.test.js b/packages/volto/src/helpers/AsyncConnect/AsyncConnect.test.js
index 2b6a371334..fcf54dfa7c 100644
--- a/packages/volto/src/helpers/AsyncConnect/AsyncConnect.test.js
+++ b/packages/volto/src/helpers/AsyncConnect/AsyncConnect.test.js
@@ -12,8 +12,6 @@ import { AsyncConnectWithContext, AsyncConnect } from './AsyncConnect'; // , Asy
import { asyncConnect, loadOnServer } from './';
import { matchAllRoutes } from './utils';
-import '@testing-library/jest-dom/extend-expect';
-
describe(' ', () => {
const initialEmptyState = {
router: {
diff --git a/packages/volto/src/helpers/Html/__snapshots__/Html.test.jsx.snap b/packages/volto/src/helpers/Html/__snapshots__/Html.test.jsx.snap
index 08b1b54bbd..08d9709f22 100644
--- a/packages/volto/src/helpers/Html/__snapshots__/Html.test.jsx.snap
+++ b/packages/volto/src/helpers/Html/__snapshots__/Html.test.jsx.snap
@@ -8,11 +8,6 @@ exports[`Html renders a html component 1`] = `
-
-
-
-
-
-
-
-
-
-