Adds the captcha frame hosts to the CSP and handles a widget that cannot load

frame-src gets the three exact Friendly Captcha global hosts (no wildcard).
When the widget errors, is blocked or shows no sign of life, the form says so
and offers the mail button instead of blocking silently. Adds an e2e for the
form with a mocked API, a draft privacy text for approval, and label tests.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-10 23:27:29 +01:00
co-authored by Claude Sonnet 5.5
parent e09459423f
commit a1444b7b2a
13 changed files with 391 additions and 41 deletions
+24
View File
@@ -29,4 +29,28 @@ describe('shootOptions', () => {
}),
);
});
it('has 1 to 100 characters per label and no double values (the subject limits)', () => {
const options = shootOptions(packages);
for (const option of options) {
expect(option.label.length).toBeGreaterThanOrEqual(1);
expect(option.label.length).toBeLessThanOrEqual(100);
// The label is what is sent, so the value is the label
expect(option.value).toBe(option.label);
}
expect(new Set(options.map((o) => o.value)).size).toBe(options.length);
});
it('keeps a label with special characters unchanged through the JSON of the payload (round trip)', () => {
fc.assert(
fc.property(
fc.string({ minLength: 1, maxLength: 100 }),
fc.constantFrom('&', "'", '"', '<', '>'),
(text, special) => {
const label = `${special}${text}${special}`.slice(0, 100);
const payload = JSON.stringify({ subject: label });
expect(JSON.parse(payload).subject).toBe(label);
},
),
);
});
});