testing-library / dom-testing-library

🐙 Simple and complete DOM testing utilities that encourage good testing practices.
https://testing-library.com/dom
MIT License
3.26k stars 466 forks source link

feat: Add window events "pagehide" / "pageshow" #1308

Closed jdufresne closed 5 months ago

jdufresne commented 5 months ago

What:

Add window events "pagehide" / "pageshow" to fireEvent API.

Why:

MDN documentation for these events is at:

https://developer.mozilla.org/en-US/docs/Web/API/Window/pagehide_event https://developer.mozilla.org/en-US/docs/Web/API/Window/pageshow_event

By adding these events, it allows library users to use the familiar fireEvent & friends in their test environments to verify pagehide and pageshow behavior.

How:

Add the events as entries in src/event-map.js.

Checklist:

codesandbox-ci[bot] commented 5 months ago

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 348b862197916f1fcfd8425b9c4c19557ae50a96:

Sandbox Source
react-testing-library-examples Configuration