fix some texts

This commit is contained in:
ewwwwwwww 2022-07-07 17:52:29 -07:00
parent 8ef60cdf0b
commit f3c350aeef
3 changed files with 9 additions and 21 deletions

View File

@ -51,12 +51,12 @@ describe('emoji', () => {
});
it('does an emoji that has no shortcode', () => {
expect(emojify('👁‍🗨')).toEqual('<img draggable="false" class="emojione" alt="👁‍🗨" title="" src="/packs/emoji/1f441-200d-1f5e8.svg" />');
expect(emojify('👁‍🗨')).toEqual('<img draggable="false" class="emojione" alt="👁‍🗨\" title=":eye-in-speech-bubble:" src="/packs/emoji/1f441-200d-1f5e8.svg" />');
});
it('skips the textual presentation VS15 character', () => {
expect(emojify('✴︎')) // This is U+2734 EIGHT POINTED BLACK STAR then U+FE0E VARIATION SELECTOR-15
.toEqual('<img draggable="false" class="emojione" alt="✴" title=":eight_pointed_black_star:" src="/packs/emoji/2734.svg" />');
.toEqual('<img draggable="false" class="emojione" alt="✴" title=":eight_pointed_black_star:" src="/packs/emoji/2734.svg" />');
});
it('full v14 unicode emoji map', () => {

View File

@ -15,34 +15,27 @@ describe('emoji_index', () => {
},
];
expect(search('pineapple').map(trimEmojis)).toEqual(expected);
// expect(emojiIndex.search('pineapple').map(trimEmojis)).toEqual(expected);
});
it('orders search results correctly', () => {
const expected = [
{
id: 'apple',
unified: '1f34e',
native: '🍎',
},
{
id: 'pineapple',
unified: '1f34d',
native: '🍍',
},
{
id: 'apple',
unified: '1f34e',
native: '🍎',
},
{
id: 'green_apple',
unified: '1f34f',
native: '🍏',
},
{
id: 'iphone',
unified: '1f4f1',
native: '📱',
},
];
expect(search('apple').map(trimEmojis)).toEqual(expected);
// expect(emojiIndex.search('apple').map(trimEmojis)).toEqual(expected);
});
it('(different behavior from emoji-mart) do not erases custom emoji if not passed again', () => {
@ -68,7 +61,6 @@ describe('emoji_index', () => {
},
];
expect(search('masto').map(trimEmojis)).toEqual(lightExpected);
// expect(emojiIndex.search('masto').map(trimEmojis)).toEqual(expected);
});
it('(different behavior from emoji-mart) erases custom emoji if another is passed', () => {
@ -88,7 +80,6 @@ describe('emoji_index', () => {
// emojiIndex.search('', { custom });
const expected = [];
expect(search('masto', { custom: [] }).map(trimEmojis)).toEqual(expected);
// expect(emojiIndex.search('masto').map(trimEmojis)).toEqual(expected);
});
it('handles custom emoji', () => {
@ -113,7 +104,6 @@ describe('emoji_index', () => {
},
];
expect(search('masto', { custom }).map(trimEmojis)).toEqual(expected);
// expect(emojiIndex.search('masto', { custom }).map(trimEmojis)).toEqual(expected);
});
it('does an emoji whose unified name is irregular', () => {
@ -135,7 +125,6 @@ describe('emoji_index', () => {
},
];
expect(search('polo').map(trimEmojis)).toEqual(expected);
// expect(emojiIndex.search('polo').map(trimEmojis)).toEqual(expected);
});
it('can search for thinking_face', () => {
@ -147,7 +136,6 @@ describe('emoji_index', () => {
},
];
expect(search('thinking_fac').map(trimEmojis)).toEqual(expected);
// expect(emojiIndex.search('thinking_fac').map(trimEmojis)).toEqual(expected);
});
it('can search for woman-facepalming', () => {
@ -159,6 +147,5 @@ describe('emoji_index', () => {
},
];
expect(search('woman-facep').map(trimEmojis)).toEqual(expected);
// expect(emojiIndex.search('woman-facep').map(trimEmojis)).toEqual(expected);
});
});

View File

@ -43,6 +43,7 @@ const tweaks = {
'🏳‍🌈': ['1f3f3-fe0f-200d-1f308', 'rainbow-flag'],
'🏳‍⚧️': ['1f3f3-fe0f-200d-26a7-fe0f', 'transgender_flag'],
'🏳‍⚧': ['1f3f3-fe0f-200d-26a7-fe0f', 'transgender_flag'],
'✴︎': ['2734', 'eight_pointed_black_star'],
};
export const generateMappings = (data: EmojiData): UnicodeMap => {
@ -59,7 +60,7 @@ export const generateMappings = (data: EmojiData): UnicodeMap => {
// @ts-ignore
result[native] = { unified: stripped, shortcode: value.id };
} else {
const twemojiCode = replaceAll(stripped, '-fe0f', '');
const twemojiCode = replaceAll(stripped, '-fe0f', '').replace('fe0e', '');
// @ts-ignore
result[native] = { unified: twemojiCode, shortcode: value.id };