feat: let Studio create the topics and projects publishing requires
Publishing needs a topic and nothing could create one. The backend now owns that surface; this is its consumer — the management contract vendored, a gateway over its nine operations, and one Studio screen that lists, creates, and deletes topics and projects. The screen adds no CSS. It reuses the classes the working-copy list already uses, so it inherits Studio's spacing, type, and colour rather than growing a second visual vocabulary beside them. Scope stops at list/create/delete: renaming, phase changes, and visibility are implemented in the backend and declared in the contract, but their screens are a separate design. Two real defects surfaced while making the public port async, and both would have shipped: The search page and the header search dialog shared a query key. With an empty query, `["tech-log","search",""]` was identical for both, so react-query handed one surface the other's cache — different shapes — and the page died reading a field that was not there. Keys now name the surface. The explore filter's selects are uncontrolled and read `defaultValue`, which React applies once. Their options arrive later now, so the first render had nothing to match and the value stayed empty: a topic in the URL no longer showed as selected. The form key includes whether the catalog has arrived, so it remounts with the options present. Controlled inputs would be the other answer, but this form submits to build a URL — the URL owns the value. The route brought its own bookkeeping: a build chunk, a manual accessibility evidence file, and the CI artifact baseline that counts them. The gate pins a digest of its own shape precisely so a new route cannot slip in without that count being reviewed. Test harnesses that render public screens now assemble the query providers and await the settled paint, because the screens they render became async.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
// @vitest-environment jsdom
|
||||
|
||||
import { render } from "@testing-library/react";
|
||||
import { render, screen } from "@testing-library/react";
|
||||
import userEvent from "@testing-library/user-event";
|
||||
import { readFileSync } from "node:fs";
|
||||
import { resolve } from "node:path";
|
||||
@@ -14,6 +14,7 @@ import { FatalErrorState } from "../../../src/features/tech-log/presentation/pub
|
||||
import { PublicShell } from "../../../src/features/tech-log/presentation/public/public-shell.tsx";
|
||||
import { ApplicationProvider } from "../../../src/presentation/providers/application-provider.tsx";
|
||||
import { createTestApplication } from "../../helpers/create-test-application.ts";
|
||||
import { renderWithQueryProviders } from "../../helpers/query-providers.tsx";
|
||||
|
||||
let styleElement: HTMLStyleElement;
|
||||
|
||||
@@ -33,7 +34,7 @@ afterAll(() => {
|
||||
styleElement.remove();
|
||||
});
|
||||
|
||||
function renderPublicSurface(node: React.ReactNode) {
|
||||
async function renderPublicSurface(node: React.ReactNode) {
|
||||
const techLog = createTechLogFeatureInstalledInput(MOCK_STUDIO_INSTALL_CONTEXT).input;
|
||||
const shell = createElement(PublicShell, { children: node });
|
||||
const router = createElement(
|
||||
@@ -41,19 +42,24 @@ function renderPublicSurface(node: React.ReactNode) {
|
||||
{ initialEntries: ["/projects"] },
|
||||
shell,
|
||||
);
|
||||
return render(
|
||||
createElement(ApplicationProvider, {
|
||||
application: createTestApplication({
|
||||
featureInputs: { "tech-log": techLog },
|
||||
const view = render(
|
||||
renderWithQueryProviders(
|
||||
createElement(ApplicationProvider, {
|
||||
application: createTestApplication({
|
||||
featureInputs: { "tech-log": techLog },
|
||||
}),
|
||||
children: router,
|
||||
}),
|
||||
children: router,
|
||||
}),
|
||||
),
|
||||
);
|
||||
// 포트가 async 가 되면서 첫 페인트에는 데이터가 없다. 화면이 정착한 뒤 단언한다.
|
||||
await screen.findByRole("main");
|
||||
return view;
|
||||
}
|
||||
|
||||
describe("TechLog consumer-visible style contract", () => {
|
||||
it("applies the source typography, palette, shell width, and header spacing", () => {
|
||||
const view = renderPublicSurface(
|
||||
it("applies the source typography, palette, shell width, and header spacing", async () => {
|
||||
const view = await renderPublicSurface(
|
||||
createElement(
|
||||
"main",
|
||||
{ id: "main-content", className: "shell" },
|
||||
@@ -97,8 +103,8 @@ describe("TechLog consumer-visible style contract", () => {
|
||||
expect(getComputedStyle(wordmark).fontWeight).toBe("680");
|
||||
});
|
||||
|
||||
it("aligns code, table, and evidence widths with the article body", () => {
|
||||
const view = renderPublicSurface(
|
||||
it("aligns code, table, and evidence widths with the article body", async () => {
|
||||
const view = await renderPublicSurface(
|
||||
createElement(
|
||||
"main",
|
||||
{ id: "main-content", className: "shell" },
|
||||
@@ -152,7 +158,7 @@ describe("TechLog consumer-visible style contract", () => {
|
||||
|
||||
it("preserves keyboard focus and the real search-field focus style", async () => {
|
||||
const user = userEvent.setup();
|
||||
const view = renderPublicSurface(
|
||||
const view = await renderPublicSurface(
|
||||
createElement(
|
||||
"main",
|
||||
{ id: "main-content", className: "shell" },
|
||||
@@ -181,8 +187,8 @@ describe("TechLog consumer-visible style contract", () => {
|
||||
);
|
||||
});
|
||||
|
||||
it("keeps every header and dialog control at the source minimum target size", () => {
|
||||
const view = renderPublicSurface(
|
||||
it("keeps every header and dialog control at the source minimum target size", async () => {
|
||||
const view = await renderPublicSurface(
|
||||
createElement(
|
||||
"main",
|
||||
{ id: "main-content", className: "shell" },
|
||||
@@ -218,8 +224,8 @@ describe("TechLog consumer-visible style contract", () => {
|
||||
expect(getComputedStyle(dialogInner!).padding).toBe("27px 28px 22px");
|
||||
});
|
||||
|
||||
it("preserves footer spacing and fatal-action sizing", () => {
|
||||
const view = renderPublicSurface(
|
||||
it("preserves footer spacing and fatal-action sizing", async () => {
|
||||
const view = await renderPublicSurface(
|
||||
createElement(FatalErrorState, {
|
||||
traceId: "PUBLIC-500",
|
||||
retryHref: "/",
|
||||
|
||||
Reference in New Issue
Block a user