Skip to content

Commit

Permalink
Update regex for Emoji 14.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jdecked committed Mar 11, 2022
1 parent a97ef39 commit f8312f3
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"license": "MIT",
"name": "twemoji-parser",
"version": "13.1.0",
"version": "14.0.0",
"description": "Parser for identifying Twemoji in text",
"main": "dist/index.js",
"files": [
Expand Down
42 changes: 42 additions & 0 deletions src/__tests__/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -767,4 +767,46 @@ describe('version spot checks', () => {
]);
});
});

describe('Emoji 14.0', () => {
test('single-codepoint handshake with no skintones', () => {
expect(parse('\ud83e\udd1d')).toMatchObject([
{
indices: [0, 2],
text: '\ud83e\udd1d'
}
]);
});

test('single-codepoint handshake with both hands the same skintone', () => {
expect(parse('\ud83e\udd1d\ud83c\udffe')).toMatchObject([
{
indices: [0, 4],
text: '\ud83e\udd1d\ud83c\udffe'
}
]);
});

test('multi-codepoint handshake with different skintones', () => {
expect(parse('\ud83e\udef1\ud83c\udfff\u200d\ud83e\udef2\ud83c\udffd')).toMatchObject([
{
indices: [0, 9],
text: '\ud83e\udef1\ud83c\udfff\u200d\ud83e\udef2\ud83c\udffd'
}
]);
});

test('multi-codepoint handshake with same skintone is unrecognized', () => {
expect(parse('\ud83e\udef1\ud83c\udffd\u200d\ud83e\udef2\ud83c\udffd')).toMatchObject([
{
indices: [0, 4],
text: '\ud83e\udef1\ud83c\udffd'
},
{
indices: [5, 9],
text: '\ud83e\udef2\ud83c\udffd'
}
]);
});
});
});
Loading

0 comments on commit f8312f3

Please sign in to comment.