Skip to content

Commit

Permalink
add slotProps.img test
Browse files Browse the repository at this point in the history
  • Loading branch information
siriwatknp committed Nov 28, 2024
1 parent c6220c2 commit d72596d
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions packages/mui-material/src/Avatar/Avatar.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,20 @@ describe('<Avatar />', () => {
fireEvent.error(img);
expect(onError.callCount).to.equal(1);
});

it('should pass slots.img to `useLoaded` hook', () => {
const originalImage = global.Image;
const image = {};
global.Image = function Image() {
return image;
};

render(<Avatar src="/fake.png" slotProps={{ img: { crossOrigin: 'anonymous' } }} />);

expect(image.crossOrigin).to.equal('anonymous');

global.Image = originalImage;
});
});

describe('image avatar with unrendered children', () => {
Expand Down

0 comments on commit d72596d

Please sign in to comment.