Skip to content
New issue

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

FIX: emoji regex and tests #2090

Merged
merged 5 commits into from Feb 26, 2023
Merged

Conversation

joseph-lozano
Copy link
Contributor

@joseph-lozano joseph-lozano commented Feb 23, 2023

so it was really late when Theo put the bounty up on the stupid emoji validation. It had some errors but got merged in while I was sleeping. This fixes some of the issues that were still on the PR. See #2045

It also turns out the regex can be made much nicer using unicode codepoints in the Regex, see: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Unicode_Property_Escapes and https://unicode.org/reports/tr51/#Emoji_Properties

@netlify
Copy link

netlify bot commented Feb 23, 2023

Deploy Preview for guileless-rolypoly-866f8a ready!

Name Link
🔨 Latest commit 8c1915b
🔍 Latest deploy log https://app.netlify.com/sites/guileless-rolypoly-866f8a/deploys/63fbe882d1f25b0008433a5e
😎 Deploy Preview https://deploy-preview-2090--guileless-rolypoly-866f8a.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

Comment on lines -104 to -129
try {
url.parse("http://google.com");
url.parse("https://google.com/asdf?asdf=ljk3lk4&asdf=234#asdf");
expect(() => url.parse("asdf")).toThrow();
expect(() => url.parse("https:/")).toThrow();
expect(() => url.parse("asdfj@lkjsdf.com")).toThrow();
} catch (err) {}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My original PR #2045 copied from this test, which had this empty catch, so I though it would also fix this in the follow up.

@colinhacks
Copy link
Owner

I'd fixed this with the somewhat hacky per-character validation, but this is definitely better. I was briefly worried that unicode property escapes might not be supported across all engines/runtimes (we've had issues with lookbehind assertions) but it seems to be. 👍 Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants