* Added account selection for protocol links when multiple connected accounts are available, including mailto: links * Added support for handling mailto: links in an already-open PWA/session instead of always opening a new tab * Added webcal: protocol handling for calendar links * Added account selection for webcal: links when multiple calendar-capable accounts are connected * Added an import-or-subscribe choice for detected webcal calendars * Added protocol handler settings for registering mail and calendar handlers and choosing the open mode * Added service worker/session coordination for passing protocol requests between browser/PWA contexts * Added tests and translations for the new protocol handler flows
27 lines
885 B
TypeScript
27 lines
885 B
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { plainTextToComposerBody } from "../email-composer-utils";
|
|
|
|
describe("plainTextToComposerBody", () => {
|
|
it("returns an empty string for empty input", () => {
|
|
expect(plainTextToComposerBody("")).toBe("");
|
|
});
|
|
|
|
it("escapes HTML before building composer paragraphs", () => {
|
|
expect(plainTextToComposerBody("<script>alert('x') & \"q\"</script>")).toBe(
|
|
"<p><script>alert('x') & "q"</script></p>"
|
|
);
|
|
});
|
|
|
|
it("normalizes line endings and preserves single line breaks", () => {
|
|
expect(plainTextToComposerBody("line1\r\nline2\rline3")).toBe(
|
|
"<p>line1<br>line2<br>line3</p>"
|
|
);
|
|
});
|
|
|
|
it("splits paragraphs on blank lines", () => {
|
|
expect(plainTextToComposerBody("first\n\nsecond\nthird")).toBe(
|
|
"<p>first</p><p>second<br>third</p>"
|
|
);
|
|
});
|
|
});
|