Fix StandingsPreview test ambiguous text query for team names
FlagSvg renders a <title> element with the team name for accessibility,
so getByText("Team Alpha") matched two elements. Scope the query to the
<p> element to target only the visible team name display.
https://claude.ai/code/session_01CVt5Vo2PDGY4G3wSWbsmRG
This commit is contained in:
parent
a26294446d
commit
d8e5be4558
1 changed files with 4 additions and 2 deletions
|
|
@ -70,8 +70,10 @@ describe("StandingsPreview", () => {
|
|||
];
|
||||
renderWithRouter(<StandingsPreview entries={entries} />);
|
||||
|
||||
expect(screen.getByText("Team Alpha")).toBeInTheDocument();
|
||||
expect(screen.getByText("Team Beta")).toBeInTheDocument();
|
||||
// Use selector to target only the <p> element — the team name also appears
|
||||
// in the SVG <title> for accessibility, causing multiple matches otherwise.
|
||||
expect(screen.getByText("Team Alpha", { selector: "p" })).toBeInTheDocument();
|
||||
expect(screen.getByText("Team Beta", { selector: "p" })).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("renders owner name below team name", () => {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue