Skip to content

Releases: trurl-master/jsdom-testing-mocks

v1.13.0

28 Feb 18:36
78cfd7d
Compare
Choose a tag to compare
Merge pull request #56 from trurl-master/fix-version

Fix version

v1.12.0

26 Feb 21:30
Compare
Choose a tag to compare
  • Fix a bug when the callback was being called on unobserved nodes (#54)

Thanks @davidr64 for the contribution!

v1.11.0

08 Sep 19:04
946c26f
Compare
Choose a tag to compare

Test support for @swc/jest

v1.10.0

04 Sep 18:50
5a9b53b
Compare
Choose a tag to compare

Removes dependencies on window during import. Thank you @sbaechler!

Remove dependency on window during import

12 Jul 22:42
Compare
Choose a tag to compare
v1.10.0-beta.0

Don't fail on non jsdom envs

v1.9.0

09 May 21:03
684f710
Compare
Choose a tag to compare
  • Improve support for vitest
  • Add configMocks

v1.9.0-beta.0

01 May 17:41
Compare
Choose a tag to compare
v1.9.0-beta.0 Pre-release
Pre-release
  • Remove forgotten dependencies on jest
  • Add configMocks

v1.8.0

23 Apr 21:17
Compare
Choose a tag to compare

Added missing support for steps easing in the WAAPI implementation

v1.7.0

08 Jan 22:45
Compare
Choose a tag to compare

Thanks to @adjsky there's less bugs in the Animation API mock 🎉

Fixes:

  • element.animate will now correctly accept the id option
  • when animation is cancelled it will remove itself from the list of animations associated with the element

Potentially it can break your code if you were relying on the current behaviour.

v1.6.0

03 Sep 14:59
55f0d4e
Compare
Choose a tag to compare

An attempt to get a little bit closer to the ResizeObserver spec.

There are no breaking changes (as far as I see), the old code should still work. However there's a small change in philosophy, so here's a recommended migration guide:

  1. It's recommended to use a dedicated size mocking method (mockElementSize) instead of mockElementBoundingClientRect

Before:

import { mockResizeObserver, mockElementBoundingClientRect } from 'jsdom-testing-mocks';

const resizeObserver = mockResizeObserver();

it('works', () => {
  render(<TestedComponent />);

  const element = screen.getBySomething(...)

  // tests...

  mockElementBoundingClientRect(element, {
    width: 300, height: 200,
  });

  act(() => {
    resizeObserver.resize(element);
  });

  // tests...
})

After:

import { mockResizeObserver } from 'jsdom-testing-mocks';

const resizeObserver = mockResizeObserver();

it('works', () => {
  render(<TestedComponent />);

  const element = screen.getBySomething(...)

  // tests...

  resizeObserver.mockElementSize(element, {
    contentBoxSize: { inlineSize: 300, blockSize: 200 },
  });

  act(() => {
    resizeObserver.resize(element);
  });

  // tests...
})
  1. Depending on your case you can omit passing the element to the .resize function, it will be triggered automatically (if the size is mocked)

PS. Check the new docs for more details