|
1 | | -import { expect, it, vi } from "vite-plus/test"; |
| 1 | +import { expect, it } from "vite-plus/test"; |
2 | 2 | import { userEvent } from "vite-plus/test/browser"; |
3 | 3 |
|
4 | 4 | import { render } from "../../../test/render"; |
@@ -34,43 +34,3 @@ it("keeps keyboard scrolling available as a streamed equation outgrows its viewp |
34 | 34 | await userEvent.keyboard("{Tab}"); |
35 | 35 | await expect.element(screen.getByRole("button", { name: "After equation" })).toHaveFocus(); |
36 | 36 | }); |
37 | | - |
38 | | -it("typesets equations whose labels have an unescaped percent", async () => { |
39 | | - // The reported multiline equation, line breaks included. |
40 | | - const issue = |
41 | | - "R_e=\\underbrace{\\frac{1.0176}{32}}_{\\text{3.18% dividend yield}}\n+\\underbrace{6\\%}_{\\text{growth}}\n=\\boxed{9.18\\%}"; |
42 | | - const typeset = [ |
43 | | - issue, |
44 | | - "\\text{100%% yield}", |
45 | | - "\\begin{aligned}x\\\\%\\end{aligned}", |
46 | | - "\\begin{aligned}\nx &= 1 % +999\n\\\\ y &= \\text{2%}\n\\end{aligned}", |
47 | | - "\\verb|50%|+\n\\text{2%}", |
48 | | - "x % note\n+ 1", |
49 | | - ]; |
50 | | - const raw = ["\\frac{1", "\\text{50 % off}", "\\verb|50%+\\text{2%}"]; |
51 | | - const equations = (tex: string[]) => tex.map((t) => <MarkdownMath key={t} tex={t} display />); |
52 | | - await using screen = await render(<>{equations(typeset)}</>); |
53 | | - const rendered = () => [...screen.container.querySelectorAll("[data-markdown-math]")]; |
54 | | - const visibleText = (index: number) => |
55 | | - rendered()[index]?.querySelector(".katex-html")?.textContent?.replaceAll("\u00a0", " "); |
56 | | - await vi.waitFor(() => { |
57 | | - for (const equation of rendered()) expect(equation.querySelector(".katex")).not.toBeNull(); |
58 | | - }); |
59 | | - expect(visibleText(0)).toContain("3.18% dividend yield"); |
60 | | - expect(visibleText(0)).toContain("9.18%"); |
61 | | - expect(rendered()[0]?.getAttribute("data-markdown-copy")).toBe(`\\[\n${issue}\n\\]\n\n`); |
62 | | - expect(visibleText(1)).toContain("100%% yield"); |
63 | | - expect(visibleText(3)).toContain("2%"); |
64 | | - expect(visibleText(3)).not.toContain("999"); |
65 | | - expect(visibleText(4)).toContain("50%"); |
66 | | - expect(visibleText(4)).toContain("2%"); |
67 | | - expect(visibleText(5)).not.toContain("note"); |
68 | | - |
69 | | - // KaTeX has loaded, so these render their final result in this commit. |
70 | | - await screen.rerender(<>{equations([...typeset, ...raw])}</>); |
71 | | - raw.forEach((tex, offset) => { |
72 | | - const equation = rendered()[typeset.length + offset]; |
73 | | - expect(equation?.querySelector(".katex")).toBeNull(); |
74 | | - expect(equation?.textContent).toBe(`\\[\n${tex}\n\\]`); |
75 | | - }); |
76 | | -}); |
0 commit comments