Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:white_check_mark: Simplify restored frontend regression tests https://github.com/siyuan-note/siyuan/pull/21030

Danielbb2439efa183
diff --git a/app/src/config/tabs/compactMode.test.ts b/app/src/config/tabs/compactMode.test.ts
index 433b009826..d72907cc81 100644
--- a/app/src/config/tabs/compactMode.test.ts
+++ b/app/src/config/tabs/compactMode.test.ts
@@ -6,8 +6,7 @@ import {ModuleKind, transpileModule} from "typescript";
const fixture = (frontend = "desktop", nativeBridge = {}) => {
const appearance = {compactMode: false};
- const siyuan = {config: {appearance, readonly: false}, isPublish: false, isReady: true,
- storage: {"local-compact-mode": true, "local-menu-mouse-scroll": true}};
+ const siyuan = {config: {appearance, readonly: false}, isPublish: false, isReady: true};
const attributes = new Map<string, string>();
const input = {checked: false};
const saved: unknown[][] = [];
@@ -31,7 +30,7 @@ const fixture = (frontend = "desktop", nativeBridge = {}) => {
setFrontend: (value: string) => {frontend = value;}};
};
-test("compactMode ignores retired KV values and reads confirmed configuration updates", () => {
+test("compactMode reflects confirmed configuration updates in its control", () => {
const f = fixture();
f.api.applyCompactMode();
assert.equal(f.input.checked, false);
diff --git a/app/src/config/tabs/menuMouseScroll.test.ts b/app/src/config/tabs/menuMouseScroll.test.ts
index 70d956e7c3..7c43a0355d 100644
--- a/app/src/config/tabs/menuMouseScroll.test.ts
+++ b/app/src/config/tabs/menuMouseScroll.test.ts
@@ -6,8 +6,7 @@ import {ModuleKind, transpileModule} from "typescript";
const fixture = (frontend = "desktop", mobileApp = false) => {
const appearance = {menuMouseScroll: false};
- const siyuan = {config: {appearance, readonly: false}, isPublish: false, isReady: true,
- storage: {"local-compact-mode": true, "local-menu-mouse-scroll": true}};
+ const siyuan = {config: {appearance, readonly: false}, isPublish: false, isReady: true};
const attributes = new Map<string, string>();
const input = {checked: false};
const saved: unknown[][] = [];
@@ -30,7 +29,7 @@ const fixture = (frontend = "desktop", mobileApp = false) => {
return {api: exports, appearance, siyuan, saved, events, input, attributes};
};
-test("menuMouseScroll ignores retired KV values and reads confirmed configuration updates", () => {
+test("menuMouseScroll reflects confirmed configuration updates in its control", () => {
const f = fixture();
f.api.syncMenuMouseScroll();
assert.equal(f.input.checked, false);
diff --git a/app/src/protyle/render/mathRenderSecurity.test.ts b/app/src/protyle/render/mathRenderSecurity.test.ts
index 17fe34d65b..6e4dfac50d 100644
--- a/app/src/protyle/render/mathRenderSecurity.test.ts
+++ b/app/src/protyle/render/mathRenderSecurity.test.ts
@@ -36,12 +36,6 @@ describe("math render security", () => {
}), /Invalid attribute name/);
});
- it("enforces expansion limits inside expanded macro definitions", () => {
- assert.throws(() => katex.renderToString("\\def\\a{xxxxxxxxxx}\\edef\\b{\\a\\a\\a\\a}", {
- maxExpand: 20,
- }), /Too many expansions/);
- });
-
it("always disables trusted KaTeX commands for safe fragments", () => {
assert.deepEqual(getMathRenderSecurity(false, true), {trust: false, sanitize: true});
assert.deepEqual(getMathRenderSecurity(true, true), {trust: false, sanitize: true});
diff --git a/app/src/protyle/util/storageStartup.test.ts b/app/src/protyle/util/storageStartup.test.ts
index 4182f3e606..115dad71b8 100644
--- a/app/src/protyle/util/storageStartup.test.ts
+++ b/app/src/protyle/util/storageStartup.test.ts
@@ -53,13 +53,6 @@ const loadZoom = (value: unknown) => {
return zoom;
};
-test("reader and control preferences no longer create defaults in local storage", () => {
- const storage = loadStorage({});
- for (const key of ["local-mobile-bars", "local-outline", "local-pdftheme", "local-recent-docs"]) {
- assert.equal(Object.prototype.hasOwnProperty.call(storage, key), false, key);
- }
-});
-
test("startup storage uses the current mobile bottom bar default without sharing mutable slots", () => {
const first = loadStorage({})[Constants.LOCAL_MOBILE_BOTTOM_BAR];
const second = loadStorage({})[Constants.LOCAL_MOBILE_BOTTOM_BAR];