import * as React from 'react'; import { renderHook } from '@testing-library/react-hooks'; import { Avatar } from '../Avatar'; import render from '../../utils/_tests/render'; describe('props', () => { it('should render correctly', () => { const { container } = render(); expect(container.firstChild).toMatchSnapshot(); }); it('should render correctly with CSS props', () => { const { container } = render(); expect(container.firstChild).toMatchSnapshot(); }); it('should render correctly with variant circle', () => { const { container } = render(); expect(container.firstChild).toMatchSnapshot(); }); ['small', 'default', 'medium', 'large'].forEach((size) => { it(`should render correctly for size ${size}`, () => { const { container } = render(); expect(container.firstChild).toMatchSnapshot(); }); }); it('should render correctly for initials', () => { const { container } = render(); expect(container.firstChild).toMatchSnapshot(); }); }); describe('overrides', () => { it('Avatar.base should render correctly', () => { const { container } = render( ); expect(container.firstChild).toMatchSnapshot(); }); it('Avatar.circle.base should render correctly', () => { const { container } = render( ); expect(container.firstChild).toMatchSnapshot(); }); it('Avatar.sizes.small should render correctly', () => { const { container } = render( ); expect(container.firstChild).toMatchSnapshot(); }); it('Avatar.sizes.default should render correctly', () => { const { container } = render( ); expect(container.firstChild).toMatchSnapshot(); }); it('Avatar.sizes.medium should render correctly', () => { const { container } = render( ); expect(container.firstChild).toMatchSnapshot(); }); it('Avatar.sizes.large should render correctly', () => { const { container } = render( ); expect(container.firstChild).toMatchSnapshot(); }); }); describe('theming', () => { it('Avatar.base should render correctly', () => { const { container } = render(, { theme: { Avatar: { styles: { base: { backgroundColor: 'red' } } } }, }); expect(container.firstChild).toMatchSnapshot(); }); it('Avatar.circle.base should render correctly', () => { const { container } = render(, { theme: { Avatar: { styles: { circle: { backgroundColor: 'red' } } } }, }); expect(container.firstChild).toMatchSnapshot(); }); it('Avatar.sizes.small should render correctly', () => { const { container } = render(, { theme: { Avatar: { styles: { sizes: { small: { backgroundColor: 'red' } } } } }, }); expect(container.firstChild).toMatchSnapshot(); }); it('Avatar.sizes.default should render correctly', () => { const { container } = render(, { theme: { Avatar: { styles: { sizes: { default: { backgroundColor: 'red' } } } } }, }); expect(container.firstChild).toMatchSnapshot(); }); it('Avatar.sizes.medium should render correctly', () => { const { container } = render(, { theme: { Avatar: { styles: { sizes: { medium: { backgroundColor: 'red' } } } } }, }); expect(container.firstChild).toMatchSnapshot(); }); it('Avatar.sizes.large should render correctly', () => { const { container } = render(, { theme: { Avatar: { styles: { sizes: { large: { backgroundColor: 'red' } } } } }, }); expect(container.firstChild).toMatchSnapshot(); }); }); describe('defaultProps', () => { it('should render correctly for className', () => { const { container } = render(, { theme: { Avatar: { defaultProps: { className: 'test', color: 'primary' } } }, }); expect(container.firstChild).toMatchSnapshot(); }); });