mirror of
https://github.com/Novaloop-AG/healthchat-web.git
synced 2026-11-05 22:25:36 +00:00
Add support for m.recent_emoji account data event (#33172)
* Improve types in AccountSettingsHandler * Add support for `m.recent_emoji` account data event Maintains read-compatibility with `io.element.recent_emoji` * Iterate * Make ts happier * Improve coverage * Improve coverage * Improve coverage
This commit is contained in:
committed by
GitHub
parent
5cfb68962d
commit
f0342ddbd2
@@ -13,6 +13,7 @@ import userEvent from "@testing-library/user-event";
|
||||
import EmojiPicker from "../../../../../src/components/views/emojipicker/EmojiPicker";
|
||||
import { stubClient } from "../../../../test-utils";
|
||||
import SettingsStore from "../../../../../src/settings/SettingsStore";
|
||||
import { SettingLevel } from "../../../../../src/settings/SettingLevel.ts";
|
||||
|
||||
describe("EmojiPicker", function () {
|
||||
stubClient();
|
||||
@@ -23,10 +24,7 @@ describe("EmojiPicker", function () {
|
||||
|
||||
beforeEach(() => {
|
||||
// Clear recent emojis to prevent test pollution
|
||||
jest.spyOn(SettingsStore, "getValue").mockImplementation((settingName) => {
|
||||
if (settingName === "recent_emoji") return [] as any;
|
||||
return jest.requireActual("../../../../../src/settings/SettingsStore").default.getValue(settingName);
|
||||
});
|
||||
SettingsStore.reset();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
@@ -98,10 +96,11 @@ describe("EmojiPicker", function () {
|
||||
|
||||
it("should initialize categories with recent as firstVisible when recent emojis exist", () => {
|
||||
// Mock recent emojis
|
||||
jest.spyOn(SettingsStore, "getValue").mockImplementation((settingName) => {
|
||||
if (settingName === "recent_emoji") return ["😀", "🎉", "❤️"] as any;
|
||||
return jest.requireActual("../../../../../src/settings/SettingsStore").default.getValue(settingName);
|
||||
});
|
||||
SettingsStore.setValue("recent_emoji", null, SettingLevel.ACCOUNT, [
|
||||
{ emoji: "😀", total: 3 },
|
||||
{ emoji: "🎉", total: 2 },
|
||||
{ emoji: "❤️", total: 2 },
|
||||
]);
|
||||
|
||||
const ref = createRef<EmojiPicker>();
|
||||
render(<EmojiPicker ref={ref} onChoose={(str: string) => false} onFinished={jest.fn()} />);
|
||||
@@ -394,10 +393,10 @@ describe("EmojiPicker", function () {
|
||||
|
||||
it("check tabindex for recent category when recent emojis exist", async () => {
|
||||
// Mock recent emojis
|
||||
jest.spyOn(SettingsStore, "getValue").mockImplementation((settingName) => {
|
||||
if (settingName === "recent_emoji") return ["😀", "🎉"] as any;
|
||||
return jest.requireActual("../../../../../src/settings/SettingsStore").default.getValue(settingName);
|
||||
});
|
||||
SettingsStore.setValue("recent_emoji", null, SettingLevel.ACCOUNT, [
|
||||
{ emoji: "😀", total: 3 },
|
||||
{ emoji: "🎉", total: 2 },
|
||||
]);
|
||||
|
||||
const { container } = render(<EmojiPicker onChoose={jest.fn()} onFinished={jest.fn()} />);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user