From ad912d66a37809f01b4b8135883809a52540fcdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Dudak?= Date: Tue, 2 Jan 2024 15:29:15 +0100 Subject: [PATCH] [code-infra] Break package dependency cycle between @mui/material and @mui/icons-material (#40400) --- packages/mui-material/package.json | 1 - .../src/TabScrollButton/TabScrollButton.test.js | 6 ++++-- .../src/TablePagination/TablePagination.test.js | 16 ++++++++++++---- .../src/TableSortLabel/TableSortLabel.test.js | 4 +++- packages/mui-material/src/Tabs/Tabs.test.js | 6 ++++-- 5 files changed, 23 insertions(+), 10 deletions(-) diff --git a/packages/mui-material/package.json b/packages/mui-material/package.json index d2bcc245cee0ca..3b47e335ab25f9 100644 --- a/packages/mui-material/package.json +++ b/packages/mui-material/package.json @@ -58,7 +58,6 @@ "devDependencies": { "@mui-internal/babel-macros": "^1.0.0", "@mui-internal/test-utils": "^1.0.0", - "@mui/icons-material": "^5.15.2", "@mui/lab": "5.0.0-alpha.158", "@popperjs/core": "^2.11.8", "@rollup/plugin-replace": "^5.0.5", diff --git a/packages/mui-material/src/TabScrollButton/TabScrollButton.test.js b/packages/mui-material/src/TabScrollButton/TabScrollButton.test.js index 00aa3b267dffc7..5051a974f28e24 100644 --- a/packages/mui-material/src/TabScrollButton/TabScrollButton.test.js +++ b/packages/mui-material/src/TabScrollButton/TabScrollButton.test.js @@ -1,9 +1,11 @@ import * as React from 'react'; import { expect } from 'chai'; import { createRenderer, describeConformance } from '@mui-internal/test-utils'; -import ArrowBackIcon from '@mui/icons-material/ArrowBack'; -import ArrowForwardIcon from '@mui/icons-material/ArrowForward'; import TabScrollButton, { tabScrollButtonClasses as classes } from '@mui/material/TabScrollButton'; +import { createSvgIcon } from '@mui/material/utils'; + +const ArrowBackIcon = createSvgIcon(, 'ArrowBack'); +const ArrowForwardIcon = createSvgIcon(, 'ArrowForward'); describe('', () => { const defaultProps = { diff --git a/packages/mui-material/src/TablePagination/TablePagination.test.js b/packages/mui-material/src/TablePagination/TablePagination.test.js index 975ecaa6c83a31..a54a01d13f4d15 100644 --- a/packages/mui-material/src/TablePagination/TablePagination.test.js +++ b/packages/mui-material/src/TablePagination/TablePagination.test.js @@ -12,10 +12,18 @@ import { outlinedInputClasses } from '@mui/material/OutlinedInput'; import { filledInputClasses } from '@mui/material/FilledInput'; import IconButton, { iconButtonClasses } from '@mui/material/IconButton'; import { svgIconClasses } from '@mui/material/SvgIcon'; -import ArrowBackIcon from '@mui/icons-material/ArrowBack'; -import ArrowForwardIcon from '@mui/icons-material/ArrowForward'; -import KeyboardDoubleArrowLeftRoundedIcon from '@mui/icons-material/KeyboardDoubleArrowLeftRounded'; -import KeyboardDoubleArrowRightRoundedIcon from '@mui/icons-material/KeyboardDoubleArrowRightRounded'; +import { createSvgIcon } from '@mui/material/utils'; + +const ArrowBackIcon = createSvgIcon(, 'ArrowBack'); +const ArrowForwardIcon = createSvgIcon(, 'ArrowForward'); +const KeyboardDoubleArrowLeftRoundedIcon = createSvgIcon( + , + 'KeyboardDoubleArrowLeftRounded', +); +const KeyboardDoubleArrowRightRoundedIcon = createSvgIcon( + , + 'KeyboardDoubleArrowRightRounded', +); describe('', () => { const noop = () => {}; diff --git a/packages/mui-material/src/TableSortLabel/TableSortLabel.test.js b/packages/mui-material/src/TableSortLabel/TableSortLabel.test.js index 74e4e0449a3f0e..90be63ef209d1d 100644 --- a/packages/mui-material/src/TableSortLabel/TableSortLabel.test.js +++ b/packages/mui-material/src/TableSortLabel/TableSortLabel.test.js @@ -1,9 +1,11 @@ import * as React from 'react'; import { expect } from 'chai'; import { createRenderer, describeConformance } from '@mui-internal/test-utils'; -import SortIcon from '@mui/icons-material/Sort'; import TableSortLabel, { tableSortLabelClasses as classes } from '@mui/material/TableSortLabel'; import ButtonBase from '@mui/material/ButtonBase'; +import { createSvgIcon } from '@mui/material/utils'; + +const SortIcon = createSvgIcon(, 'Sort'); describe('', () => { const { render } = createRenderer(); diff --git a/packages/mui-material/src/Tabs/Tabs.test.js b/packages/mui-material/src/Tabs/Tabs.test.js index da655ecff49149..6fe2d04b122c1b 100644 --- a/packages/mui-material/src/Tabs/Tabs.test.js +++ b/packages/mui-material/src/Tabs/Tabs.test.js @@ -10,14 +10,16 @@ import { strictModeDoubleLoggingSuppressed, waitFor, } from '@mui-internal/test-utils'; -import ArrowBackIcon from '@mui/icons-material/ArrowBack'; -import ArrowForwardIcon from '@mui/icons-material/ArrowForward'; import Tab from '@mui/material/Tab'; import Tabs, { tabsClasses as classes } from '@mui/material/Tabs'; import { svgIconClasses } from '@mui/material/SvgIcon'; import { createTheme, ThemeProvider } from '@mui/material/styles'; +import { createSvgIcon } from '@mui/material/utils'; import capitalize from '../utils/capitalize'; +const ArrowBackIcon = createSvgIcon(, 'ArrowBack'); +const ArrowForwardIcon = createSvgIcon(, 'ArrowForward'); + function findScrollButton(container, direction) { return container.querySelector(`svg[data-testid="KeyboardArrow${capitalize(direction)}Icon"]`); }