1
0
mirror of https://github.com/matrix-org/matrix-react-sdk.git synced 2025-08-07 21:23:00 +03:00
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski
2024-08-02 14:03:31 +01:00
parent 899ba238ac
commit df1b7772f2
10 changed files with 95 additions and 24 deletions

View File

@@ -23,7 +23,9 @@ import SyntaxHighlight from "../../../../src/components/views/elements/SyntaxHig
describe("<SyntaxHighlight />", () => {
it("renders", async () => {
const { container } = render(<SyntaxHighlight>console.log("Hello, World!");</SyntaxHighlight>);
const { container } = render(<SyntaxHighlight>console.log("Hello, World!");</SyntaxHighlight>, {
legacyRoot: true,
});
await waitFor(() => expect(container.querySelector(".language-arcade")).toBeTruthy());
expect(container).toMatchSnapshot();
});
@@ -31,7 +33,9 @@ describe("<SyntaxHighlight />", () => {
it.each(["json", "javascript", "css"])("uses the provided language", async (lang) => {
const mock = jest.spyOn(hljs, "highlight");
const { container } = render(<SyntaxHighlight language={lang}>// Hello, World</SyntaxHighlight>);
const { container } = render(<SyntaxHighlight language={lang}>// Hello, World</SyntaxHighlight>, {
legacyRoot: true,
});
await waitFor(() => expect(container.querySelector(`.language-${lang}`)).toBeTruthy());
const [_lang, opts] = mock.mock.lastCall!;