feat: add Python and Java regex engines
This commit is contained in:
@@ -53,4 +53,67 @@ describe("QuickReference", () => {
|
||||
screen.getByRole("link", { name: "PCRE2 pattern documentation" }),
|
||||
).toHaveAttribute("href", expect.stringContaining("pcre.org"));
|
||||
});
|
||||
|
||||
it("shows an original Python 3.14 re reference without borrowing ECMAScript syntax", async () => {
|
||||
const user = userEvent.setup();
|
||||
render(<QuickReference flavour="python" onUsePattern={vi.fn()} />);
|
||||
|
||||
expect(
|
||||
screen.getByText("Original Python 3.14 re reference"),
|
||||
).toBeInTheDocument();
|
||||
expect(screen.getByText("8 of 8 constructs")).toBeInTheDocument();
|
||||
|
||||
await user.type(screen.getByLabelText("Filter constructs"), "absolute end");
|
||||
|
||||
expect(screen.getByText("Absolute end anchor")).toBeInTheDocument();
|
||||
expect(screen.getByText("\\z")).toBeInTheDocument();
|
||||
expect(screen.getByText("python")).toBeInTheDocument();
|
||||
expect(
|
||||
screen.getByRole("link", { name: "Python 3.14 re documentation" }),
|
||||
).toHaveAttribute("href", "https://docs.python.org/3.14/library/re.html");
|
||||
});
|
||||
|
||||
it("shows an original Java Pattern reference from the official Java API", async () => {
|
||||
const user = userEvent.setup();
|
||||
render(<QuickReference flavour="java" onUsePattern={vi.fn()} />);
|
||||
|
||||
expect(
|
||||
screen.getByText("Original Java Pattern reference"),
|
||||
).toBeInTheDocument();
|
||||
expect(screen.getByText("9 of 9 constructs")).toBeInTheDocument();
|
||||
expect(
|
||||
screen.getByText(
|
||||
/bundled TeaVM 0\.15\.0 adapter is a tested compatibility subset/u,
|
||||
),
|
||||
).toBeInTheDocument();
|
||||
|
||||
await user.type(screen.getByLabelText("Filter constructs"), "intersection");
|
||||
|
||||
expect(
|
||||
screen.getByText("Character-class intersection"),
|
||||
).toBeInTheDocument();
|
||||
expect(screen.getByText("[class&&class]")).toBeInTheDocument();
|
||||
expect(screen.getByText("java")).toBeInTheDocument();
|
||||
expect(
|
||||
screen.getByRole("link", {
|
||||
name: "Java SE 25 Pattern documentation",
|
||||
}),
|
||||
).toHaveAttribute(
|
||||
"href",
|
||||
"https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/regex/Pattern.html",
|
||||
);
|
||||
});
|
||||
|
||||
it("does not relabel an unreviewed flavour as ECMAScript", () => {
|
||||
render(<QuickReference flavour="go" onUsePattern={vi.fn()} />);
|
||||
|
||||
expect(
|
||||
screen.getByText("Original Go regexp reference"),
|
||||
).toBeInTheDocument();
|
||||
expect(screen.getByText("0 of 0 constructs")).toBeInTheDocument();
|
||||
expect(screen.getByRole("status")).toHaveTextContent(
|
||||
"No reviewed quick reference is available for Go regexp.",
|
||||
);
|
||||
expect(screen.queryByText("Any character")).not.toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user