Add cross-browser popup status handling

This commit is contained in:
Jordan Wages 2026-08-24 23:32:27 -05:00
commit 7e17470356
38 changed files with 1242 additions and 199 deletions

20
tests/settings.test.ts Normal file
View file

@ -0,0 +1,20 @@
import { describe, expect, it } from "vitest";
import { setDefinitionPaused } from "../src/shared/settings";
import { DEFAULT_SETTINGS } from "../src/shared/types";
describe("definition pause settings", () => {
it("adds and removes a definition ID without disturbing other settings", () => {
const settings = setDefinitionPaused({ ...DEFAULT_SETTINGS, threshold: .65 }, "mastodon", true);
expect(settings.disabledDefinitionIds).toEqual(["mastodon"]);
expect(settings.threshold).toBe(.65);
const resumed = setDefinitionPaused(settings, "mastodon", false);
expect(resumed.disabledDefinitionIds).toEqual([]);
expect(resumed.threshold).toBe(.65);
});
it("does not duplicate an already paused definition", () => {
const settings = setDefinitionPaused({ ...DEFAULT_SETTINGS, disabledDefinitionIds: ["mastodon"] }, "mastodon", true);
expect(settings.disabledDefinitionIds).toEqual(["mastodon"]);
});
});