Open History to see the last commit
1import { describe, expect, it } from "vite-plus/test";
2import { recordingKeysAreSensitive } from "./RecordingInput.ts";
3
4describe("recording key privacy", () => {
5 const field = (type: string) => ({ tagName: "INPUT", getAttribute: () => type });
6 const sensitive = (activeElement: unknown) =>
7 recordingKeysAreSensitive({ activeElement } as Document);
8 it("excludes password fields and their shadow-root focus", () => {
9 expect(sensitive(field("password"))).toBe(true);
10 expect(sensitive({ shadowRoot: { activeElement: field("password") } })).toBe(true);
11 expect(sensitive(field("text"))).toBe(false);
12 });
13 it("excludes iframe focus whose field cannot be inspected", () => {
14 expect(sensitive({ tagName: "IFRAME" })).toBe(true);
15 expect(sensitive({ tagName: "SECRET-FIELD" })).toBe(true);
16 });
17});