From 84bd188dd7ecac499e64f17fbdaf29400e96b7e5 Mon Sep 17 00:00:00 2001 From: R Midhun Suresh Date: Wed, 13 Nov 2024 20:21:45 +0530 Subject: [PATCH] Add test to ensure ref argument to hook works --- .../accessibility/RovingTabIndex-test.tsx | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/test/unit-tests/accessibility/RovingTabIndex-test.tsx b/test/unit-tests/accessibility/RovingTabIndex-test.tsx index d3d75397b7..c814502732 100644 --- a/test/unit-tests/accessibility/RovingTabIndex-test.tsx +++ b/test/unit-tests/accessibility/RovingTabIndex-test.tsx @@ -120,6 +120,25 @@ describe("RovingTabIndex", () => { checkTabIndexes(container.querySelectorAll("button"), [-1, -1, 0]); }); + it("RovingTabIndexProvider provides a ref to the dom element", () => { + const nodeRef = React.createRef(); + const MyButton = (props: HTMLAttributes) => { + const [onFocus, isActive, ref] = useRovingTabIndex(nodeRef); + return