clauderic / clauderic/react-sortable-hoc

fully disabling react-sortable-hoc (and enable snapshot testing)

Open
#230 2 comments 3 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
10.9k
Forks
959
PR merge metrics
No merged PRs in 30d

Description

In https://github.com/clauderic/react-sortable-hoc/issues/193 it becomes clear that Jest snapshot testing won't work with react-sortable-hoc. I found comments in Jest issues that says findDOMNode, which triggers this, won't be supported in snapshot testing.

I'm looking for a way to selectively disable react-sortable-hoc so that it is there but inert and won't do any findDOMNode. This would be useful in any case for UI components that make sortability of items optional.

I found the ``disabled`` setting on the SortableElement HOC, but that's evidently not enough to make snapshot testing work.

It would be nice to have a disable flag for the SortableContainer HOC that just absolutely disables it entirely. I can of course build use HOC-enabled and non-HOC enabled versions of my components, but that would require some dynamic switching inside to make sure the SortableElement-free HOC is used in a SortableContainer HOC but not elsewhere. A disabled flag would be a lot simpler to maintain.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.