diff --git a/README.md b/README.md index 4830f78..57b1b41 100644 --- a/README.md +++ b/README.md @@ -362,7 +362,7 @@ src/context.ts RequestContext handed to handlers + buildContext() src/config.ts Env loader — Ory endpoints, cookie/CSRF secrets, JWKS, port; validated at boot src/icons.ts Used-icon registry + sprite builder from lucide-static (regenerates partials/icons.ejs) src/plugin.ts definePlugin() + the host's plugin discovery/router (planned) -views/ Core EJS templates (index, 403/404/500, partials/ incl. the icon sprite) +views/ Core EJS templates (index, 403/404/500, partials/ incl. the app shell + icon sprite) public/ Static assets under /public/ (css/styles.css + auth.css, favicon, robots.txt) config/menu.ts Central menu override + branding (planned) plugins/ Drop-in plugin folders, auto-discovered (planned) diff --git a/src/shell.test.ts b/src/shell.test.ts new file mode 100644 index 0000000..54d143d --- /dev/null +++ b/src/shell.test.ts @@ -0,0 +1,44 @@ +import assert from "node:assert/strict"; +import { dirname, join } from "node:path"; +import { test } from "node:test"; +import { fileURLToPath } from "node:url"; +import * as ejs from "ejs"; + +const shell = join(dirname(fileURLToPath(import.meta.url)), "..", "views", "partials", "shell.ejs"); +const render = (data: Record = {}): Promise => ejs.renderFile(shell, data); + +test("app shell renders sidebar, topbar and the content slot", async () => { + const html = await render({ + title: "People", + brand: { name: "Acme Console", sub: "v2" }, + nav: 'Overview', + body: '
page
', + actions: '', + }); + + // Three structural landmarks of the shell. + assert.match(html, / + + + + +
+
+ +
<%= title %>
+ <% if (breadcrumbs.length) { %> + + <% } %> +
+ <%- actions %> +
+ + <%- body %> +
+ + +