32 lines
2.4 KiB
JavaScript
32 lines
2.4 KiB
JavaScript
import { readFileSync } from "node:fs";
|
|
|
|
|
|
function assert(condition, message) {
|
|
if (!condition) throw new Error(message);
|
|
}
|
|
|
|
const source = readFileSync("src/components/GlobalSearch.tsx", "utf8");
|
|
const layoutSource = readFileSync("src/components/searchOverlayLayout.ts", "utf8");
|
|
const styles = readFileSync("src/styles/search.css", "utf8");
|
|
const requestSource = readFileSync("src/components/useSearchResults.ts", "utf8");
|
|
const filterSource = readFileSync("src/components/SearchFilters.tsx", "utf8");
|
|
|
|
assert(source.includes("titlebar-icon-link titlebar-search-button"), "Search uses the shared titlebar icon-button appearance");
|
|
assert(source.includes("onClick={openOverlay}"), "clicking the titlebar Search command opens Search");
|
|
assert(!source.includes("sourceInputRef"), "the titlebar no longer reserves a persistent Search field");
|
|
assert(source.includes("<Dialog"), "Search uses the shared Dialog component");
|
|
assert(source.includes("portal"), "the Search dialog portals above the complete shell");
|
|
assert(source.includes("calculateSearchOverlayLayout"), "the overlay position is derived from the titlebar command");
|
|
assert(source.includes("useSearchCatalogue") && requestSource.includes("listSearchProviders"), "the overlay loads the complete filter catalogue through the shared Search hook");
|
|
assert(source.includes("<SearchFilters") && filterSource.includes("MultiSelectFilter"), "the overlay uses Search-owned facets with Core-owned dropdown behavior");
|
|
assert(source.includes("limit: 50"), "the overlay requests full result windows rather than titlebar suggestions");
|
|
assert(source.includes("response?.next_cursor"), "the overlay retains cursor pagination");
|
|
assert(source.includes('usePlatformUiCapabilities<SearchContextsUiCapability>("search.contexts")'), "contextual Search contributions are consumed");
|
|
assert(!source.includes("navigate(`/search"), "normal Search interaction no longer opens a page route");
|
|
assert(layoutSource.includes("const inputWidth = width"), "the opened query field spans the Search overlay");
|
|
assert(layoutSource.includes("(viewportWidth - width) / 2"), "the Search overlay is centered in the viewport");
|
|
assert(styles.includes("margin-top: 8px"), "results follow the opened query field without overlap");
|
|
assert(styles.includes(".search-overlay-results-panel"), "full Search results have a bounded overlay panel");
|
|
|
|
console.log("Search overlay structure checks passed.");
|