Fix schedule buy links in grouped results
This commit is contained in:
@@ -278,6 +278,32 @@ describe("schedule search results body — action strip", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("schedule search results — inline buy link", () => {
|
||||
it("threads buyUrlFor into grouped multi-day FlightList rows", () => {
|
||||
const firstDay = makeDirectFlight({
|
||||
depLocal: "2026-05-06T08:00:00+03:00",
|
||||
arrLocal: "2026-05-06T10:30:00+03:00",
|
||||
});
|
||||
const secondDay = makeDirectFlight({
|
||||
depLocal: "2026-05-07T14:00:00+03:00",
|
||||
arrLocal: "2026-05-07T16:30:00+03:00",
|
||||
});
|
||||
|
||||
render(
|
||||
<DayGroupedFlightList
|
||||
flights={[
|
||||
{ ...firstDay, id: "f-first-day" },
|
||||
{ ...secondDay, id: "f-second-day" },
|
||||
] as ISimpleFlight[]}
|
||||
buyUrlFor={(flight) => `https://example.test/buy/${flight.id}`}
|
||||
/>,
|
||||
);
|
||||
|
||||
const firstBuyLink = screen.getByTestId("flight-card-buy-link");
|
||||
expect(firstBuyLink.getAttribute("href")).toBe("https://example.test/buy/f-first-day");
|
||||
});
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// §4.1.14.3 — DayGroupedFlightList grouping + day headers
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
@@ -363,6 +363,7 @@ export const DayGroupedFlightList: FC<DayGroupedFlightListProps> = ({
|
||||
direction="schedule"
|
||||
renderExpandedBody={renderScheduleBody}
|
||||
{...(onFlightClick ? { onFlightClick } : {})}
|
||||
{...(buyUrlFor ? { buyUrlFor } : {})}
|
||||
{...(resolvedInitialFlightId
|
||||
? { initialCurrentFlightId: resolvedInitialFlightId }
|
||||
: {})}
|
||||
|
||||
Reference in New Issue
Block a user