[Accessibility] Manage focus on navigation (#39350)
This commit is contained in:
1 parent
bff9f0eb6d
commit
bcb8553e01
22 files changed
+265
-37
No files matched your search
@@ -1,6 +1,7 @@
|
||||
import { render, fireEvent, screen } from '@/testing/rendering';
|
||||
|
||||
import Column from '../column';
|
||||
import { FocusTargetProvider } from '@/mastodon/components/navigation_focus_target';
|
||||
|
||||
const fakeIcon = () => <span />;
|
||||
|
||||
@@ -9,9 +10,11 @@ describe('<Column />', () => {
|
||||
it('runs the scroll animation if the column contains scrollable content', () => {
|
||||
const scrollToMock = vi.fn();
|
||||
const { container } = render(
|
||||
<Column heading='notifications' icon='notifications' iconComponent={fakeIcon}>
|
||||
<div className='scrollable' />
|
||||
</Column>,
|
||||
<FocusTargetProvider>
|
||||
<Column heading='notifications' icon='notifications' iconComponent={fakeIcon}>
|
||||
<div className='scrollable' />
|
||||
</Column>
|
||||
</FocusTargetProvider>,
|
||||
);
|
||||
container.querySelector('.scrollable').scrollTo = scrollToMock;
|
||||
fireEvent.click(screen.getByText('notifications'));
|
||||
@@ -19,7 +22,11 @@ describe('<Column />', () => {
|
||||
});
|
||||
|
||||
it('does not try to scroll if there is no scrollable content', () => {
|
||||
render(<Column heading='notifications' icon='notifications' iconComponent={fakeIcon} />);
|
||||
render(
|
||||
<FocusTargetProvider>
|
||||
<Column heading='notifications' icon='notifications' iconComponent={fakeIcon} />
|
||||
</FocusTargetProvider>
|
||||
);
|
||||
fireEvent.click(screen.getByText('notifications'));
|
||||
});
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user