Skip to content

Commit

Permalink
Adds NextLink legacyBehavior test (#1959)
Browse files Browse the repository at this point in the history
  • Loading branch information
TheSonOfThomp authored Aug 25, 2023
1 parent a579f5e commit b56c970
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion packages/button/src/Button/Button.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,24 @@ describe('packages/button', () => {
test(`renders a when passing in a NextJS Link wrapper`, () => {
// eslint-disable-next-line react/prop-types
const Linker = ({ href, children, ...props }: any) => (
<NextLink href={href}>
<NextLink href={href} {...props}>
{children}
</NextLink>
);

const { container, button } = renderButton({
href: 'https://mongodb.design',
as: Linker,
});

expect(container.querySelector('button')).not.toBeInTheDocument();
expect(button.tagName.toLowerCase()).toBe('a');
});

test(`renders a when passing in a legacy NextJS Link wrapper`, () => {
// eslint-disable-next-line react/prop-types
const Linker = ({ href, children, ...props }: any) => (
<NextLink legacyBehavior href={href}>
<a {...props}>{children}</a>
</NextLink>
);
Expand Down

0 comments on commit b56c970

Please sign in to comment.