vitest-matchmedia-mock
TypeScript icon, indicating that this package has built-in type declarations

1.0.5 • Public • Published

Vitest MatchMediaMock

codecov

how to import:

import MatchMediaMock from 'vitest-matchmedia-mock`

Usage example

describe('your test', () => {
  let matchMediaMock = new MatchMediaMock();
  afterAll(() => {
    matchMediaMock.clear();
  });
});

Use Media Query

describe('your test', () => {
  let matchMediaMock = new MatchMediaMock();
  beforeAll(() => {
    matchMediaMock.useMediaQuery('(prefers-color-scheme: dark)');
  });

  afterEach(() => {
    matchMediaMock.clear();
  });

  afterAll(() => {
    matchMediaMock.destroy();
  });
});

/vitest-matchmedia-mock/

    Package Sidebar

    Install

    npm i vitest-matchmedia-mock

    Weekly Downloads

    2,850

    Version

    1.0.5

    License

    ISC

    Unpacked Size

    10.8 kB

    Total Files

    5

    Last publish

    Collaborators

    • nggepe