hypothesis / frontend-testing

Common utilities for testing frontend UI code
0 stars 0 forks source link

Add utilities for mounting and un-mounting components #53

Closed robertknight closed 5 days ago

robertknight commented 6 days ago

A common pattern in our tests is to render a component and add the wrapper and (optionally) its DOM container to a list of active wrappers/containers. At the end of the test a Mocha afterEach block is then used to ensure all components are unmounted.

This commit adds mount and unmountAll utilities to this package to simplify this pattern. The mount function renders the component and adds its wrapper to the active set. unmountAll unmounts all active wrappers.