mirror of
https://github.com/nextui-org/nextui.git
synced 2025-12-08 19:26:11 +00:00
chore(components): link tests added
This commit is contained in:
parent
dfb2134caa
commit
7dd99944cf
@ -11,9 +11,25 @@ describe("Link", () => {
|
||||
});
|
||||
|
||||
it("ref should be forwarded", () => {
|
||||
const ref = React.createRef<HTMLDivElement>();
|
||||
const ref = React.createRef<HTMLAnchorElement>();
|
||||
|
||||
render(<Link ref={ref} />);
|
||||
expect(ref.current).not.toBeNull();
|
||||
});
|
||||
|
||||
it("should be no errors when href missing", () => {
|
||||
const wrapper = render(<Link>Link</Link>);
|
||||
|
||||
expect(() => wrapper.unmount()).not.toThrow();
|
||||
});
|
||||
|
||||
it('should show a link icon when "isExternal" is true', () => {
|
||||
const wrapper = render(
|
||||
<Link isExternal href="#">
|
||||
Link
|
||||
</Link>,
|
||||
);
|
||||
|
||||
expect(wrapper.container.querySelector("svg")).not.toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
@ -32,7 +32,7 @@ export const StyledLink = styled(
|
||||
},
|
||||
animated: {
|
||||
true: {
|
||||
transition: "opacity 0.25s ease 0s, background 0.25s ease 0s",
|
||||
transition: "opacity 0.2s ease 0s, background 0.2s ease 0s",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@ -18,7 +18,7 @@ interface ILinkAria {
|
||||
isPressed: boolean;
|
||||
}
|
||||
|
||||
const Link = forwardRef<LinkProps, "div">((props, ref) => {
|
||||
const Link = forwardRef<LinkProps, "a">((props, ref) => {
|
||||
const {children, as, css, linkCss, isExternal, focusProps, className, ...otherProps} =
|
||||
useLink(props);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user