Wire FlightDetailsAccordion into OnlineBoardDetailsPage per leg
This commit is contained in:
@@ -155,4 +155,44 @@ describe("OnlineBoardDetailsPage", () => {
|
||||
expect(screen.getByTestId("flying-time")).toBeTruthy();
|
||||
expect(screen.getByText("Total flying time: 10:30")).toBeTruthy();
|
||||
});
|
||||
|
||||
describe("accordion integration", () => {
|
||||
it("does not render accordion when leg has no transition or extended equipment", () => {
|
||||
// Default mockFlight has no transition/equipment.aircraft/meal/services
|
||||
render(<OnlineBoardDetailsPage flightId={mockFlightId} locale="ru" canonicalOrigin="https://example.com" />);
|
||||
expect(screen.queryByTestId("flight-details-accordion")).toBeNull();
|
||||
});
|
||||
|
||||
it("renders accordion when leg has transition data", () => {
|
||||
const flightWithTransition: IDirectFlight = {
|
||||
...mockFlight,
|
||||
leg: {
|
||||
...mockFlight.leg,
|
||||
transition: {
|
||||
registration: {
|
||||
start: {
|
||||
dayChange: { value: 0, title: "" },
|
||||
local: "10:00",
|
||||
localTime: "10:00",
|
||||
tzOffset: 0,
|
||||
utc: "10:00",
|
||||
},
|
||||
end: {
|
||||
dayChange: { value: 0, title: "" },
|
||||
local: "",
|
||||
localTime: "",
|
||||
tzOffset: 0,
|
||||
utc: "",
|
||||
},
|
||||
status: "InProgress",
|
||||
isActual: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
mockState = { flight: flightWithTransition, loading: false, error: null };
|
||||
render(<OnlineBoardDetailsPage flightId={mockFlightId} locale="ru" canonicalOrigin="https://example.com" />);
|
||||
expect(screen.getByTestId("flight-details-accordion")).toBeTruthy();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -18,6 +18,7 @@ import { useFlightDetails } from "../hooks/useFlightDetails.js";
|
||||
import { useLiveFlightDetails } from "../hooks/useLiveFlightDetails.js";
|
||||
import { buildFlightDetailsSeo } from "../seo.js";
|
||||
import { buildFlightJsonLd } from "../json-ld.js";
|
||||
import { FlightDetailsAccordion } from "./details-panels/FlightDetailsAccordion.js";
|
||||
import type { IParsedFlightId, IFlightLeg } from "../types.js";
|
||||
|
||||
export interface OnlineBoardDetailsPageProps {
|
||||
@@ -112,6 +113,7 @@ function FlightLegs({ legs }: { legs: IFlightLeg[] }): JSX.Element {
|
||||
{leg.equipment.code ? ` (${leg.equipment.code})` : ""}
|
||||
</div>
|
||||
)}
|
||||
<FlightDetailsAccordion leg={leg} viewType="Onlineboard" />
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user