Closed yuxin1234 closed 1 year ago
HI @yuxin1234, thanks for the contribution!
Could you please add one or more tests to ensure this does what's expected. It's hard to tell by looking at Regex if it will work right, so adding some tests would be hugely helpful. Ideally a test for such a fix should fail before this patch but pass afterwards.
Note: I just pushed a commit to master to enable automated tests via Github Actions, so please do a git pull.
Thanks!
@sstur That's a good suggestion. Thanks. I'll write tests.
Hey I have the same issue. I had ago at mimicking the regex without the negative lookbehind and came up with:
^_([\s\S]*?[^\\])_
. Would need to write some unit tests as @sstur suggested. Hope this helps happy to contribute :)
@ptimson Thanks Peter. Please feel free to push your changes to this PR
I dont think I can push to your repo I would have to make my own PR. I believe there a bunch of tests already for this I believe ^_([\s\S]*?[^\\])_
should work just a case of updating the regex and making sure they still pass.
@ptimson sounds good. Thanks.
Hi @sstur any chance you can review the PR? much appreciated.
@sstur could you please approve me running workflows? Thank you.
@sstur I have added unit test. Could you please review the PR? Thank you.
@sstur Simon, did you see my previous messages?
Hi, @yuxin1234 in your tests you only check one possible scenario. you should make multiple scenarios, otherwise, this regex will break some valid scenarios.
Please take a look at this comment and the merge mentioned: https://github.com/sstur/draft-js-utils/issues/255#issuecomment-1357376778
@MSGInsurlt Thanks Joao. Will do.
@MSGInsurIt I added tests for 5 more different scenarios. All the tests passed locally.
Hi @yuxin1234,
I just noticed something on your tests, are you really testing markdown?
This "let markdown = '<p><em><strong>BoldItalic</strong></em></p>';
" does not seem to be markdown language...
Other than that, why not use tests added in the https://github.com/sstur/draft-js-utils/pull/254/files ???
And the look behind expression has been corrected in the safari browser I suppose that only the update on safari is needed
@MSGInsurIt Happy holidays! As you mentioned, since regex lookbehind has been fixed in WebKit, we just need wait for an updated Safari that supports negative lookbehind, so we probably don't need this PR anymore.
@yuxin1234 @MSGInsurIt I think we should re-cosider closing this PR and fix the issue. While the issue has been fixed a long time ago, occasional update of the minor version of the library (from 1.4.0 to 1.4.1) broke our app for many users who still use the older Safari versions.
Resolves #260