Skip to content

Commit f8312f3

Browse files
committed
Update regex for Emoji 14.0
1 parent a97ef39 commit f8312f3

File tree

3 files changed

+44
-2
lines changed

3 files changed

+44
-2
lines changed

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"license": "MIT",
33
"name": "twemoji-parser",
4-
"version": "13.1.0",
4+
"version": "14.0.0",
55
"description": "Parser for identifying Twemoji in text",
66
"main": "dist/index.js",
77
"files": [

‎src/__tests__/index.test.js‎

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -767,4 +767,46 @@ describe('version spot checks', () => {
767767
]);
768768
});
769769
});
770+
771+
describe('Emoji 14.0', () => {
772+
test('single-codepoint handshake with no skintones', () => {
773+
expect(parse('\ud83e\udd1d')).toMatchObject([
774+
{
775+
indices: [0, 2],
776+
text: '\ud83e\udd1d'
777+
}
778+
]);
779+
});
780+
781+
test('single-codepoint handshake with both hands the same skintone', () => {
782+
expect(parse('\ud83e\udd1d\ud83c\udffe')).toMatchObject([
783+
{
784+
indices: [0, 4],
785+
text: '\ud83e\udd1d\ud83c\udffe'
786+
}
787+
]);
788+
});
789+
790+
test('multi-codepoint handshake with different skintones', () => {
791+
expect(parse('\ud83e\udef1\ud83c\udfff\u200d\ud83e\udef2\ud83c\udffd')).toMatchObject([
792+
{
793+
indices: [0, 9],
794+
text: '\ud83e\udef1\ud83c\udfff\u200d\ud83e\udef2\ud83c\udffd'
795+
}
796+
]);
797+
});
798+
799+
test('multi-codepoint handshake with same skintone is unrecognized', () => {
800+
expect(parse('\ud83e\udef1\ud83c\udffd\u200d\ud83e\udef2\ud83c\udffd')).toMatchObject([
801+
{
802+
indices: [0, 4],
803+
text: '\ud83e\udef1\ud83c\udffd'
804+
},
805+
{
806+
indices: [5, 9],
807+
text: '\ud83e\udef2\ud83c\udffd'
808+
}
809+
]);
810+
});
811+
});
770812
});

0 commit comments

Comments
 (0)