Skip to content

Feature request: PopStateEvent (and maybe WindowEventHandlers?) #427

Closed
@maisano

Description

@maisano

Describe the feature you'd like:

In creating a custom router, I was adding some tests around popstate events, and reached for this in dom-testing-library, but noticed popstate was missing. I ended up doing this natively, but was wondering if you would accept a PR adding PopStateEvent. Optionally, we could add other WindowEventHandlers.

Suggested implementation:

Adding them is as simple as updating the eventsMap object in src/events. Testing them would require a bit of new code as they all emit from the window object, in lieu of arbitrary DOM nodes.

Describe alternatives you've considered:

Not doing this at all and instead using window.dispatchEvent(new window.PopStateEvent('popstate')); in my test.

Teachability, Documentation, Adoption, Migration Strategy:

This change would not require any large changes, but perhaps some additional documentation around availability.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions