sync racing standings #80
1 changed files with 7 additions and 4 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
import { describe, it, expect, vi, beforeEach } from "vitest";
|
import { describe, it, expect, vi, beforeEach } from "vitest";
|
||||||
import { render, screen, within } from "@testing-library/react";
|
import { render, screen, within, fireEvent } from "@testing-library/react";
|
||||||
import userEvent from "@testing-library/user-event";
|
import userEvent from "@testing-library/user-event";
|
||||||
import { AvailableParticipantsSection } from "~/components/draft/AvailableParticipantsSection";
|
import { AvailableParticipantsSection } from "~/components/draft/AvailableParticipantsSection";
|
||||||
import type { DraftIneligibilityReason } from "~/lib/draft-eligibility";
|
import type { DraftIneligibilityReason } from "~/lib/draft-eligibility";
|
||||||
|
|
@ -106,7 +106,7 @@ describe("AvailableParticipantsSection", () => {
|
||||||
expect(screen.getByText("Show Drafted")).toBeInTheDocument();
|
expect(screen.getByText("Show Drafted")).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("renders Show Ineligible and Show drafted sports toggles when hasTeam=true", async () => {
|
it("renders Show Ineligible and Show drafted sports toggles when hasTeam=true", () => {
|
||||||
render(
|
render(
|
||||||
<AvailableParticipantsSection
|
<AvailableParticipantsSection
|
||||||
{...defaultProps}
|
{...defaultProps}
|
||||||
|
|
@ -115,8 +115,11 @@ describe("AvailableParticipantsSection", () => {
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
expect(screen.getByText("Show Ineligible")).toBeInTheDocument();
|
expect(screen.getByText("Show Ineligible")).toBeInTheDocument();
|
||||||
// Show drafted sports lives inside the sport filter dropdown
|
// Show drafted sports lives inside the sport filter dropdown.
|
||||||
await clickFirstSportFilterTrigger("Filter by sport: All Sports");
|
// Use fireEvent instead of user.click to avoid Radix UI timer hang when
|
||||||
|
// hasTeam=true renders extra Checkbox components that stall userEvent's
|
||||||
|
// act() settlement loop.
|
||||||
|
fireEvent.click(screen.getAllByRole("button", { name: "Filter by sport: All Sports" })[0]);
|
||||||
const dialog = screen.getByRole("dialog");
|
const dialog = screen.getByRole("dialog");
|
||||||
expect(within(dialog).getByText("Show drafted sports")).toBeInTheDocument();
|
expect(within(dialog).getByText("Show drafted sports")).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue