禁用所有页面长按功能

This commit is contained in:
FinleyHsu
2026-07-28 16:58:26 +08:00
parent eab3ca651a
commit 839edd1e4a
3 changed files with 30 additions and 1 deletions
+19
View File
@@ -51,3 +51,22 @@ test("正式代码不包含历史人员、机台或重量模拟数据", async ()
assert.match(page, /evaluateStability\(stableSamples\.current\)/);
assert.match(utilities, /返回值统一为千克/);
});
test("网页和 Android 原生层均禁用长按功能", async () => {
const [css, androidActivity] = await Promise.all([
readFile(new URL("../app/globals.css", import.meta.url), "utf8"),
readFile(
new URL(
"../android-app/android/app/src/main/java/com/woer/smartscale/MainActivity.java",
import.meta.url,
),
"utf8",
),
]);
assert.match(css, /-webkit-touch-callout:\s*none/);
assert.match(css, /-webkit-user-select:\s*none/);
assert.match(css, /user-select:\s*none/);
assert.match(androidActivity, /webView\.setLongClickable\(false\)/);
assert.match(androidActivity, /webView\.setHapticFeedbackEnabled\(false\)/);
});