Files
flights_web_raw/node_modules/hono/dist/jsx/intrinsic-element/components.js
T
gnezim 60e2149072 Add comprehensive e2e test suites for Tasks 16-25
Tasks 16-20: Online Board Tests (Search/Filter, Tabs, Flight List, Details Modal, Time/Date)
- Task 16: Search & Filter tests (37 tests) - departure/arrival cities, passenger count, cabin class
- Task 17: Arrival/Departure Tabs tests (45 tests) - tab switching, flight display, sorting
- Task 18: Flight List View tests (50 tests) - display, sorting, filtering, pagination, loading states
- Task 19: Flight Details Modal tests (40 tests) - opening/closing, content display, actions
- Task 20: Time & Date Filter tests (43 tests) - date selection, time ranges, calendar navigation

Tasks 21-25: Flight Details Tests (Flight Info, Passengers, Seats, Services, Fares)
- Task 21: Flight Info Display tests (40 tests) - basic info, airports, route visualization, timeline
- Task 22: Passenger Info tests (50 tests) - passenger list, details, services, special requirements
- Task 23: Seat Selection tests (50 tests) - seat map, selection, categories, recommendations
- Task 24: Service Selection tests (25 tests) - baggage, meals, seats, summary
- Task 25: Fare Display tests (55 tests) - fare breakdown, comparisons, discounts, refunds

All tests follow AAA pattern and use data-testid selectors matching Angular version.
Total: 245 tests across 10 feature suites.
2026-04-05 19:25:03 +03:00

166 lines
5.4 KiB
JavaScript

// src/jsx/intrinsic-element/components.ts
import { raw } from "../../helper/html/index.js";
import { JSXNode, getNameSpaceContext } from "../base.js";
import { toArray } from "../children.js";
import { PERMALINK } from "../constants.js";
import { useContext } from "../context.js";
import {
dataPrecedenceAttr,
deDupeKeyMap,
isStylesheetLinkWithPrecedence,
shouldDeDupeByKey
} from "./common.js";
var metaTagMap = /* @__PURE__ */ new WeakMap();
var insertIntoHead = (tagName, tag, props, precedence) => ({ buffer, context }) => {
if (!buffer) {
return;
}
const map = metaTagMap.get(context) || {};
metaTagMap.set(context, map);
const tags = map[tagName] ||= [];
let duped = false;
const deDupeKeys = deDupeKeyMap[tagName];
const deDupeByKey = shouldDeDupeByKey(tagName, precedence !== void 0);
if (deDupeByKey) {
LOOP: for (const [, tagProps] of tags) {
if (tagName === "link" && !(tagProps.rel === "stylesheet" && tagProps[dataPrecedenceAttr] !== void 0)) {
continue;
}
for (const key of deDupeKeys) {
if ((tagProps?.[key] ?? null) === props?.[key]) {
duped = true;
break LOOP;
}
}
}
}
if (duped) {
buffer[0] = buffer[0].replaceAll(tag, "");
} else if (deDupeByKey || tagName === "link") {
tags.push([tag, props, precedence]);
} else {
tags.unshift([tag, props, precedence]);
}
if (buffer[0].indexOf("</head>") !== -1) {
let insertTags;
if (tagName === "link" || precedence !== void 0) {
const precedences = [];
insertTags = tags.map(([tag2, , tagPrecedence], index) => {
if (tagPrecedence === void 0) {
return [tag2, Number.MAX_SAFE_INTEGER, index];
}
let order = precedences.indexOf(tagPrecedence);
if (order === -1) {
precedences.push(tagPrecedence);
order = precedences.length - 1;
}
return [tag2, order, index];
}).sort((a, b) => a[1] - b[1] || a[2] - b[2]).map(([tag2]) => tag2);
} else {
insertTags = tags.map(([tag2]) => tag2);
}
insertTags.forEach((tag2) => {
buffer[0] = buffer[0].replaceAll(tag2, "");
});
buffer[0] = buffer[0].replace(/(?=<\/head>)/, insertTags.join(""));
}
};
var returnWithoutSpecialBehavior = (tag, children, props) => raw(new JSXNode(tag, props, toArray(children ?? [])).toString());
var documentMetadataTag = (tag, children, props, sort) => {
if ("itemProp" in props) {
return returnWithoutSpecialBehavior(tag, children, props);
}
let { precedence, blocking, ...restProps } = props;
precedence = sort ? precedence ?? "" : void 0;
if (sort) {
restProps[dataPrecedenceAttr] = precedence;
}
const string = new JSXNode(tag, restProps, toArray(children || [])).toString();
if (string instanceof Promise) {
return string.then(
(resString) => raw(string, [
...resString.callbacks || [],
insertIntoHead(tag, resString, restProps, precedence)
])
);
} else {
return raw(string, [insertIntoHead(tag, string, restProps, precedence)]);
}
};
var title = ({ children, ...props }) => {
const nameSpaceContext = getNameSpaceContext();
if (nameSpaceContext) {
const context = useContext(nameSpaceContext);
if (context === "svg" || context === "head") {
return new JSXNode(
"title",
props,
toArray(children ?? [])
);
}
}
return documentMetadataTag("title", children, props, false);
};
var script = ({
children,
...props
}) => {
const nameSpaceContext = getNameSpaceContext();
if (["src", "async"].some((k) => !props[k]) || nameSpaceContext && useContext(nameSpaceContext) === "head") {
return returnWithoutSpecialBehavior("script", children, props);
}
return documentMetadataTag("script", children, props, false);
};
var style = ({
children,
...props
}) => {
if (!["href", "precedence"].every((k) => k in props)) {
return returnWithoutSpecialBehavior("style", children, props);
}
props["data-href"] = props.href;
delete props.href;
return documentMetadataTag("style", children, props, true);
};
var link = ({ children, ...props }) => {
if (["onLoad", "onError"].some((k) => k in props) || props.rel === "stylesheet" && (!("precedence" in props) || "disabled" in props)) {
return returnWithoutSpecialBehavior("link", children, props);
}
return documentMetadataTag("link", children, props, isStylesheetLinkWithPrecedence(props));
};
var meta = ({ children, ...props }) => {
const nameSpaceContext = getNameSpaceContext();
if (nameSpaceContext && useContext(nameSpaceContext) === "head") {
return returnWithoutSpecialBehavior("meta", children, props);
}
return documentMetadataTag("meta", children, props, false);
};
var newJSXNode = (tag, { children, ...props }) => (
// eslint-disable-next-line @typescript-eslint/no-explicit-any
new JSXNode(tag, props, toArray(children ?? []))
);
var form = (props) => {
if (typeof props.action === "function") {
props.action = PERMALINK in props.action ? props.action[PERMALINK] : void 0;
}
return newJSXNode("form", props);
};
var formActionableElement = (tag, props) => {
if (typeof props.formAction === "function") {
props.formAction = PERMALINK in props.formAction ? props.formAction[PERMALINK] : void 0;
}
return newJSXNode(tag, props);
};
var input = (props) => formActionableElement("input", props);
var button = (props) => formActionableElement("button", props);
export {
button,
form,
input,
link,
meta,
script,
style,
title
};