feat(housekeeping): add global command deck search
This commit is contained in:
1 parent
2e95a106e0
commit
bcb0ca977f
18 files changed
+1353
-23
No files matched your search
@@ -3,7 +3,7 @@ import { createRequire } from "node:module";
|
||||
import { join, posix } from "node:path";
|
||||
import { createElement, type ReactElement } from "react";
|
||||
import { renderToStaticMarkup } from "react-dom/server";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import { CONTENT_ROUTE_IDS } from "../domains/content/routes";
|
||||
import { ECONOMY_ROUTE_IDS } from "../domains/economy/routes";
|
||||
import { HOTEL_ROUTE_IDS } from "../domains/hotel/routes";
|
||||
@@ -17,12 +17,20 @@ import { isHousekeepingPreviewEnabled } from "./preview-gate";
|
||||
import { createHousekeepingRegistry } from "./registry";
|
||||
import { CommandTrigger } from "./shell/command-trigger";
|
||||
|
||||
vi.mock("@/actions/housekeeping-search", () => ({
|
||||
executeHousekeepingSearch: vi.fn(),
|
||||
}));
|
||||
|
||||
const HOUSEKEEPING_ROOT = "src/features/housekeeping";
|
||||
const SERVER_CAPABILITY_CONTEXT =
|
||||
"src/features/housekeeping/foundation/server-capability-context.ts";
|
||||
const PERMISSIONS_ADAPTER = "src/lib/permissions";
|
||||
const DOMAIN_MODULE_ROOT = "src/features/housekeeping/domains";
|
||||
const approvedRuntimeImports = new Map<string, ReadonlySet<string>>([
|
||||
[
|
||||
"src/features/housekeeping/foundation/shell/command-deck.tsx",
|
||||
new Set(["src/actions/housekeeping-search"]),
|
||||
],
|
||||
[
|
||||
"src/features/housekeeping/domains/hotel/commands/studio-commands.ts",
|
||||
new Set(["src/features/housekeeping/domains/hotel/queries/studio"]),
|
||||
@@ -1553,16 +1561,30 @@ describe("housekeeping foundation completion contracts", () => {
|
||||
expect(executablePropNames(mutatedTrigger)).toEqual(["onClick"]);
|
||||
});
|
||||
|
||||
it("renders one inert localized command affordance", () => {
|
||||
const sentinel = "HK::comando-localizzato-disabilitato";
|
||||
const trigger = CommandTrigger({ label: sentinel });
|
||||
it("renders one enabled localized command affordance", () => {
|
||||
const sentinel = "HK::ricerca-localizzata";
|
||||
const trigger = CommandTrigger({
|
||||
label: sentinel,
|
||||
labels: {
|
||||
placeholder: "HK::placeholder",
|
||||
navigation: "HK::navigation",
|
||||
commands: "HK::commands",
|
||||
entities: "HK::entities",
|
||||
loading: "HK::loading",
|
||||
empty: "HK::empty",
|
||||
partial: "HK::partial",
|
||||
close: "HK::close",
|
||||
},
|
||||
surface: "preview",
|
||||
});
|
||||
const html = renderToStaticMarkup(trigger);
|
||||
const buttons = html.match(/<button\b[^>]*>/g) ?? [];
|
||||
expect(executablePropNames(trigger)).toEqual([]);
|
||||
|
||||
expect(buttons).toHaveLength(1);
|
||||
expect(buttons[0]).toMatch(/\sdisabled(?:=""|(?=\s|>))/);
|
||||
expect(html).toContain(`>${sentinel}</button>`);
|
||||
expect(buttons[0]).not.toMatch(/\sdisabled(?:=""|(?=\s|>))/);
|
||||
expect(buttons[0]).toContain('aria-haspopup="dialog"');
|
||||
expect(html).toContain(`>${sentinel}</span>`);
|
||||
});
|
||||
|
||||
it("validates the complete 137-row migration matrix without issues", () => {
|
||||
|
||||
Reference in new issue
Block a user