Skip to content

AI-native knowledge base & Evernote/Obsidian alternative with instant sync & native MCP. Free on Cloudflare or self-hosted via Docker.

test: align showcase and gallery toolbar tests with current main (#724)

Dariusz Korytode00d13caa41
diff --git a/apps/site/src/i18n.test.mjs b/apps/site/src/i18n.test.mjs
index a65a55f1..bbe5c18a 100644
--- a/apps/site/src/i18n.test.mjs
+++ b/apps/site/src/i18n.test.mjs
@@ -96,7 +96,8 @@ describe("site locale routing", () => {
collectKeys(bestPracticesPageCopy["zh-CN"]),
);
const cases = bestPracticesPageCopy[locale].categories.flatMap((c) => c.cases);
- expect(cases).toHaveLength(17);
+ // Every configured showcase appears exactly once in each locale.
+ expect(cases.map((item) => item.id).sort()).toEqual(Object.keys(showcaseCaseAssets).sort());
for (const item of cases) {
const assets = showcaseCaseAssets[item.id];
expect(assets).toBeDefined();
diff --git a/apps/web/src/styles/image-gallery-layout.test.mjs b/apps/web/src/styles/image-gallery-layout.test.mjs
index 81578d74..1d630a38 100644
--- a/apps/web/src/styles/image-gallery-layout.test.mjs
+++ b/apps/web/src/styles/image-gallery-layout.test.mjs
@@ -4,14 +4,19 @@ import { readFileSync } from "node:fs";
const globals = readFileSync(new URL("./globals.css", import.meta.url), "utf8");
describe("image gallery layout", () => {
- test("reserves a wrapping toolbar row instead of overlaying image controls", () => {
+ test("floats the wrapping toolbar above the images and reveals it on hover or keyboard focus", () => {
const toolbar = globals.match(/\.ProseMirror \.edgeever-image-gallery__toolbar \{([^}]+)\}/)?.[1];
- expect(toolbar).toContain("position: relative;");
+ expect(toolbar).toContain("position: absolute;");
+ expect(toolbar).toContain("bottom: 100%;");
expect(toolbar).toContain("flex-wrap: wrap;");
expect(toolbar).toContain("max-width: 100%;");
expect(toolbar).toContain("margin-bottom: 0.5rem;");
- expect(toolbar).not.toContain("position: absolute");
+ expect(toolbar).toContain("visibility: hidden;");
+ expect(toolbar).toContain("pointer-events: none;");
expect(toolbar).not.toContain("opacity: 0");
+ expect(globals).toMatch(
+ /\.ProseMirror \.edgeever-image-gallery:hover > \.edgeever-image-gallery__toolbar,\s*\.ProseMirror \.edgeever-image-gallery:focus-within > \.edgeever-image-gallery__toolbar \{\s*visibility: visible;\s*pointer-events: auto;/,
+ );
});
test("fills React image node grid cells without exposing a persistent background", () => {