diff --git a/index.html b/index.html index 047e363e..0ac9c9cc 100644 --- a/index.html +++ b/index.html @@ -7,7 +7,18 @@ Clean Architecture Frontend -
+
+ +
+ 불러오는 중 +
+
diff --git a/tests/component/bootstrap-shell.test.tsx b/tests/component/bootstrap-shell.test.tsx index 2a6f7c29..4fd9d8e6 100644 --- a/tests/component/bootstrap-shell.test.tsx +++ b/tests/component/bootstrap-shell.test.tsx @@ -1,6 +1,9 @@ // @vitest-environment jsdom -import { render, screen } from "@testing-library/react"; +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() { @@ -15,3 +18,35 @@ describe("component test level", () => { ); }); }); + +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(); + }); + expect(root.querySelector('[aria-busy="true"]')).toBeNull(); + expect(screen.getByRole("main", { name: "application shell" })).toBeTruthy(); + await act(async () => { + reactRoot.unmount(); + }); + }); +});