fix(frontend/emoji) restore U+FE0F for simple emojis (#12866)
* fix(frontend/emoji) restore U+FE0F for simple emojis * Update CHANGELOG.md --------- Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
This commit is contained in:
parent
c6a4caa8be
commit
5e71418d5c
5 changed files with 65 additions and 18 deletions
41
packages/frontend/test/emoji.test.ts
Normal file
41
packages/frontend/test/emoji.test.ts
Normal file
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and other misskey contributors
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { describe, test, assert, afterEach } from 'vitest';
|
||||
import { render, cleanup, type RenderResult } from '@testing-library/vue';
|
||||
import { defaultStoreState } from './init.js';
|
||||
import { getEmojiName } from '@/scripts/emojilist.js';
|
||||
import { components } from '@/components/index.js';
|
||||
import { directives } from '@/directives/index.js';
|
||||
import MkEmoji from '@/components/global/MkEmoji.vue';
|
||||
|
||||
describe('Emoji', () => {
|
||||
const renderEmoji = (emoji: string): RenderResult => {
|
||||
return render(MkEmoji, {
|
||||
props: { emoji },
|
||||
global: { directives, components },
|
||||
});
|
||||
};
|
||||
|
||||
afterEach(() => {
|
||||
cleanup();
|
||||
defaultStoreState.emojiStyle = '';
|
||||
});
|
||||
|
||||
describe('MkEmoji', () => {
|
||||
test('Should render selector-less heart with color in native mode', async () => {
|
||||
defaultStoreState.emojiStyle = 'native';
|
||||
const mkEmoji = await renderEmoji('\u2764'); // monochrome heart
|
||||
assert.ok(mkEmoji.queryByText('\u2764\uFE0F')); // colored heart
|
||||
assert.ok(!mkEmoji.queryByText('\u2764'));
|
||||
});
|
||||
});
|
||||
|
||||
describe('Emoji list', () => {
|
||||
test('Should get the name of the heart', () => {
|
||||
assert.strictEqual(getEmojiName('\u2764'), 'heart');
|
||||
});
|
||||
});
|
||||
});
|
|
@ -17,21 +17,23 @@ updateI18n(locales['en-US']);
|
|||
// XXX: misskey-js panics if WebSocket is not defined
|
||||
vi.stubGlobal('WebSocket', class WebSocket extends EventTarget { static CLOSING = 2; });
|
||||
|
||||
export const defaultStoreState: Record<string, unknown> = {
|
||||
|
||||
// なんかtestがうまいこと動かないのでここに書く
|
||||
dataSaver: {
|
||||
media: false,
|
||||
avatar: false,
|
||||
urlPreview: false,
|
||||
code: false,
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
// XXX: defaultStore somehow becomes undefined in vitest?
|
||||
vi.mock('@/store.js', () => {
|
||||
return {
|
||||
defaultStore: {
|
||||
state: {
|
||||
|
||||
// なんかtestがうまいこと動かないのでここに書く
|
||||
dataSaver: {
|
||||
media: false,
|
||||
avatar: false,
|
||||
urlPreview: false,
|
||||
code: false,
|
||||
},
|
||||
|
||||
},
|
||||
state: defaultStoreState,
|
||||
},
|
||||
};
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue