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:
@@ -11,6 +11,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";
|
||||
|
||||
const originalShowModal = HTMLDialogElement.prototype.showModal;
|
||||
const originalClose = HTMLDialogElement.prototype.close;
|
||||
@@ -47,7 +48,7 @@ afterEach(() => {
|
||||
});
|
||||
});
|
||||
|
||||
function renderShell(initialEntry = "/projects") {
|
||||
async function renderShell(initialEntry = "/projects") {
|
||||
const techLog = createTechLogFeatureInstalledInput(MOCK_STUDIO_INSTALL_CONTEXT).input;
|
||||
const router = createMemoryRouter(
|
||||
[
|
||||
@@ -65,6 +66,7 @@ function renderShell(initialEntry = "/projects") {
|
||||
{ initialEntries: [initialEntry] },
|
||||
);
|
||||
const view = render(
|
||||
renderWithQueryProviders(
|
||||
<ApplicationProvider
|
||||
application={createTestApplication({
|
||||
featureInputs: { "tech-log": techLog },
|
||||
@@ -72,13 +74,16 @@ function renderShell(initialEntry = "/projects") {
|
||||
>
|
||||
<RouterProvider router={router} />
|
||||
</ApplicationProvider>,
|
||||
);
|
||||
));
|
||||
// 포트가 async 가 되면서 첫 페인트에는 데이터가 없다. 화면이 정착한 뒤
|
||||
// 단언하도록 여기서 한 번 기다린다 — 각 테스트에 흩어 놓으면 빠뜨린 곳이 생긴다.
|
||||
await screen.findByRole("main");
|
||||
return { ...view, router };
|
||||
}
|
||||
|
||||
describe("TechLog Public shell", () => {
|
||||
it("preserves source landmark order, navigation copy, current state, and footer", () => {
|
||||
const view = renderShell();
|
||||
it("preserves source landmark order, navigation copy, current state, and footer", async () => {
|
||||
const view = await renderShell();
|
||||
const frame = view.container.querySelector(".site-frame");
|
||||
|
||||
expect(
|
||||
@@ -127,7 +132,7 @@ describe("TechLog Public shell", () => {
|
||||
|
||||
it("uses the canonical root route for brand navigation", async () => {
|
||||
const user = userEvent.setup();
|
||||
const { router } = renderShell("/projects/backend-skeleton");
|
||||
const { router } = await renderShell("/projects/backend-skeleton");
|
||||
|
||||
await user.click(screen.getByRole("link", { name: "TechLog 홈" }));
|
||||
|
||||
@@ -136,7 +141,7 @@ describe("TechLog Public shell", () => {
|
||||
|
||||
it("opens search by click, closes on Escape, and restores trigger focus", async () => {
|
||||
const user = userEvent.setup();
|
||||
renderShell();
|
||||
await renderShell();
|
||||
const trigger = screen.getByRole("button", { name: "TechLog 검색 열기" });
|
||||
|
||||
await user.click(trigger);
|
||||
@@ -155,7 +160,7 @@ describe("TechLog Public shell", () => {
|
||||
|
||||
it("opens the native search trigger from the keyboard", async () => {
|
||||
const user = userEvent.setup();
|
||||
renderShell();
|
||||
await renderShell();
|
||||
const trigger = screen.getByRole("button", { name: "TechLog 검색 열기" });
|
||||
trigger.focus();
|
||||
|
||||
@@ -169,7 +174,7 @@ describe("TechLog Public shell", () => {
|
||||
|
||||
it("returns source-equivalent results and navigates to their canonical route", async () => {
|
||||
const user = userEvent.setup();
|
||||
const { router } = renderShell();
|
||||
const { router } = await renderShell();
|
||||
await user.click(
|
||||
screen.getByRole("button", { name: "TechLog 검색 열기" }),
|
||||
);
|
||||
@@ -191,7 +196,7 @@ describe("TechLog Public shell", () => {
|
||||
|
||||
it("navigates the full-search action with its canonical query intact", async () => {
|
||||
const user = userEvent.setup();
|
||||
const { router } = renderShell();
|
||||
const { router } = await renderShell();
|
||||
await user.click(
|
||||
screen.getByRole("button", { name: "TechLog 검색 열기" }),
|
||||
);
|
||||
@@ -210,7 +215,7 @@ describe("TechLog Public shell", () => {
|
||||
|
||||
it("uses native mobile disclosure activation and closes it after selection", async () => {
|
||||
const user = userEvent.setup();
|
||||
const view = renderShell();
|
||||
const view = await renderShell();
|
||||
const details = view.container.querySelector<HTMLDetailsElement>(
|
||||
"details.mobile-nav",
|
||||
);
|
||||
@@ -236,7 +241,7 @@ describe("TechLog Public shell", () => {
|
||||
|
||||
it("closes a natively opened mobile disclosure before opening one search dialog", async () => {
|
||||
const user = userEvent.setup();
|
||||
const view = renderShell();
|
||||
const view = await renderShell();
|
||||
const details = view.container.querySelector<HTMLDetailsElement>(
|
||||
"details.mobile-nav",
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user