Skip to content

Build your personal knowledge base with Trilium Notes

test(share-theme): give the search and speculation specs a complete glob

Elian Doran6c1218ca8bad
diff --git a/packages/share-theme/src/page/search.spec.ts b/packages/share-theme/src/page/search.spec.ts
index 9e5b55861f..3fd5acd73b 100644
--- a/packages/share-theme/src/page/search.spec.ts
+++ b/packages/share-theme/src/page/search.spec.ts
@@ -160,7 +160,7 @@ describe("setupSearch", () => {
});
it("searches the index of a static export, loaded once", async () => {
- window.glob = { isStatic: true, theme: "light" };
+ window.glob = { isShare: true, isStatic: true, theme: "light" };
document.head.innerHTML = `<link rel="stylesheet" href="../../assets/style.css">`;
const fetchMock = vi.fn(async (_url: string) => Response.json([
{ id: "drip", title: "Treatment", path: "Home", content: "Patient on magnesium drip." },
diff --git a/packages/share-theme/src/page/speculation.spec.ts b/packages/share-theme/src/page/speculation.spec.ts
index 32d14d6c09..500f988d14 100644
--- a/packages/share-theme/src/page/speculation.spec.ts
+++ b/packages/share-theme/src/page/speculation.spec.ts
@@ -12,7 +12,7 @@ describe("setupSpeculation", () => {
it("prerenders the site's pages a visitor is about to open, leaving out files and the login", () => {
stubSupport(true);
- window.glob = { isStatic: false, theme: "light" };
+ window.glob = { isShare: true, isStatic: false, theme: "light" };
setupSpeculation();
@@ -34,11 +34,11 @@ describe("setupSpeculation", () => {
it("adds no rules to a static export or in a browser without speculation rules", () => {
stubSupport(true);
- window.glob = { isStatic: true, theme: "light" };
+ window.glob = { isShare: true, isStatic: true, theme: "light" };
setupSpeculation();
stubSupport(false);
- window.glob = { isStatic: false, theme: "light" };
+ window.glob = { isShare: true, isStatic: false, theme: "light" };
setupSpeculation();
vi.stubGlobal("HTMLScriptElement", {});