Changes
3 changed files (+26/-4)
-
-
@@ -120,7 +120,7 @@ })) const parseEmoji = regexp( /^:([^:<]+?)(::([^:]+?))?:/, /^:([^:<]+?):(:(skin-tone-.+?):)?/, (match, text, position) => { const [matchedText, name, _, variation] = match
-
-
-
@@ -151,8 +151,24 @@ root([text('foo '), emoji('bar'), text(' baz')])) }) it('Should parse emoji with variation', () => { expect(parse(':foo::bar:')).toEqual(root([emoji('foo', 'bar')])) it('Should parse emoji with skin-tone variation', () => { expect(parse(':foo::skin-tone-1:')).toEqual( root([emoji('foo', 'skin-tone-1')]) ) }) it('Should parse sequential emojis', () => { expect(parse('ab:cd::ef::skin-tone-1:g:h::i:jk')).toEqual( root([ text('ab'), emoji('cd'), emoji('ef', 'skin-tone-1'), text('g'), emoji('h'), emoji('i'), text('jk') ]) ) }) it('Should parse "foo:bar:baz" as emoji', () => {
-
-
-
@@ -1,6 +1,6 @@import { parse } from '../src' import { bold, code, italic, root, strike, text } from './helpers' import { bold, code, emoji, italic, root, strike, text } from './helpers' describe('#4', () => { it('Should parse correctly', () => {
-
@@ -30,3 +30,9 @@expect(parse(test)).toEqual(expected) }) }) describe('#6', () => { it('Treat only "skin-tone-*" as variations', () => { expect(parse(':a::b:')).toEqual(root([emoji('a'), emoji('b')])) }) })
-