Files
DongHyeonkaandClaude Opus 5.5 e119eb667a fix(bootstrap): show a static boot shell until the first render (Q-6.9-8)
Boot awaits runtime config (5s budget), the release manifest (5s) and
contract-set checks before its first render, and #root was empty the
whole time with no busy state. index.html now ships a static loading
status (role="status", aria-busy="true", the existing state-surface
loading class) inside #root; createRoot's first render — the app or the
BootErrorShell — replaces it.

Verified: tests/component/bootstrap-shell.test.tsx reads index.html
(RED before: no busy status) and checks the first React render removes
the shell; `pnpm build` keeps the shell in dist/index.html with the
render-blocking CSS link. All gates pass; test:reference-feature's
production-vertical test timed out once on "로그인 시작" and passed on
rerun (timing flake, unrelated file).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-24 13:58:35 +09:00

53 lines
1.6 KiB
TypeScript

// @vitest-environment jsdom
import { readFileSync } from "node:fs";
import { act, render, screen } from "@testing-library/react";
import { createRoot } from "react-dom/client";
import { describe, expect, it } from "vitest";
function TestShell() {
return <main aria-label="application shell">ready</main>;
}
describe("component test level", () => {
it("renders an accessible application shell", () => {
render(<TestShell />);
expect(screen.getByRole("main", { name: "application shell" })).toHaveTextContent(
"ready",
);
});
});
describe("static boot shell (Q-6.9-8)", () => {
function loadIndexBody(): HTMLElement {
const html = readFileSync("index.html", "utf8");
document.body.innerHTML = new DOMParser()
.parseFromString(html, "text/html")
.body.innerHTML;
const root = document.getElementById("root");
if (!root) throw new Error("index.html has no #root");
return root;
}
it("shows a busy loading status before boot renders anything", () => {
const root = loadIndexBody();
const status = root.querySelector('[role="status"]');
expect(status?.getAttribute("aria-busy")).toBe("true");
expect(status?.textContent?.trim()).not.toBe("");
});
it("is replaced by the first render of the real app", async () => {
const root = loadIndexBody();
const reactRoot = createRoot(root);
await act(async () => {
reactRoot.render(<TestShell />);
});
expect(root.querySelector('[aria-busy="true"]')).toBeNull();
expect(screen.getByRole("main", { name: "application shell" })).toBeTruthy();
await act(async () => {
reactRoot.unmount();
});
});
});