mirror of
https://github.com/docmost/docmost.git
synced 2026-08-31 02:46:27 +08:00
feat(base): clearer warning copy for url/email type conversions
This commit is contained in:
+8
-2
@@ -79,9 +79,15 @@ describe("conversionWarning", () => {
|
||||
);
|
||||
});
|
||||
|
||||
it("returns the default safe copy for text → url", () => {
|
||||
it("returns url-cleared copy when target is url", () => {
|
||||
expect(conversionWarning("text", "url")).toBe(
|
||||
"Cells will be reinterpreted under the new type.",
|
||||
"Cells that aren't a valid URL will be cleared.",
|
||||
);
|
||||
});
|
||||
|
||||
it("returns email-cleared copy when target is email", () => {
|
||||
expect(conversionWarning("text", "email")).toBe(
|
||||
"Cells that aren't a valid email address will be cleared.",
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -61,5 +61,11 @@ export function conversionWarning(
|
||||
return "Cells will be coerced (yes/true/1 become checked; everything else becomes unchecked or cleared).";
|
||||
}
|
||||
|
||||
if ((to === "url" || to === "email") && from !== to) {
|
||||
return to === "url"
|
||||
? "Cells that aren't a valid URL will be cleared."
|
||||
: "Cells that aren't a valid email address will be cleared.";
|
||||
}
|
||||
|
||||
return "Cells will be reinterpreted under the new type.";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user