Emoji: Link Replacement (#36341)

This commit is contained in:
Echo authored and GitHub committed 2025-10-06 09:31:10 +00:00
1 parent 4dc21d7afd
commit ffac4cb05f
7 files changed
+346 -116

No files matched your search

@@ -53,13 +53,19 @@ describe('html', () => {
it('calls onElement callback', () => {
const input = '<p>lorem ipsum</p>';
const onElement = vi.fn(
(element: HTMLElement, children: React.ReactNode[]) =>
React.createElement(element.tagName.toLowerCase(), {}, ...children),
const onElement = vi.fn<html.OnElementHandler>(
(element, props, children) =>
React.createElement(
element.tagName.toLowerCase(),
props,
...children,
),
);
html.htmlStringToComponents(input, { onElement });
expect(onElement).toHaveBeenCalledExactlyOnceWith(
expect.objectContaining({ tagName: 'P' }),
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
expect.objectContaining({ key: expect.any(String) }),
expect.arrayContaining(['lorem ipsum']),
{},
);
@@ -71,6 +77,8 @@ describe('html', () => {
const output = html.htmlStringToComponents(input, { onElement });
expect(onElement).toHaveBeenCalledExactlyOnceWith(
expect.objectContaining({ tagName: 'P' }),
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
expect.objectContaining({ key: expect.any(String) }),
expect.arrayContaining(['lorem ipsum']),
{},
);