fix: harden app lock system unlock flow

This commit is contained in:
Zheng Liu committed 2026-06-24 14:42:49 +08:00
1 parent f6a49dbf0a
commit 0ea707f70f
14 files changed
+114 -26

No files matched your search

+11
View File
@@ -206,6 +206,16 @@ test("startup-locked gate reveals children after hidden app lock reset", async (
assert.equal(dom.document.getElementById("reset-unlocked-content"), null);
const input = dom.document.getElementById("app-lock-password") as HTMLInputElement | null;
assert.ok(input);
const setInputValue = Object.getOwnPropertyDescriptor(
dom.window.HTMLInputElement.prototype,
"value",
)?.set;
assert.ok(setInputValue);
setInputValue.call(input, "secret");
await dispatchDomEvent(input, new dom.window.Event("input", { bubbles: true }));
const logoButton = dom.document.querySelector("[data-testid='app-lock-logo-easter-egg']");
assert.ok(logoButton);
for (let index = 0; index < 5; index += 1) {
@@ -221,6 +231,7 @@ test("startup-locked gate reveals children after hidden app lock reset", async (
await flushEffects();
assert.equal(bridgeHarness.getResetCount(), 1);
assert.deepEqual(bridgeHarness.getResetAttempts(), ["secret"]);
assert.equal(bridgeHarness.getRuntimeState().locked, false);
assert.equal(dom.document.getElementById("reset-unlocked-content")?.textContent, "Unlocked");
} finally {