-
Notifications
You must be signed in to change notification settings - Fork 2.6k
0.10.2 fails on a test: global.getSelection().anchorNode undefined #1399
Comments
Hi @tleunen - can you give me more context for this? At Facebook, we don't usually use Enzyme to simulate events on Draft, so I'm not sure this is something we expect to work. Seeing the whole test would be useful, or knowing why you are writing this test. Thanks! |
There's not much more info to be honest. The test is actually testing something outside of draft, but I need to input data there to make sure the rest behaves properly. The test is something like:
It worked properly with 0.10.1.. Is the new condition on the nodeType too strict? Because the reason is really that the anchor is undefined, not null. |
Ah - I was focused on the test format itself, but I see now the main issue is that the check we added for
I think it would be reasonable to change the line from
to
Would you like to submit a PR? |
Fixes facebookarchive#1399 `nativeSelection.anchorNode` can be undefined instead of null, so I'm changing the condition to handle this use case.
I expect to get this out in a minor release in the next couple of weeks. |
Np. Thank you @flarnie |
I'm still seeing this (or a very similar error) in v0.10.4, coming from |
I'm running into the same error as @eldh periodically. Still hunting for a solid repro case... |
A test with these 3 lines with an error. Removing the last line make it to succeed.
It uses enzyme.
So it seems this line
anchorNode
is undefined, notnull
.https://github.com/facebook/draft-js/blob/master/src/component/handlers/edit/editOnBeforeInput.js#L159
The text was updated successfully, but these errors were encountered: