Skip to content

Commit

Permalink
test for #38079
Browse files Browse the repository at this point in the history
  • Loading branch information
sai6855 authored and michaldudak committed Jul 25, 2023
1 parent 0278a2e commit 11016d3
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions packages/mui-material/src/Button/Button.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as React from 'react';
import Button, { ButtonProps } from '@mui/material/Button';
import MuiLink, { LinkProps as MuiLinkProps } from '@mui/material/Link';
import { Link as ReactRouterLink, LinkProps } from 'react-router-dom';
import { expectType } from '@mui/types';

Expand All @@ -9,6 +10,15 @@ const TestOverride = React.forwardRef<HTMLDivElement, { x?: number }>((props, re
<div ref={ref} />
));

type CustomLinkProps = MuiLinkProps<typeof ReactRouterLink, LinkProps>;
const CustomLink: React.FC<React.PropsWithChildren<CustomLinkProps>> = ({ children, ...props }) => {
return (
<MuiLink component={ReactRouterLink} {...props}>
{children}
</MuiLink>
);
};

function FakeIcon() {
return <div>Icon</div>;
}
Expand Down Expand Up @@ -64,6 +74,9 @@ const buttonTest = () => (
<Button component={ReactRouterLink} to="/open-collective">
Link
</Button>
<Button component={CustomLink} to="/some-route">
Link
</Button>
<Button href="/open-collective">Link</Button>
{/* By default the underlying component is a button element */}
<Button
Expand Down

0 comments on commit 11016d3

Please sign in to comment.