Add full shell, replaceable Omics adapter and bilingual interaction
Implement approved specification #32 and tickets #33-#37. Keep host authentication server-verified and pin session interaction language. Compile scoped base selectors for browser compatibility and retain full gutters during CSS pruning.
This commit is contained in:
@@ -1,9 +1,17 @@
|
||||
import { render, screen } from "@testing-library/react";
|
||||
import { cleanup, render, screen, within } from "@testing-library/react";
|
||||
import userEvent from "@testing-library/user-event";
|
||||
import { http, HttpResponse } from "msw";
|
||||
import { server } from "./test/msw";
|
||||
import { App } from "./App";
|
||||
|
||||
beforeEach(() => { window.__THOTHII_CONFIG__ = { shell: { mode: "full", defaultLocale: "en" } }; });
|
||||
afterEach(() => {
|
||||
cleanup();
|
||||
delete window.__THOTHII_CONFIG__;
|
||||
document.querySelector(".omics-language-select")?.remove();
|
||||
document.documentElement.removeAttribute("data-bs-theme");
|
||||
});
|
||||
|
||||
function registerAuthenticatedShell(mode: "local" | "upstream") {
|
||||
server.use(
|
||||
http.get("/api/auth/config", () => HttpResponse.json({
|
||||
@@ -40,10 +48,17 @@ test("local authentication renders the standalone logout control", async () => {
|
||||
|
||||
expect(await screen.findByRole("button", { name: "New session" })).toBeInTheDocument();
|
||||
expect(screen.getByText("Portal user")).toBeInTheDocument();
|
||||
expect(screen.getByRole("button", { name: "Log out" })).toBeInTheDocument();
|
||||
await userEvent.click(within(screen.getByRole("banner", { name: "Application header" })).getByRole("button", { name: "Portal user" }));
|
||||
expect(await screen.findByRole("menuitem", { name: "Log out" })).toBeInTheDocument();
|
||||
});
|
||||
|
||||
test("trusted upstream authentication keeps identity but omits ThothII logout", async () => {
|
||||
delete window.__THOTHII_CONFIG__;
|
||||
const select = document.createElement("select");
|
||||
select.className = "omics-language-select";
|
||||
select.dataset.lang = "en";
|
||||
document.body.append(select);
|
||||
document.documentElement.setAttribute("data-bs-theme", "light");
|
||||
registerAuthenticatedShell("upstream");
|
||||
|
||||
render(<App />);
|
||||
|
||||
Reference in New Issue
Block a user