-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
233 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
import { render, screen } from '@testing-library/react'; | ||
import { createRef } from 'react'; | ||
import { | ||
Breadcrumb, | ||
BreadcrumbList, | ||
BreadcrumbItem, | ||
BreadcrumbLink, | ||
BreadcrumbPage, | ||
BreadcrumbSeparator, | ||
BreadcrumbEllipsis, | ||
} from './breadcrumb'; | ||
|
||
describe('Breadcrumb', () => { | ||
test('renders without crashing', () => { | ||
render(<Breadcrumb />); | ||
const breadcrumbElement = screen.getByRole('navigation'); | ||
expect(breadcrumbElement).toBeInTheDocument(); | ||
}); | ||
|
||
test('forwards ref correctly', () => { | ||
const ref = createRef<HTMLElement>(); | ||
render(<Breadcrumb ref={ref} />); | ||
expect(ref.current).not.toBeNull(); | ||
}); | ||
}); | ||
|
||
describe('BreadcrumbList', () => { | ||
test('renders without crashing', () => { | ||
render(<BreadcrumbList />); | ||
const breadcrumbListElement = screen.getByRole('list'); | ||
expect(breadcrumbListElement).toBeInTheDocument(); | ||
}); | ||
|
||
test('forwards ref correctly', () => { | ||
const ref = createRef<HTMLOListElement>(); | ||
render(<BreadcrumbList ref={ref} />); | ||
expect(ref.current).not.toBeNull(); | ||
}); | ||
}); | ||
|
||
describe('BreadcrumbItem', () => { | ||
test('renders without crashing', () => { | ||
render(<BreadcrumbItem />); | ||
const breadcrumbItemElement = screen.getByRole('listitem'); | ||
expect(breadcrumbItemElement).toBeInTheDocument(); | ||
}); | ||
|
||
test('forwards ref correctly', () => { | ||
const ref = createRef<HTMLLIElement>(); | ||
render(<BreadcrumbItem ref={ref} />); | ||
expect(ref.current).not.toBeNull(); | ||
}); | ||
}); | ||
|
||
describe('BreadcrumbLink', () => { | ||
test('renders without crashing', () => { | ||
render(<BreadcrumbLink />); | ||
const breadcrumbLinkElement = screen.getByTestId('breadcrumb-link'); | ||
expect(breadcrumbLinkElement).toBeInTheDocument(); | ||
}); | ||
|
||
test('forwards ref correctly', () => { | ||
const ref = createRef<HTMLAnchorElement>(); | ||
render(<BreadcrumbLink ref={ref} />); | ||
expect(ref.current).not.toBeNull(); | ||
}); | ||
}); | ||
|
||
describe('BreadcrumbPage', () => { | ||
test('renders without crashing', () => { | ||
render(<BreadcrumbPage />); | ||
const breadcrumbPageElement = screen.getByRole('link'); | ||
expect(breadcrumbPageElement).toBeInTheDocument(); | ||
}); | ||
|
||
test('forwards ref correctly', () => { | ||
const ref = createRef<HTMLLIElement>(); | ||
render(<BreadcrumbPage ref={ref} />); | ||
expect(ref.current).not.toBeNull(); | ||
}); | ||
}); | ||
|
||
describe('BreadcrumbSeparator', () => { | ||
test('renders without crashing', () => { | ||
render(<BreadcrumbSeparator />); | ||
const breadcrumbSeparatorElement = screen.getByRole('presentation', { | ||
hidden: true | ||
}); | ||
expect(breadcrumbSeparatorElement).toBeInTheDocument(); | ||
}); | ||
}); | ||
|
||
describe('BreadcrumbEllipsis', () => { | ||
test('renders without crashing', () => { | ||
render(<BreadcrumbEllipsis />); | ||
const breadcrumbEllipsisElement = screen.getByRole('presentation', {hidden: true}); | ||
expect(breadcrumbEllipsisElement).toBeInTheDocument(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
/* c8 ignore start */ | ||
module.exports = { | ||
plugins: { | ||
tailwindcss: {}, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
import { render, screen } from '@testing-library/react'; | ||
import { createRef } from 'react'; | ||
import { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption } from './table'; | ||
|
||
describe('Table', () => { | ||
test('renders without crashing', () => { | ||
render(<Table />); | ||
const tableElement = screen.getByRole('table'); | ||
expect(tableElement).toBeInTheDocument(); | ||
}); | ||
|
||
test('forwards ref correctly', () => { | ||
const ref = createRef<HTMLTableElement>(); | ||
render(<Table ref={ref} />); | ||
expect(ref.current).not.toBeNull(); | ||
}); | ||
}); | ||
|
||
describe('TableHeader', () => { | ||
test('renders without crashing', () => { | ||
render(<TableHeader />); | ||
const tableHeaderElement = screen.getByRole('rowgroup'); | ||
expect(tableHeaderElement).toBeInTheDocument(); | ||
}); | ||
|
||
test('forwards ref correctly', () => { | ||
const ref = createRef<HTMLTableSectionElement>(); | ||
render(<TableHeader ref={ref} />); | ||
expect(ref.current).not.toBeNull(); | ||
}); | ||
}); | ||
|
||
describe('TableBody', () => { | ||
test('renders without crashing', () => { | ||
render(<TableBody />); | ||
const tableBodyElement = screen.getByRole('rowgroup'); | ||
expect(tableBodyElement).toBeInTheDocument(); | ||
}); | ||
|
||
test('forwards ref correctly', () => { | ||
const ref = createRef<HTMLTableSectionElement>(); | ||
render(<TableBody ref={ref} />); | ||
expect(ref.current).not.toBeNull(); | ||
}); | ||
}); | ||
|
||
|
||
describe('TableFooter', () => { | ||
test('renders without crashing', () => { | ||
render(<TableFooter />); | ||
const tableFooterElement = screen.getByRole('rowgroup'); | ||
expect(tableFooterElement).toBeInTheDocument(); | ||
}); | ||
|
||
test('forwards ref correctly', () => { | ||
const ref = createRef<HTMLTableSectionElement>(); | ||
render(<TableFooter ref={ref} />); | ||
expect(ref.current).not.toBeNull(); | ||
}); | ||
}); | ||
|
||
|
||
describe('TableHead', () => { | ||
test('renders without crashing', () => { | ||
render(<TableHead />); | ||
const tableHeadElement = screen.getByRole('columnheader'); | ||
expect(tableHeadElement).toBeInTheDocument(); | ||
}); | ||
|
||
test('forwards ref correctly', () => { | ||
const ref = createRef<HTMLTableCellElement>(); | ||
render(<TableHead ref={ref} />); | ||
expect(ref.current).not.toBeNull(); | ||
}); | ||
}); | ||
|
||
describe('TableRow', () => { | ||
test('renders without crashing', () => { | ||
render(<TableRow />); | ||
const tableRowElement = screen.getByRole('row'); | ||
expect(tableRowElement).toBeInTheDocument(); | ||
}); | ||
|
||
test('forwards ref correctly', () => { | ||
const ref = createRef<HTMLTableRowElement>(); | ||
render(<TableRow ref={ref} />); | ||
expect(ref.current).not.toBeNull(); | ||
}); | ||
}); | ||
|
||
describe('TableCell', () => { | ||
test('renders without crashing', () => { | ||
render(<TableCell />); | ||
const tableCellElement = screen.getByRole('cell'); | ||
expect(tableCellElement).toBeInTheDocument(); | ||
}); | ||
|
||
test('forwards ref correctly', () => { | ||
const ref = createRef<HTMLTableCellElement>(); | ||
render(<TableCell ref={ref} />); | ||
expect(ref.current).not.toBeNull(); | ||
}); | ||
}); | ||
|
||
describe('TableCaption', () => { | ||
test('renders without crashing', () => { | ||
render(<TableCaption />); | ||
const tableCaptionElement = screen.getByRole('caption'); | ||
expect(tableCaptionElement).toBeInTheDocument(); | ||
}); | ||
|
||
test('forwards ref correctly', () => { | ||
const ref = createRef<HTMLTableCellElement>(); | ||
render(<TableCaption ref={ref} />); | ||
expect(ref.current).not.toBeNull(); | ||
}); | ||
}); |