diff --git a/packages/mui-codemod/src/deprecations/button-group-classes/button-group-classes.js b/packages/mui-codemod/src/deprecations/button-group-classes/button-group-classes.js index 96fa3dd952e40a..dcb9eadc0c9308 100644 --- a/packages/mui-codemod/src/deprecations/button-group-classes/button-group-classes.js +++ b/packages/mui-codemod/src/deprecations/button-group-classes/button-group-classes.js @@ -106,11 +106,11 @@ export default function transformer(file, api, options) { }); }); - const selectorRegex = new RegExp(`^${replacementSelectorPrefix}${deprecatedClass}`); + const selectorRegex = `${replacementSelectorPrefix}${deprecatedClass}`; root .find( j.Literal, - (literal) => typeof literal.value === 'string' && literal.value.match(selectorRegex), + (literal) => typeof literal.value === 'string' && literal.value === selectorRegex, ) .forEach((path) => { path.replace( diff --git a/packages/mui-codemod/src/deprecations/button-group-classes/test-cases/expected.js b/packages/mui-codemod/src/deprecations/button-group-classes/test-cases/expected.js index aa26037cba0ae7..809d1ecfba446b 100644 --- a/packages/mui-codemod/src/deprecations/button-group-classes/test-cases/expected.js +++ b/packages/mui-codemod/src/deprecations/button-group-classes/test-cases/expected.js @@ -3,20 +3,20 @@ import { buttonGroupClasses } from '@mui/material/ButtonGroup'; ("&.MuiButtonGroup-horizontal > .MuiButtonGroup-grouped"); ("&.MuiButtonGroup-vertical > .MuiButtonGroup-grouped"); ("&.MuiButtonGroup-text > .MuiButtonGroup-grouped"); -("&.MuiButtonGroup-text > .MuiButtonGroup-groupedHorizontal"); -("&.MuiButtonGroup-text > .MuiButtonGroup-groupedVertical"); -("&.MuiButtonGroup-text > .MuiButtonGroup-groupedPrimary"); -("&.MuiButtonGroup-text > .MuiButtonGroup-groupedSecondary"); +("&.MuiButtonGroup-text.MuiButtonGroup-horizontal > .MuiButtonGroup-grouped"); +("&.MuiButtonGroup-text.MuiButtonGroup-vertical > .MuiButtonGroup-grouped"); +("&.MuiButtonGroup-text.MuiButtonGroup-colorPrimary > .MuiButtonGroup-grouped"); +("&.MuiButtonGroup-text.MuiButtonGroup-colorSecondary > .MuiButtonGroup-grouped"); ("&.MuiButtonGroup-outlined > .MuiButtonGroup-grouped"); -("&.MuiButtonGroup-outlined > .MuiButtonGroup-groupedHorizontal"); -("&.MuiButtonGroup-outlined > .MuiButtonGroup-groupedVertical"); -("&.MuiButtonGroup-outlined > .MuiButtonGroup-groupedPrimary"); -("&.MuiButtonGroup-outlined > .MuiButtonGroup-groupedSecondary"); +("&.MuiButtonGroup-outlined.MuiButtonGroup-horizontal > .MuiButtonGroup-grouped"); +("&.MuiButtonGroup-outlined.MuiButtonGroup-vertical > .MuiButtonGroup-grouped"); +("&.MuiButtonGroup-outlined.MuiButtonGroup-colorPrimary > .MuiButtonGroup-grouped"); +("&.MuiButtonGroup-outlined.MuiButtonGroup-colorSecondary > .MuiButtonGroup-grouped"); ("&.MuiButtonGroup-contained > .MuiButtonGroup-grouped"); -("&.MuiButtonGroup-contained > .MuiButtonGroup-groupedHorizontal"); -("&.MuiButtonGroup-contained > .MuiButtonGroup-groupedVertical"); -("&.MuiButtonGroup-contained > .MuiButtonGroup-groupedPrimary"); -("&.MuiButtonGroup-contained > .MuiButtonGroup-groupedSecondary"); +("&.MuiButtonGroup-contained.MuiButtonGroup-horizontal > .MuiButtonGroup-grouped"); +("&.MuiButtonGroup-contained.MuiButtonGroup-vertical > .MuiButtonGroup-grouped"); +("&.MuiButtonGroup-contained.MuiButtonGroup-colorPrimary > .MuiButtonGroup-grouped"); +("&.MuiButtonGroup-contained.MuiButtonGroup-colorSecondary > .MuiButtonGroup-grouped"); `&.${buttonGroupClasses.horizontal} > .${buttonGroupClasses.grouped}`; `&.${buttonGroupClasses.vertical} > .${buttonGroupClasses.grouped}`; `&.${buttonGroupClasses.text} > .${buttonGroupClasses.grouped}`;