diff --git a/packages/react/src/components/AILabel/__tests__/AILabel-test.js b/packages/react/src/components/AILabel/__tests__/AILabel-test.js index 43d24cb46d6b..bf30a33694d3 100644 --- a/packages/react/src/components/AILabel/__tests__/AILabel-test.js +++ b/packages/react/src/components/AILabel/__tests__/AILabel-test.js @@ -6,8 +6,10 @@ */ import React from 'react'; -import { AILabel } from '../'; +import { AILabel, AILabelContent, AILabelActions } from '../'; +import { Button } from '../../Button'; import { render, screen } from '@testing-library/react'; +import userEvent from '@testing-library/user-event'; const prefix = 'cds'; @@ -114,4 +116,45 @@ describe('AILabel', () => { ); }); }); + + it('should handle revert click', async () => { + render( + {}} + /> + ); + + await userEvent.click(screen.getByRole('button')); + }); +}); + +describe('AILabelContent', () => { + it('should render with content', () => { + render( + + Children test + + ); + + expect(screen.getByText('Children test')).toBeInTheDocument(); + }); +}); + +describe('AILabelActions', () => { + it('should render with actions', () => { + render( + + + Children test + + + + + + ); + + expect(screen.getByText('View details')).toBeInTheDocument(); + }); }); diff --git a/packages/react/src/components/Pagination/Pagination-test.js b/packages/react/src/components/Pagination/__tests__/Pagination-test.js similarity index 99% rename from packages/react/src/components/Pagination/Pagination-test.js rename to packages/react/src/components/Pagination/__tests__/Pagination-test.js index 44dd4d4a14f7..68c7a4ef4469 100644 --- a/packages/react/src/components/Pagination/Pagination-test.js +++ b/packages/react/src/components/Pagination/__tests__/Pagination-test.js @@ -1,5 +1,5 @@ import React from 'react'; -import Pagination from './Pagination'; +import Pagination from '../Pagination'; import userEvent from '@testing-library/user-event'; import { getAllByRole, render, screen } from '@testing-library/react'; diff --git a/packages/react/src/components/Pagination/__tests__/PaginationSkeleton-test.js b/packages/react/src/components/Pagination/__tests__/PaginationSkeleton-test.js new file mode 100644 index 000000000000..f9c2f96fbce0 --- /dev/null +++ b/packages/react/src/components/Pagination/__tests__/PaginationSkeleton-test.js @@ -0,0 +1,26 @@ +/** + * Copyright IBM Corp. 2016, 2024 + * + * This source code is licensed under the Apache-2.0 license found in the + * LICENSE file in the root directory of this source tree. + */ + +import React from 'react'; +import { PaginationSkeleton } from '../Pagination.Skeleton'; +import { render } from '@testing-library/react'; + +describe('PaginationSkeleton', () => { + it('should support a custom `className` prop on the outermost element', () => { + const { container } = render( + + ); + expect(container.firstChild).toHaveClass('test'); + }); + + it('should spread additional props on the outermost element', () => { + const { container } = render( + + ); + expect(container.firstChild).toHaveAttribute('data-testid', 'test'); + }); +});