Skip to content

Commit

Permalink
fix: Update SideNavigationLink component to include onClick event han…
Browse files Browse the repository at this point in the history
…dler
  • Loading branch information
aaryanporwal committed Sep 18, 2024
1 parent 26cf50d commit 0dcb896
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ it("can use a custom link component", () => {

it("gets the ref and checks if it can be used to get the element's position", () => {
const ref = React.createRef<HTMLAnchorElement>();
render(<SideNavigationLink label="Test content" forwardRef={ref} />);
render(
<SideNavigationLink
label="Test content"
onClick={jest.fn()}
forwardRef={ref}
/>,
);
expect(ref.current?.getBoundingClientRect()).toBeDefined();
});
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ export type Props<L = LinkDefaultElement, E = HTMLAnchorElement> = Partial<
/**
* The navigation item's label.
*/
label: ReactNode;
label: SideNavigationBaseProps<L>["label"];
/**
* The navigation item's onClick event handler.
*/
onClick?: () => void;
/**
* The component or element to use for the link element e.g. `a` or `NavLink`.
* @default a
Expand Down

0 comments on commit 0dcb896

Please sign in to comment.