We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
As per the report in #79 which was closed without a fix.
If using d3-drag in a non browser environment, such as jest + testing-library, an error will be thrown:
Error: Uncaught [TypeError: Cannot read property 'document' of null]
This comes from
d3-drag/src/drag.js
Lines 50 to 63 in c6a7e46
d3-drag/src/nodrag.js
Lines 4 to 5 in c6a7e46
Because view is null.
view
Downstream issues:
I think nodrag should return early if view is null:
export default function(view) { if(!view) { return; } var root = view.document.documentElement, selection = select(view).on("dragstart.drag", noevent, nonpassivecapture); if ("onselectstart" in root) { selection.on("selectstart.drag", noevent, nonpassivecapture); } else { root.__noselect = root.style.MozUserSelect; root.style.MozUserSelect = "none"; } }
...at least, this works for my use case. I'll raise a PR.
The text was updated successfully, but these errors were encountered:
Support d3.drag in testing environenments
2fa69f2
Return early from nodrag if no view is passed. Fixes d3#89
Support d3.drag in testing environments
bfe249f
1a87936
Successfully merging a pull request may close this issue.
As per the report in #79 which was closed without a fix.
If using d3-drag in a non browser environment, such as jest + testing-library, an error will be thrown:
This comes from
d3-drag/src/drag.js
Lines 50 to 63 in c6a7e46
d3-drag/src/nodrag.js
Lines 4 to 5 in c6a7e46
Because
view
is null.Downstream issues:
I think nodrag should return early if view is null:
...at least, this works for my use case. I'll raise a PR.
The text was updated successfully, but these errors were encountered: