Skip to content

Releases: trurl-master/jsdom-testing-mocks

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

Refactor ResizeObserver test release

24 Aug 20:42
Compare
Choose a tag to compare
Pre-release
v1.6.0-beta.1

Make only one size property required

Refactor ResizeObserver test release

23 Aug 21:04
Compare
Choose a tag to compare
Pre-release
v1.6.0-beta.0

Refactor resize observer, add implicit elements

v1.5.0

02 Aug 11:47
a401d07
Compare
Choose a tag to compare

Adds experimental support for Web Animations API

v1.5.0-beta.8

01 Aug 18:06
Compare
Choose a tag to compare
v1.5.0-beta.8 Pre-release
Pre-release
Update README and examples

v1.5.0-beta.7

31 Jul 19:49
Compare
Choose a tag to compare
v1.5.0-beta.7 Pre-release
Pre-release
Use addEventListener instead of finished in the element.animation

v1.5.0-beta.6

31 Jul 14:09
Compare
Choose a tag to compare
v1.5.0-beta.6 Pre-release
Pre-release
Hide animation mocks inside a function

v1.5.0-beta.5

30 Jul 15:10
Compare
Choose a tag to compare
v1.5.0-beta.5 Pre-release
Pre-release
Update github actions

Testing release scripts

30 Jul 14:51
Compare
Choose a tag to compare
Pre-release
v1.5.0-beta.4

Update github actions

Testing release scripts

30 Jul 14:36
Compare
Choose a tag to compare
Pre-release
v1.5.0-beta.3

Update github actions