From ed26c3e535e9e29dbe72c35078044f9933b705fe Mon Sep 17 00:00:00 2001 From: Andrew Cherniavskyi Date: Tue, 13 Aug 2024 13:03:36 +0200 Subject: [PATCH] add comments --- packages-internal/test-utils/src/describeConformance.tsx | 1 + packages/mui-joy/src/styles/CssVarsProvider.test.tsx | 1 + packages/mui-joy/src/styles/extendTheme.test.js | 1 + packages/mui-material/src/styles/ThemeProvider.test.tsx | 1 + packages/mui-material/src/styles/ThemeProviderWithVars.test.js | 1 + packages/mui-material/src/styles/extendTheme.test.js | 1 + packages/mui-system/src/cssVars/createCssVarsProvider.test.js | 1 + packages/mui-system/src/cssVars/useCurrentColorScheme.test.js | 1 + test/integration/mui-system/theme-scoping.test.tsx | 1 + 9 files changed, 9 insertions(+) diff --git a/packages-internal/test-utils/src/describeConformance.tsx b/packages-internal/test-utils/src/describeConformance.tsx index 058b98b9ea1356..3c2177b299de8a 100644 --- a/packages-internal/test-utils/src/describeConformance.tsx +++ b/packages-internal/test-utils/src/describeConformance.tsx @@ -1034,6 +1034,7 @@ function describeConformance( }); window.matchMedia = () => ({ + // Keep mocking legacy methods because @mui/material v5 still uses them addListener: () => {}, addEventListener: () => {}, removeListener: () => {}, diff --git a/packages/mui-joy/src/styles/CssVarsProvider.test.tsx b/packages/mui-joy/src/styles/CssVarsProvider.test.tsx index 7052ba25d8f22b..9bb17ff8964bce 100644 --- a/packages/mui-joy/src/styles/CssVarsProvider.test.tsx +++ b/packages/mui-joy/src/styles/CssVarsProvider.test.tsx @@ -22,6 +22,7 @@ describe('[Joy] CssVarsProvider', () => { }); window.matchMedia = () => ({ + // Keep mocking legacy methods because @mui/material v5 still uses them addListener: () => {}, addEventListener: () => {}, removeListener: () => {}, diff --git a/packages/mui-joy/src/styles/extendTheme.test.js b/packages/mui-joy/src/styles/extendTheme.test.js index a9dd2878381e49..9bf3097075bac3 100644 --- a/packages/mui-joy/src/styles/extendTheme.test.js +++ b/packages/mui-joy/src/styles/extendTheme.test.js @@ -215,6 +215,7 @@ describe('extendTheme', () => { configurable: true, }); window.matchMedia = () => ({ + // Keep mocking legacy methods because older code might still use them addListener: () => {}, addEventListener: () => {}, removeListener: () => {}, diff --git a/packages/mui-material/src/styles/ThemeProvider.test.tsx b/packages/mui-material/src/styles/ThemeProvider.test.tsx index 2fa615a866455e..d21e01db663f23 100644 --- a/packages/mui-material/src/styles/ThemeProvider.test.tsx +++ b/packages/mui-material/src/styles/ThemeProvider.test.tsx @@ -23,6 +23,7 @@ describe('ThemeProvider', () => { }); window.matchMedia = () => ({ + // Keep mocking legacy methods because @mui/material v5 still uses them addListener: () => {}, addEventListener: () => {}, removeListener: () => {}, diff --git a/packages/mui-material/src/styles/ThemeProviderWithVars.test.js b/packages/mui-material/src/styles/ThemeProviderWithVars.test.js index 59726a9fa2df23..6311728b415ca3 100644 --- a/packages/mui-material/src/styles/ThemeProviderWithVars.test.js +++ b/packages/mui-material/src/styles/ThemeProviderWithVars.test.js @@ -22,6 +22,7 @@ describe('[Material UI] ThemeProviderWithVars', () => { configurable: true, }); window.matchMedia = () => ({ + // Keep mocking legacy methods because @mui/material v5 still uses them addListener: () => {}, addEventListener: () => {}, removeListener: () => {}, diff --git a/packages/mui-material/src/styles/extendTheme.test.js b/packages/mui-material/src/styles/extendTheme.test.js index ae2060a17bf56b..00bd6111455fce 100644 --- a/packages/mui-material/src/styles/extendTheme.test.js +++ b/packages/mui-material/src/styles/extendTheme.test.js @@ -24,6 +24,7 @@ describe('extendTheme', () => { configurable: true, }); window.matchMedia = () => ({ + // Keep mocking legacy methods because @mui/material v5 still uses them addListener: () => {}, addEventListener: () => {}, removeListener: () => {}, diff --git a/packages/mui-system/src/cssVars/createCssVarsProvider.test.js b/packages/mui-system/src/cssVars/createCssVarsProvider.test.js index ca78b76c8c83ef..4accde568ba8ca 100644 --- a/packages/mui-system/src/cssVars/createCssVarsProvider.test.js +++ b/packages/mui-system/src/cssVars/createCssVarsProvider.test.js @@ -17,6 +17,7 @@ describe('createCssVarsProvider', () => { let storage = {}; const createMatchMedia = (matches) => () => ({ matches, + // Keep mocking legacy methods because @mui/material v5 still uses them addListener: () => {}, addEventListener: () => {}, removeListener: () => {}, diff --git a/packages/mui-system/src/cssVars/useCurrentColorScheme.test.js b/packages/mui-system/src/cssVars/useCurrentColorScheme.test.js index b89237a811c04a..a0d75139ea55e6 100644 --- a/packages/mui-system/src/cssVars/useCurrentColorScheme.test.js +++ b/packages/mui-system/src/cssVars/useCurrentColorScheme.test.js @@ -18,6 +18,7 @@ describe('useCurrentColorScheme', () => { const createMatchMedia = (matches) => () => ({ matches, + // Keep mocking legacy methods because @mui/material v5 still uses them addListener: (listener) => { trigger = listener; }, diff --git a/test/integration/mui-system/theme-scoping.test.tsx b/test/integration/mui-system/theme-scoping.test.tsx index 00e7dcb5ca905c..fe8040c584e093 100644 --- a/test/integration/mui-system/theme-scoping.test.tsx +++ b/test/integration/mui-system/theme-scoping.test.tsx @@ -68,6 +68,7 @@ describe('Multiple nested theme providers', () => { let storage: Record = {}; const createMatchMedia = (matches: boolean) => () => ({ matches, + // Keep mocking legacy methods because @mui/material v5 still uses them addListener: () => {}, addEventListener: () => {}, removeListener: () => {},