From f918897301143e520340e55b7d203e6e2002032e Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 27 Feb 2024 21:06:25 +0000 Subject: [PATCH 1/3] Bump karma-webpack to ^5.0.1 --- package.json | 2 +- pnpm-lock.yaml | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 0c81bd3a3..7fcb075db 100644 --- a/package.json +++ b/package.json @@ -130,7 +130,7 @@ "karma-firefox-launcher": "^2.1.3", "karma-mocha": "^2.0.1", "karma-sourcemap-loader": "^0.4.0", - "karma-webpack": "5.0.0", + "karma-webpack": "^5.0.1", "lerna": "^8.1.2", "lodash": "^4.17.21", "markdownlint-cli2": "^0.13.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 62fa3934c..0ad008670 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -236,8 +236,8 @@ importers: specifier: ^0.4.0 version: 0.4.0 karma-webpack: - specifier: 5.0.0 - version: 5.0.0(webpack@5.91.0(webpack-cli@5.1.4)) + specifier: ^5.0.1 + version: 5.0.1(webpack@5.91.0(webpack-cli@5.1.4)) lerna: specifier: ^8.1.2 version: 8.1.2(encoding@0.1.13) @@ -5822,9 +5822,9 @@ packages: karma-sourcemap-loader@0.4.0: resolution: {integrity: sha512-xCRL3/pmhAYF3I6qOrcn0uhbQevitc2DERMPH82FMnG+4WReoGcGFZb1pURf2a5apyrOHRdvD+O6K7NljqKHyA==} - karma-webpack@5.0.0: - resolution: {integrity: sha512-+54i/cd3/piZuP3dr54+NcFeKOPnys5QeM1IY+0SPASwrtHsliXUiCL50iW+K9WWA7RvamC4macvvQ86l3KtaA==} - engines: {node: '>= 6'} + karma-webpack@5.0.1: + resolution: {integrity: sha512-oo38O+P3W2mSPCSUrQdySSPv1LvPpXP+f+bBimNomS5sW+1V4SuhCuW8TfJzV+rDv921w2fDSDw0xJbPe6U+kQ==} + engines: {node: '>= 18'} peerDependencies: webpack: ^5.0.0 @@ -14771,10 +14771,10 @@ snapshots: dependencies: graceful-fs: 4.2.11 - karma-webpack@5.0.0(webpack@5.91.0(webpack-cli@5.1.4)): + karma-webpack@5.0.1(webpack@5.91.0(webpack-cli@5.1.4)): dependencies: glob: 7.2.3 - minimatch: 3.1.2 + minimatch: 9.0.4 webpack: 5.91.0(webpack-cli@5.1.4) webpack-merge: 4.2.2 From 1c02ccaa0da760df6c576ee1a65207af3482b34f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Dudak?= Date: Tue, 27 Feb 2024 23:12:45 +0100 Subject: [PATCH 2/3] Fix Popper-related tests --- packages/mui-base/src/Menu/Menu.test.tsx | 8 +++++++- packages/mui-base/src/Popper/Popper.test.tsx | 16 ++++++++-------- .../mui-base/src/Unstable_Popup/Popup.test.tsx | 8 +++++++- 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/packages/mui-base/src/Menu/Menu.test.tsx b/packages/mui-base/src/Menu/Menu.test.tsx index 7b70e1486..d0feb3e18 100644 --- a/packages/mui-base/src/Menu/Menu.test.tsx +++ b/packages/mui-base/src/Menu/Menu.test.tsx @@ -17,6 +17,12 @@ import { Popper } from '@base_ui/react/Popper'; import { MenuProvider, useMenu } from '@base_ui/react/useMenu'; import { describeConformanceUnstyled } from '../../test/describeConformanceUnstyled'; +function createAnchor() { + const anchor = document.createElement('div'); + document.body.appendChild(anchor); + return anchor; +} + const testContext: DropdownContextValue = { dispatch: () => {}, popupId: 'menu-popup', @@ -158,7 +164,7 @@ describe('', () => { disabledItemsFocusable: false, }); - const anchorEl = triggerElement ?? document.createElement('div'); + const anchorEl = triggerElement ?? createAnchor(); return ( diff --git a/packages/mui-base/src/Popper/Popper.test.tsx b/packages/mui-base/src/Popper/Popper.test.tsx index 522823faa..ce469fa39 100644 --- a/packages/mui-base/src/Popper/Popper.test.tsx +++ b/packages/mui-base/src/Popper/Popper.test.tsx @@ -4,12 +4,18 @@ import { createRenderer, createMount, screen } from '@mui/internal-test-utils'; import { Popper, popperClasses } from '@base_ui/react/Popper'; import { describeConformanceUnstyled } from '../../test/describeConformanceUnstyled'; +function createAnchor() { + const anchor = document.createElement('div'); + document.body.appendChild(anchor); + return anchor; +} + describe('', () => { const { render } = createRenderer(); const mount = createMount(); const defaultProps = { - anchorEl: () => document.createElement('svg'), + anchorEl: () => createAnchor(), children: Hello World, open: true, }; @@ -35,13 +41,7 @@ describe('', () => { const CustomComponent = React.forwardRef(({ ownerState }, ref) => (
)); - render( - document.createElement('div')} - open - slots={{ root: CustomComponent }} - />, - ); + render( createAnchor()} open slots={{ root: CustomComponent }} />); expect(screen.getByTestId('foo')).to.not.have.attribute('id', 'id'); }); diff --git a/packages/mui-base/src/Unstable_Popup/Popup.test.tsx b/packages/mui-base/src/Unstable_Popup/Popup.test.tsx index 47a42515c..cc8ec842c 100644 --- a/packages/mui-base/src/Unstable_Popup/Popup.test.tsx +++ b/packages/mui-base/src/Unstable_Popup/Popup.test.tsx @@ -8,6 +8,12 @@ import { describeConformanceUnstyled } from '../../test/describeConformanceUnsty const TRANSITION_DURATION = 100; +function createAnchor() { + const anchor = document.createElement('div'); + document.body.appendChild(anchor); + return anchor; +} + function FakeTransition(props: React.PropsWithChildren<{}>) { const { children: transitionChildren } = props; const { requestedEnter, onExited } = useTransitionStateManager(); @@ -45,7 +51,7 @@ describe('', () => { } const defaultProps: PopupProps = { - anchor: () => document.createElement('div'), + anchor: () => createAnchor(), children: Hello World, open: true, }; From aaa1c6514c1e8a79f52a61305e609b2e6cb1501b Mon Sep 17 00:00:00 2001 From: ZeeshanTamboli Date: Sun, 5 May 2024 20:08:32 +0530 Subject: [PATCH 3/3] try out requestAnimationFrame in production --- .../mui-base/src/TextareaAutosize/TextareaAutosize.tsx | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/packages/mui-base/src/TextareaAutosize/TextareaAutosize.tsx b/packages/mui-base/src/TextareaAutosize/TextareaAutosize.tsx index a66407f98..e784719ee 100644 --- a/packages/mui-base/src/TextareaAutosize/TextareaAutosize.tsx +++ b/packages/mui-base/src/TextareaAutosize/TextareaAutosize.tsx @@ -139,10 +139,7 @@ const TextareaAutosize = React.forwardRef(function TextareaAutosize( const handleResize = () => { syncHeight(); }; - // Workaround a "ResizeObserver loop completed with undelivered notifications" error - // in test. - // Note that we might need to use this logic in production per https://github.com/WICG/resize-observer/issues/38 - // Also see https://github.com/mui/mui-x/issues/8733 + // Workaround a "ResizeObserver loop completed with undelivered notifications" error. let rAF: any; const rAFHandleResize = () => { cancelAnimationFrame(rAF); @@ -159,9 +156,7 @@ const TextareaAutosize = React.forwardRef(function TextareaAutosize( let resizeObserver: ResizeObserver; if (typeof ResizeObserver !== 'undefined') { - resizeObserver = new ResizeObserver( - process.env.NODE_ENV === 'test' ? rAFHandleResize : handleResize, - ); + resizeObserver = new ResizeObserver(rAFHandleResize); resizeObserver.observe(input); }