All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- Fix exception with native (non-transpiled) arrow function components (#37)
- Synchronously execute effects or state updates created with hooks after dispatching simulated events (#36)
- Synchronously execute effects created with
useEffect
oruseLayoutEffect
hooks after the initial render (#34)
- Support
attachTo
option formount
rendering to render into an existing DOM element
- Avoid accessing
children
property of vnodes in Preact 10, as this triggers an error when using preact/debug
- Work around issue where component type names are shown incorrectly when using preact-compat (for Preact v8) and document a limitation which is resolved in Preact 10 (#27).
- Fix exception when
wrapper.text()
is called on an Enzyme wrapper around a text node (#15).
- Made the Preact 10 adapter compatible with preact/compat by removing an
instanceof Component
check, which breaks if theComponent
class comes from the 'preact/compat' bundle - Made the adapter the default export of the package. The previous named exports have been kept for backwards compatibility
- Changed the name of the package's main export to
Adapter
. The export is also exported under its previous name (PreactAdapter
) for backwards compatibility
- Internal cleanups to make the adapter less reliant on Preact internals and better separate Preact version-specific code
-
Fix repository link in package.json
-
Mark Preact 10 as a dev dependency rather than a runtime dependency and fix the version number
- Support using with production builds of the current version of Preact 10 (10.0.0-alpha0).
- Support Enzyme wrapper methods which take an element tree as an argument,
such as
wrapper.contains(...)
.
- Add support for simulating errors.
- Children passed to non-rendered components during shallow-rendering are now present in the output, for consistency with how shallow rendering works in React.
-
Shallow rendering now only renders the root element passed to
shallow
, not any child component elements passed in the call toshallow
.In other words
shallow(<Parent><Child/></Parent>)
will render<Parent>
but only a stub for<Child>
.
- Add support for fragments. Children of fragments are presented to Enzyme as if they were children of their nearest non-fragment ancestor. In other words, fragments do not appear in the component tree exposed to Enzyme in the same way that they do not appear in the DOM tree in the browser.
-
Initial support for Preact 10 and later. Preact 10 has an entirely different rendering implementation and a different VNode shape. The adapter will detect at runtime which version of Preact is in use and use an appropriate method to convert the render tree into the format that Enzyme expects.
-
Support running tests against a custom build of Preact using
yarn test --preact-lib <path>
.
- Keys and refs of components and DOM nodes are now exposed to Enzyme.
- Calls to
setState
on fully-rendered components now trigger synchronous updates, for consistency with shallow rendering.
-
Components that render only strings are now handled correctly.
-
Work around a bug in Enzyme that caused
wrapper.get()
to fail when using full rendering.
- Map
class
prop toclassName
so that Enzyme class selectors work.
- Initial release.