diff --git a/collections/forms/i18n/en.pot b/collections/forms/i18n/en.pot
index fa82bdf6d..838734850 100644
--- a/collections/forms/i18n/en.pot
+++ b/collections/forms/i18n/en.pot
@@ -5,8 +5,8 @@ msgstr ""
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
-"POT-Creation-Date: 2024-11-04T09:32:49.754Z\n"
-"PO-Revision-Date: 2024-11-04T09:32:49.755Z\n"
+"POT-Creation-Date: 2024-11-07T00:44:30.575Z\n"
+"PO-Revision-Date: 2024-11-07T00:44:30.576Z\n"
msgid "Upload file"
msgstr "Upload file"
diff --git a/components/select/src/single-select-a11y/single-select-a11y.js b/components/select/src/single-select-a11y/single-select-a11y.js
index c92ee4686..e1170f9fe 100644
--- a/components/select/src/single-select-a11y/single-select-a11y.js
+++ b/components/select/src/single-select-a11y/single-select-a11y.js
@@ -55,38 +55,38 @@ export function SingleSelectA11y({
options,
idPrefix,
onChange,
- autoFocus,
- className,
- clearText,
- clearable,
- customOption,
- dataTest,
- dense,
- disabled,
- empty,
- error,
- filterHelpText,
- filterLabel,
- filterPlaceholder,
- filterValue,
- filterable,
- labelledBy,
- loading,
- menuLoadingText,
- menuMaxHeight,
- noMatchText,
- optionUpdateStrategy,
- placeholder,
- prefix,
- tabIndex,
- valid,
- value,
- warning,
- valueLabel: _valueLabel,
- onBlur,
- onEndReached,
- onFilterChange,
- onFocus,
+ autoFocus = false,
+ className = '',
+ clearText = '',
+ clearable = false,
+ customOption = undefined,
+ dataTest = 'dhis2-singleselecta11y',
+ dense = false,
+ disabled = false,
+ empty = false,
+ error = false,
+ filterHelpText = '',
+ filterLabel = '',
+ filterPlaceholder = '',
+ filterValue = '',
+ filterable = false,
+ labelledBy = '',
+ loading = false,
+ menuLoadingText = '',
+ menuMaxHeight = '288px',
+ noMatchText = '',
+ optionUpdateStrategy = 'polite',
+ placeholder = '',
+ prefix = '',
+ tabIndex = '0',
+ valid = false,
+ value = '',
+ warning = false,
+ valueLabel: _valueLabel = '',
+ onBlur = () => undefined,
+ onEndReached = () => undefined,
+ onFilterChange = () => undefined,
+ onFocus = () => undefined,
}) {
const comboBoxId = `${idPrefix}-combo`
const valueLabel =
@@ -263,40 +263,6 @@ export function SingleSelectA11y({
)
}
-SingleSelectA11y.defaultProps = {
- autoFocus: false,
- className: '',
- clearText: '',
- clearable: false,
- customOption: undefined,
- dataTest: 'dhis2-singleselecta11y',
- dense: false,
- disabled: false,
- empty: false,
- error: false,
- filterHelpText: '',
- filterLabel: '',
- filterPlaceholder: '',
- filterValue: '',
- filterable: false,
- labelledBy: '',
- loading: false,
- menuLoadingText: '',
- menuMaxHeight: '288px',
- noMatchText: '',
- optionUpdateStrategy: 'polite',
- placeholder: '',
- prefix: '',
- tabIndex: '0',
- valid: false,
- value: '',
- warning: false,
- valueLabel: '',
- onBlur: () => undefined,
- onFilterChange: () => undefined,
- onFocus: () => undefined,
-}
-
SingleSelectA11y.propTypes = {
/** necessary for IDs that are required for accessibility **/
idPrefix: PropTypes.string.isRequired,
diff --git a/components/select/src/single-select-a11y/single-select-a11y.test.js b/components/select/src/single-select-a11y/single-select-a11y.test.js
index 8b07a5818..253224fae 100644
--- a/components/select/src/single-select-a11y/single-select-a11y.test.js
+++ b/components/select/src/single-select-a11y/single-select-a11y.test.js
@@ -1,9 +1,31 @@
-import '@testing-library/jest-dom/extend-expect'
+import '@testing-library/jest-dom'
import { render, fireEvent, screen } from '@testing-library/react'
import React from 'react'
import { SingleSelectA11y } from './single-select-a11y.js'
describe('', () => {
+ beforeAll(() => {
+ const consoleError = console.error
+ jest.spyOn(console, 'error').mockImplementation((...args) => {
+ const [message, dynamicContent] = args
+
+ if (
+ message.startsWith(
+ 'Warning: An update to %s inside a test was not wrapped in act(...)'
+ ) &&
+ dynamicContent === 'Popper'
+ ) {
+ return
+ }
+
+ consoleError(...args)
+ })
+ })
+
+ afterAll(() => {
+ console.error.mockRestore()
+ })
+
it('should accept an onBlur handler', () => {
const onBlur = jest.fn()
@@ -124,7 +146,7 @@ describe('', () => {
fireEvent.click(screen.getByRole('combobox'))
const listbox = screen.getByRole('listbox')
- const menu = listbox.parentNode.parentNode
+ const menu = listbox.parentNode.parentNode.parentNode
expect(menu.style.maxHeight).toBe('100px')
})
@@ -398,47 +420,6 @@ describe('', () => {
expect(screen.getByLabelText('Custom filter label')).not.toBeNull()
})
- it('should not allow duplicate option values', () => {
- const onFilterChange = jest.fn()
- const consoleError = jest.fn()
-
- jest.spyOn(console, 'error').mockImplementation(consoleError)
-
- render(
-
- )
-
- fireEvent.click(screen.getByRole('combobox'))
-
- // @TODO: For some reason this is called three times
- // Is this because of unnecessary re-renders?
- expect(consoleError).toHaveBeenNthCalledWith(
- 1,
- expect.stringContaining(
- 'Encountered two children with the same key'
- ),
- 'foo',
- expect.anything()
- )
-
- console.error.mockRestore()
- })
-
it('should display the selected option', () => {
const onChange = jest.fn()
diff --git a/jest.config.js b/jest.config.js
index 3dceec90e..e5791ba44 100644
--- a/jest.config.js
+++ b/jest.config.js
@@ -1,6 +1,7 @@
module.exports = {
rootDir: '.',
setupFilesAfterEnv: [
+ '/jest.globals.config.js',
'/jest.enzyme.config.js',
'/jest.testing-library.config.js',
],
diff --git a/jest.config.shared.js b/jest.config.shared.js
index d890c2398..6e78c9c1c 100644
--- a/jest.config.shared.js
+++ b/jest.config.shared.js
@@ -1,5 +1,6 @@
module.exports = {
setupFilesAfterEnv: [
+ `${__dirname}/jest.globals.config.js`,
`${__dirname}/jest.enzyme.config.js`,
`${__dirname}/jest.testing-library.config.js`,
],
diff --git a/jest.globals.config.js b/jest.globals.config.js
new file mode 100644
index 000000000..1fed13495
--- /dev/null
+++ b/jest.globals.config.js
@@ -0,0 +1,11 @@
+/**
+ * IntersectionObserver
+ */
+
+window.IntersectionObserver =
+ global.IntersectionObserver = class IntersectionObserver {
+ observe() {}
+ unobserve() {}
+ disconnect() {}
+ takeRecords() {}
+ }
diff --git a/package.json b/package.json
index a9154c3ad..91dbd26c5 100644
--- a/package.json
+++ b/package.json
@@ -66,7 +66,7 @@
"@svgr/cli": "^5.5.0",
"@testing-library/cypress": "^8",
"@testing-library/dom": "^10.4.0",
- "@testing-library/jest-dom": "^6.6.2",
+ "@testing-library/jest-dom": "^6.6.3",
"@testing-library/react": "^16.0.1",
"@testing-library/react-hooks": "^7.0.1",
"@testing-library/user-event": "^14.5.2",
@@ -83,8 +83,8 @@
"rimraf": "^3.0.2",
"wait-on": "^6.0.0"
},
- "resolutions": {
- "react": "16.13.1",
- "react-dom": "16.13.1"
+ "overrides": {
+ "react": "$react",
+ "react-dom": "$react"
}
}
diff --git a/yarn.lock b/yarn.lock
index d1afe4a3d..aab1d00ed 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -4558,7 +4558,7 @@
lz-string "^1.5.0"
pretty-format "^27.0.2"
-"@testing-library/jest-dom@^6.6.2":
+"@testing-library/jest-dom@^6.6.3":
version "6.6.3"
resolved "https://registry.yarnpkg.com/@testing-library/jest-dom/-/jest-dom-6.6.3.tgz#26ba906cf928c0f8172e182c6fe214eb4f9f2bd2"
integrity sha512-IteBhl4XqYNkM54f4ejhLRJiZNqcSCoXUOG2CPK7qbD322KjQozM4kHQOfkG2oln9b9HTYqs+Sae8vBATubxxA==
@@ -15888,15 +15888,13 @@ react-docgen@^7.0.0:
resolve "^1.22.1"
strip-indent "^4.0.0"
-react-dom@16.13.1, "react-dom@^16.8.0 || ^17.0.0 || ^18.0.0", react-dom@^18, react-dom@^18.3.1:
- version "16.13.1"
- resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.13.1.tgz#c1bd37331a0486c078ee54c4740720993b2e0e7f"
- integrity sha512-81PIMmVLnCNLO/fFOQxdQkvEq/+Hfpv24XNJfpyZhTRfO0QcmQIF/PgCa1zCOj2w1hrn12MFLyaJ/G0+Mxtfag==
+"react-dom@^16.8.0 || ^17.0.0 || ^18.0.0", react-dom@^18, react-dom@^18.3.1:
+ version "18.3.1"
+ resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-18.3.1.tgz#c2265d79511b57d479b3dd3fdfa51536494c5cb4"
+ integrity sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==
dependencies:
loose-envify "^1.1.0"
- object-assign "^4.1.1"
- prop-types "^15.6.2"
- scheduler "^0.19.1"
+ scheduler "^0.23.2"
react-element-to-jsx-string@^15.0.0:
version "15.0.0"
@@ -16126,14 +16124,12 @@ react-textarea-autosize@^8.3.2:
use-composed-ref "^1.3.0"
use-latest "^1.2.1"
-react@16.13.1, "react@^16.8.0 || ^17.0.0 || ^18.0.0", react@^18, react@^18.3.1:
- version "16.13.1"
- resolved "https://registry.yarnpkg.com/react/-/react-16.13.1.tgz#2e818822f1a9743122c063d6410d85c1e3afe48e"
- integrity sha512-YMZQQq32xHLX0bz5Mnibv1/LHb3Sqzngu7xstSM+vrkE5Kzr9xE0yMByK5kMoTK30YVJE61WfbxIFFvfeDKT1w==
+"react@^16.8.0 || ^17.0.0 || ^18.0.0", react@^18, react@^18.3.1:
+ version "18.3.1"
+ resolved "https://registry.yarnpkg.com/react/-/react-18.3.1.tgz#49ab892009c53933625bd16b2533fc754cab2891"
+ integrity sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==
dependencies:
loose-envify "^1.1.0"
- object-assign "^4.1.1"
- prop-types "^15.6.2"
read-cache@^1.0.0:
version "1.0.0"
@@ -16924,14 +16920,6 @@ saxes@^5.0.1:
dependencies:
xmlchars "^2.2.0"
-scheduler@^0.19.1:
- version "0.19.1"
- resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.19.1.tgz#4f3e2ed2c1a7d65681f4c854fa8c5a1ccb40f196"
- integrity sha512-n/zwRWRYSUj0/3g/otKDRPMh6qv2SYMWNq85IEa8iZyAv8od9zDYpGSnpBEjNgcMNq6Scbu5KfIPxNF72R/2EA==
- dependencies:
- loose-envify "^1.1.0"
- object-assign "^4.1.1"
-
scheduler@^0.23.2:
version "0.23.2"
resolved "https://registry.npmjs.org/scheduler/-/scheduler-0.23.2.tgz"