diff --git a/src/components/breadcrumbs/__test__/Breadcrumbs.test.tsx b/src/components/breadcrumbs/__test__/Breadcrumbs.test.tsx
index 8963d9c..fb40cca 100644
--- a/src/components/breadcrumbs/__test__/Breadcrumbs.test.tsx
+++ b/src/components/breadcrumbs/__test__/Breadcrumbs.test.tsx
@@ -85,13 +85,29 @@ describe('Breadcrumbs Component', () => {
expect(separators).toHaveLength(3);
});
- it('opens the dropdown menu when clicked', async () => {
- const { getByRole, getByText } = renderBreadcrumbs();
+ it('renders a dropdown menu with functionally hidden items for lists larger than 3 components', async () => {
+ const fiveItemsProps = {
+ ...mockProps,
+ items: [
+ ...mockProps.items,
+ { uuid: '5', label: 'Details', icon: null, active: true },
+ ],
+ };
+
+ const { getByRole, getByText } = render(
+
+
+
+ );
+
const dropdownButton = getByRole('button');
await act(async () => {
userEvent.click(dropdownButton);
});
- const hiddenItem = getByText('Subcategory');
- expect(hiddenItem).toBeInTheDocument();
+
+ const hiddenItemCategory = getByText('Category');
+ const hiddenItemSubcategory = getByText('Subcategory');
+ expect(hiddenItemCategory).toBeInTheDocument();
+ expect(hiddenItemSubcategory).toBeInTheDocument();
});
});
diff --git a/src/components/breadcrumbs/__test__/BreadcrumbsItem.test.tsx b/src/components/breadcrumbs/__test__/BreadcrumbsItem.test.tsx
index ea3fc5c..eff10dc 100644
--- a/src/components/breadcrumbs/__test__/BreadcrumbsItem.test.tsx
+++ b/src/components/breadcrumbs/__test__/BreadcrumbsItem.test.tsx
@@ -129,4 +129,16 @@ describe('BreadcrumbsItem Component', () => {
const { getByTestId } = renderBreadcrumbsItem({ itemComponent: ItemComponentMock });
expect(getByTestId('custom-icon')).toBeInTheDocument();
});
+
+ it('applies first path styling when isFirstPath is true', () => {
+ const firstPathItem = { ...breadcrumbItem, isFirstPath: true };
+ const { getByText } = renderBreadcrumbsItem({ item: firstPathItem, totalBreadcrumbsLength: 1 });
+ expect(getByText('Item 1').parentElement).toHaveClass('shrink-0 pr-1');
+ });
+
+ it('renders gracefully when label is not provided', () => {
+ const noLabelItem = { ...breadcrumbItem, label: '' };
+ const { container } = renderBreadcrumbsItem({ item: noLabelItem });
+ expect(container).toBeInTheDocument();
+ });
});
diff --git a/src/components/button/__test__/Button.test.tsx b/src/components/button/__test__/Button.test.tsx
index cf4b8e7..2675a40 100644
--- a/src/components/button/__test__/Button.test.tsx
+++ b/src/components/button/__test__/Button.test.tsx
@@ -20,6 +20,13 @@ describe('Button component', () => {
expect(keydown).toHaveBeenCalledOnce();
});
+ it('Button should handle default onClick and onKeyDown without crashing', () => {
+ const { getByRole } = render();
+ const button = getByRole('button');
+ fireEvent.click(button);
+ fireEvent.keyDown(button, { key: 'Enter', code: 'Enter' });
+ });
+
it('Primary button should render correctly', () => {
const button = render();
expect(button).toMatchSnapshot();
@@ -94,4 +101,31 @@ describe('Button component', () => {
const button = render();
expect(button).toMatchSnapshot();
});
+
+ it('Destructive loading button should render correctly', () => {
+ const button = render();
+ expect(button).toMatchSnapshot();
+ });
+
+ it('Button with id, dataTest, autofocus, buttonDataCy and buttonChildrenDataCy renders correctly', () => {
+ const button = render(
+ ,
+ );
+ expect(button).toMatchSnapshot();
+ });
+
+ it('Button with unknown variant should render default styles', () => {
+ // @ts-expect-error testing invalid variant
+ const button = render();
+ expect(button).toMatchSnapshot();
+ });
});
diff --git a/src/components/button/__test__/__snapshots__/Button.test.tsx.snap b/src/components/button/__test__/__snapshots__/Button.test.tsx.snap
index 2e7bfc0..1550901 100644
--- a/src/components/button/__test__/__snapshots__/Button.test.tsx.snap
+++ b/src/components/button/__test__/__snapshots__/Button.test.tsx.snap
@@ -1,5 +1,191 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
+exports[`Button component > Button with id, dataTest, autofocus, buttonDataCy and buttonChildrenDataCy renders correctly 1`] = `
+{
+ "asFragment": [Function],
+ "baseElement":
+
+ ,
+ "container": ,
+ "debug": [Function],
+ "findAllByAltText": [Function],
+ "findAllByDisplayValue": [Function],
+ "findAllByLabelText": [Function],
+ "findAllByPlaceholderText": [Function],
+ "findAllByRole": [Function],
+ "findAllByTestId": [Function],
+ "findAllByText": [Function],
+ "findAllByTitle": [Function],
+ "findByAltText": [Function],
+ "findByDisplayValue": [Function],
+ "findByLabelText": [Function],
+ "findByPlaceholderText": [Function],
+ "findByRole": [Function],
+ "findByTestId": [Function],
+ "findByText": [Function],
+ "findByTitle": [Function],
+ "getAllByAltText": [Function],
+ "getAllByDisplayValue": [Function],
+ "getAllByLabelText": [Function],
+ "getAllByPlaceholderText": [Function],
+ "getAllByRole": [Function],
+ "getAllByTestId": [Function],
+ "getAllByText": [Function],
+ "getAllByTitle": [Function],
+ "getByAltText": [Function],
+ "getByDisplayValue": [Function],
+ "getByLabelText": [Function],
+ "getByPlaceholderText": [Function],
+ "getByRole": [Function],
+ "getByTestId": [Function],
+ "getByText": [Function],
+ "getByTitle": [Function],
+ "queryAllByAltText": [Function],
+ "queryAllByDisplayValue": [Function],
+ "queryAllByLabelText": [Function],
+ "queryAllByPlaceholderText": [Function],
+ "queryAllByRole": [Function],
+ "queryAllByTestId": [Function],
+ "queryAllByText": [Function],
+ "queryAllByTitle": [Function],
+ "queryByAltText": [Function],
+ "queryByDisplayValue": [Function],
+ "queryByLabelText": [Function],
+ "queryByPlaceholderText": [Function],
+ "queryByRole": [Function],
+ "queryByTestId": [Function],
+ "queryByText": [Function],
+ "queryByTitle": [Function],
+ "rerender": [Function],
+ "unmount": [Function],
+}
+`;
+
+exports[`Button component > Button with unknown variant should render default styles 1`] = `
+{
+ "asFragment": [Function],
+ "baseElement":
+
+ ,
+ "container": ,
+ "debug": [Function],
+ "findAllByAltText": [Function],
+ "findAllByDisplayValue": [Function],
+ "findAllByLabelText": [Function],
+ "findAllByPlaceholderText": [Function],
+ "findAllByRole": [Function],
+ "findAllByTestId": [Function],
+ "findAllByText": [Function],
+ "findAllByTitle": [Function],
+ "findByAltText": [Function],
+ "findByDisplayValue": [Function],
+ "findByLabelText": [Function],
+ "findByPlaceholderText": [Function],
+ "findByRole": [Function],
+ "findByTestId": [Function],
+ "findByText": [Function],
+ "findByTitle": [Function],
+ "getAllByAltText": [Function],
+ "getAllByDisplayValue": [Function],
+ "getAllByLabelText": [Function],
+ "getAllByPlaceholderText": [Function],
+ "getAllByRole": [Function],
+ "getAllByTestId": [Function],
+ "getAllByText": [Function],
+ "getAllByTitle": [Function],
+ "getByAltText": [Function],
+ "getByDisplayValue": [Function],
+ "getByLabelText": [Function],
+ "getByPlaceholderText": [Function],
+ "getByRole": [Function],
+ "getByTestId": [Function],
+ "getByText": [Function],
+ "getByTitle": [Function],
+ "queryAllByAltText": [Function],
+ "queryAllByDisplayValue": [Function],
+ "queryAllByLabelText": [Function],
+ "queryAllByPlaceholderText": [Function],
+ "queryAllByRole": [Function],
+ "queryAllByTestId": [Function],
+ "queryAllByText": [Function],
+ "queryAllByTitle": [Function],
+ "queryByAltText": [Function],
+ "queryByDisplayValue": [Function],
+ "queryByLabelText": [Function],
+ "queryByPlaceholderText": [Function],
+ "queryByRole": [Function],
+ "queryByTestId": [Function],
+ "queryByText": [Function],
+ "queryByTitle": [Function],
+ "rerender": [Function],
+ "unmount": [Function],
+}
+`;
+
exports[`Button component > Destructive button should render correctly 1`] = `
{
"asFragment": [Function],
@@ -176,6 +362,145 @@ exports[`Button component > Destructive disabled button should render correctly
}
`;
+exports[`Button component > Destructive loading button should render correctly 1`] = `
+{
+ "asFragment": [Function],
+ "baseElement":
+
+ ,
+ "container": ,
+ "debug": [Function],
+ "findAllByAltText": [Function],
+ "findAllByDisplayValue": [Function],
+ "findAllByLabelText": [Function],
+ "findAllByPlaceholderText": [Function],
+ "findAllByRole": [Function],
+ "findAllByTestId": [Function],
+ "findAllByText": [Function],
+ "findAllByTitle": [Function],
+ "findByAltText": [Function],
+ "findByDisplayValue": [Function],
+ "findByLabelText": [Function],
+ "findByPlaceholderText": [Function],
+ "findByRole": [Function],
+ "findByTestId": [Function],
+ "findByText": [Function],
+ "findByTitle": [Function],
+ "getAllByAltText": [Function],
+ "getAllByDisplayValue": [Function],
+ "getAllByLabelText": [Function],
+ "getAllByPlaceholderText": [Function],
+ "getAllByRole": [Function],
+ "getAllByTestId": [Function],
+ "getAllByText": [Function],
+ "getAllByTitle": [Function],
+ "getByAltText": [Function],
+ "getByDisplayValue": [Function],
+ "getByLabelText": [Function],
+ "getByPlaceholderText": [Function],
+ "getByRole": [Function],
+ "getByTestId": [Function],
+ "getByText": [Function],
+ "getByTitle": [Function],
+ "queryAllByAltText": [Function],
+ "queryAllByDisplayValue": [Function],
+ "queryAllByLabelText": [Function],
+ "queryAllByPlaceholderText": [Function],
+ "queryAllByRole": [Function],
+ "queryAllByTestId": [Function],
+ "queryAllByText": [Function],
+ "queryAllByTitle": [Function],
+ "queryByAltText": [Function],
+ "queryByDisplayValue": [Function],
+ "queryByLabelText": [Function],
+ "queryByPlaceholderText": [Function],
+ "queryByRole": [Function],
+ "queryByTestId": [Function],
+ "queryByText": [Function],
+ "queryByTitle": [Function],
+ "rerender": [Function],
+ "unmount": [Function],
+}
+`;
+
exports[`Button component > Ghost button should render correctly 1`] = `
{
"asFragment": [Function],