diff --git a/src/internal/index.ts b/src/internal/index.ts index c3c2d7a..9a277fa 100644 --- a/src/internal/index.ts +++ b/src/internal/index.ts @@ -31,7 +31,6 @@ export { getGlobalFlag } from './global-flags'; export { SingleTabStopNavigationAPI, SingleTabStopNavigationProvider, - SingleTabStopNavigationReset, useSingleTabStopNavigation, } from './single-tab-stop'; export { isFocusable, getAllFocusables, getFirstFocusable, getLastFocusable } from './focus-lock-utils/utils'; diff --git a/src/internal/single-tab-stop/__tests__/context.test.tsx b/src/internal/single-tab-stop/__tests__/context.test.tsx index cf5f413..7b812c0 100644 --- a/src/internal/single-tab-stop/__tests__/context.test.tsx +++ b/src/internal/single-tab-stop/__tests__/context.test.tsx @@ -1,59 +1,22 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 -import React, { useContext, useEffect, useRef } from 'react'; -import { render } from '@testing-library/react'; +import React, { useRef } from 'react'; +import { render, act } from '@testing-library/react'; -import { - SingleTabStopNavigationAPI, - SingleTabStopNavigationContext, - SingleTabStopNavigationProvider, - SingleTabStopNavigationReset, - useSingleTabStopNavigation, -} from '../'; +import { SingleTabStopNavigationContext, useSingleTabStopNavigation } from '../'; import { renderWithSingleTabStopNavigation } from './utils'; -// Simple STSN subscriber component function Button(props: React.HTMLAttributes) { const buttonRef = useRef(null); const { tabIndex } = useSingleTabStopNavigation(buttonRef, { tabIndex: props.tabIndex }); return - - {children} - - - ); -} - -function findGroupButton(groupId: string, buttonIndex: number) { - return document.querySelector(`#${groupId}`)!.querySelectorAll('button')[buttonIndex] as HTMLElement; -} +test('subscribed components can be rendered outside single tab stop navigation context', () => { + render(