mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-28 02:18:38 +00:00
Diffs: add viewer payload validation and presentation defaults
This commit is contained in:
@@ -12,7 +12,10 @@ describe("resolveDiffsPluginDefaults", () => {
|
||||
defaults: {
|
||||
fontFamily: "JetBrains Mono",
|
||||
fontSize: 17,
|
||||
lineSpacing: 1.8,
|
||||
layout: "split",
|
||||
showLineNumbers: false,
|
||||
diffIndicators: "classic",
|
||||
wordWrap: false,
|
||||
background: false,
|
||||
theme: "light",
|
||||
@@ -22,11 +25,48 @@ describe("resolveDiffsPluginDefaults", () => {
|
||||
).toEqual({
|
||||
fontFamily: "JetBrains Mono",
|
||||
fontSize: 17,
|
||||
lineSpacing: 1.8,
|
||||
layout: "split",
|
||||
showLineNumbers: false,
|
||||
diffIndicators: "classic",
|
||||
wordWrap: false,
|
||||
background: false,
|
||||
theme: "light",
|
||||
mode: "view",
|
||||
});
|
||||
});
|
||||
|
||||
it("clamps and falls back for invalid line spacing and indicators", () => {
|
||||
expect(
|
||||
resolveDiffsPluginDefaults({
|
||||
defaults: {
|
||||
lineSpacing: -5,
|
||||
diffIndicators: "unknown",
|
||||
},
|
||||
}),
|
||||
).toMatchObject({
|
||||
lineSpacing: 1,
|
||||
diffIndicators: "bars",
|
||||
});
|
||||
|
||||
expect(
|
||||
resolveDiffsPluginDefaults({
|
||||
defaults: {
|
||||
lineSpacing: 9,
|
||||
},
|
||||
}),
|
||||
).toMatchObject({
|
||||
lineSpacing: 3,
|
||||
});
|
||||
|
||||
expect(
|
||||
resolveDiffsPluginDefaults({
|
||||
defaults: {
|
||||
lineSpacing: Number.NaN,
|
||||
},
|
||||
}),
|
||||
).toMatchObject({
|
||||
lineSpacing: DEFAULT_DIFFS_TOOL_DEFAULTS.lineSpacing,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user