forked from mui/material-ui
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Joy] Add tests / classes for
Breadcrumbs
component (mui#33860)
- Loading branch information
Showing
4 changed files
with
69 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import Breadcrumbs from '@mui/joy/Breadcrumbs'; | ||
import * as React from 'react'; | ||
|
||
<Breadcrumbs />; | ||
|
||
<Breadcrumbs component="div" />; | ||
|
||
// `size` | ||
<Breadcrumbs size="sm" />; | ||
<Breadcrumbs size="md" />; | ||
<Breadcrumbs size="lg" />; | ||
|
||
// @ts-expect-error there is no size `xs` | ||
<Breadcrumbs size="xs" />; | ||
// @ts-expect-error there is no size `xl` | ||
<Breadcrumbs size="xl" />; |
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,37 @@ | ||
import * as React from 'react'; | ||
import { expect } from 'chai'; | ||
import { createRenderer, describeConformance } from 'test/utils'; | ||
import { ThemeProvider } from '@mui/joy/styles'; | ||
import Breadcrumbs, { breadcrumbsClasses as classes } from '@mui/joy/Breadcrumbs'; | ||
import { unstable_capitalize as capitalize } from '@mui/utils'; | ||
|
||
describe('<Breadcrumbs />', () => { | ||
const { render } = createRenderer(); | ||
|
||
describeConformance(<Breadcrumbs />, () => ({ | ||
classes, | ||
inheritComponent: 'nav', | ||
render, | ||
ThemeProvider, | ||
muiName: 'JoyBreadcrumbs', | ||
refInstanceof: window.HTMLElement, | ||
testVariantProps: { variant: 'solid' }, | ||
testCustomVariant: true, | ||
skip: ['classesRoot', 'componentsProp'], | ||
})); | ||
|
||
describe('prop: size', () => { | ||
it('md by default', () => { | ||
const { getByRole } = render(<Breadcrumbs />); | ||
|
||
expect(getByRole('navigation')).to.have.class(classes.sizeMd); | ||
}); | ||
['sm', 'md', 'lg'].forEach((size) => { | ||
it(`should render ${size}`, () => { | ||
const { getByRole } = render(<Breadcrumbs size={size} />); | ||
|
||
expect(getByRole('navigation')).to.have.class(classes[`size${capitalize(size)}`]); | ||
}); | ||
}); | ||
}); | ||
}); |
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