mirror of
https://github.com/mastodon/mastodon.git
synced 2026-02-20 14:58:31 +00:00
fix requestIdleCallback again
This commit is contained in:
parent
e50ab94e8f
commit
fd0821e889
|
|
@ -7,9 +7,6 @@ const fakeIcon = () => <span />;
|
|||
describe('<Column />', () => {
|
||||
describe('<ColumnHeader /> click handler', () => {
|
||||
it('runs the scroll animation if the column contains scrollable content', () => {
|
||||
vi.useFakeTimers({
|
||||
toFake: ['requestIdleCallback']
|
||||
});
|
||||
const scrollToMock = vi.fn();
|
||||
const { container } = render(
|
||||
<Column heading='notifications' icon='notifications' iconComponent={fakeIcon}>
|
||||
|
|
@ -18,7 +15,6 @@ describe('<Column />', () => {
|
|||
);
|
||||
container.querySelector('.scrollable').scrollTo = scrollToMock;
|
||||
fireEvent.click(screen.getByText('notifications'));
|
||||
vi.runAllTimers();
|
||||
expect(scrollToMock).toHaveBeenCalledWith({ behavior: 'smooth', top: 0 });
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,15 @@ import { render as rtlRender } from '@testing-library/react';
|
|||
|
||||
import { IdentityContext } from './identity_context';
|
||||
|
||||
beforeAll(() => {
|
||||
global.requestIdleCallback = vi.fn((cb: IdleRequestCallback) => {
|
||||
// @ts-expect-error IdleRequestCallback expects an argument of type IdleDeadline,
|
||||
// but that doesn't exist in this environment.
|
||||
cb();
|
||||
return 0;
|
||||
});
|
||||
});
|
||||
|
||||
function render(
|
||||
ui: React.ReactElement,
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user