From 33fa30aeafe536f536dd1be3300a4b7a81dce019 Mon Sep 17 00:00:00 2001 From: sai chand Date: Thu, 16 Feb 2023 17:24:25 +0000 Subject: [PATCH 1/3] [Avatar] Fix --- packages/mui-material/src/Avatar/Avatar.js | 2 +- .../mui-material/src/Avatar/Avatar.test.js | 25 +++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/packages/mui-material/src/Avatar/Avatar.js b/packages/mui-material/src/Avatar/Avatar.js index bbd274974c4195..9a99024a115fb8 100644 --- a/packages/mui-material/src/Avatar/Avatar.js +++ b/packages/mui-material/src/Avatar/Avatar.js @@ -176,7 +176,7 @@ const Avatar = React.forwardRef(function Avatar(inProps, ref) { } else if (hasImg && alt) { children = alt[0]; } else { - children = ; + children = ; } return ( diff --git a/packages/mui-material/src/Avatar/Avatar.test.js b/packages/mui-material/src/Avatar/Avatar.test.js index eb00cf9630e239..e0b2e5f261f4c2 100644 --- a/packages/mui-material/src/Avatar/Avatar.test.js +++ b/packages/mui-material/src/Avatar/Avatar.test.js @@ -3,6 +3,7 @@ import { expect } from 'chai'; import { createRenderer, fireEvent, describeConformance } from 'test/utils'; import { spy } from 'sinon'; import Avatar, { avatarClasses as classes } from '@mui/material/Avatar'; +import { createTheme, ThemeProvider } from '@mui/material/styles'; import CancelIcon from '../internal/svg-icons/Cancel'; describe('', () => { @@ -212,4 +213,28 @@ describe('', () => { expect(avatar).to.have.class(classes.colorDefault); }); }); + + it('should not error when ownerState is used in styleOverrides', () => { + const theme = createTheme({ + components: { + MuiAvatar: { + styleOverrides: { + root: ({ ownerState }) => ({ + ...(ownerState.variant === 'rounded' && { + color: 'red', + }), + }), + }, + }, + }, + }); + + expect(() => + render( + + + , + ), + ).not.toErrorDev(); + }); }); From 3f413938836a2d71e9b21a026804778477e21a49 Mon Sep 17 00:00:00 2001 From: sai chand Date: Thu, 16 Feb 2023 17:26:13 +0000 Subject: [PATCH 2/3] trigger From 07de41224b1f31fff1fffe2e46d2b17012f0aaa5 Mon Sep 17 00:00:00 2001 From: sai chand Date: Fri, 17 Feb 2023 12:18:31 +0000 Subject: [PATCH 3/3] test fix --- packages/mui-material/src/Avatar/Avatar.test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/mui-material/src/Avatar/Avatar.test.js b/packages/mui-material/src/Avatar/Avatar.test.js index e0b2e5f261f4c2..0d5ef55142e152 100644 --- a/packages/mui-material/src/Avatar/Avatar.test.js +++ b/packages/mui-material/src/Avatar/Avatar.test.js @@ -214,7 +214,7 @@ describe('', () => { }); }); - it('should not error when ownerState is used in styleOverrides', () => { + it('should not throw error when ownerState is used in styleOverrides', () => { const theme = createTheme({ components: { MuiAvatar: { @@ -235,6 +235,6 @@ describe('', () => { , ), - ).not.toErrorDev(); + ).not.to.throw(); }); });