diff --git a/categories/web/action/react/src/components/ActionButton/ActionButton.test.tsx b/categories/web/action/react/src/components/ActionButton/ActionButton.test.tsx index 67a12d5..f595a37 100644 --- a/categories/web/action/react/src/components/ActionButton/ActionButton.test.tsx +++ b/categories/web/action/react/src/components/ActionButton/ActionButton.test.tsx @@ -93,6 +93,29 @@ describe('ActionButton', () => { expect(button).toHaveClass('pl-2 gap-2 pr-2'); }); + it('renders an icon', () => { + render( + } + />, + ); + + const icon = screen.getByTestId('icon'); + expect(icon).toBeInTheDocument(); + }); + + it('renders icon after children', () => { + render( + } + />, + ); + + const childrenParent = screen.getByTestId('childrenParent'); + expect(childrenParent).toHaveClass('flex-row-reverse'); + }); + describe.each` size | className ${'small'} | ${'h-10'} diff --git a/categories/web/action/react/src/components/ActionButton/index.tsx b/categories/web/action/react/src/components/ActionButton/index.tsx index 77cf842..f2211cd 100644 --- a/categories/web/action/react/src/components/ActionButton/index.tsx +++ b/categories/web/action/react/src/components/ActionButton/index.tsx @@ -110,6 +110,7 @@ export const ActionButton = React.forwardRef { expect(button).toHaveClass('pl-2 gap-2 pr-2'); }); + it('renders an icon', () => { + render( + } + />, + ); + + const icon = screen.getByTestId('icon'); + expect(icon).toBeInTheDocument(); + }); + + it('renders icon after children', () => { + render( + } + />, + ); + + const childrenParent = screen.getByTestId('childrenParent'); + expect(childrenParent).toHaveClass('flex-row-reverse'); + }); + describe.each` size | className ${'small'} | ${'h-10'} @@ -179,17 +202,6 @@ describe('LinkButton', () => { expect(children).toHaveTextContent('Foo'); }); - it.each(Button.AVAILABLE_TYPES)('renders a link with type %s', (buttonType) => { - render( - , - ); - const button = screen.getByRole('link'); - expect(button).toHaveProperty('type', buttonType); - }); - it('renders a disabled link', () => { render(