MCPcopy Create free account
hub / github.com/algolia/docsearch / createMatchMedia

Function createMatchMedia

scripts/setupTests.ts:22–34  ·  view source on GitHub ↗
(props: MatchMediaProps)

Source from the content-addressed store, hash-verified

20}>;
21
22const createMatchMedia = (props: MatchMediaProps): Mock => {
23 return vi.fn((query) => ({
24 matches: false,
25 media: query,
26 onchange: null,
27 addListener: vi.fn(),
28 removeListener: vi.fn(),
29 addEventListener: vi.fn(),
30 removeEventListener: vi.fn(),
31 dispatchEvent: vi.fn(),
32 ...props,
33 }));
34};
35
36vi.stubGlobal('scrollTo', vi.fn());
37vi.stubGlobal('matchMedia', createMatchMedia({ matches: true }));

Callers 1

setupTests.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected