Skip to content
TypeScript

test(web): keep Markdown gutter styling private (#10306)

Julius Marmingeb972f1c1dfc8
diff --git a/apps/web/src/components/ChatMarkdown.test.tsx b/apps/web/src/components/ChatMarkdown.test.tsx
index f4551a93088..3243bf3c278 100644
--- a/apps/web/src/components/ChatMarkdown.test.tsx
+++ b/apps/web/src/components/ChatMarkdown.test.tsx
@@ -60,7 +60,6 @@ vi.mock("~/lib/openPullRequestLink", () => ({
import ChatMarkdown, {
canUseMarkdownFileShellActions,
hasMarkdownFilePrimaryAction,
- orderedListGutterStyle,
shouldUseMarkdownFileBrowserPrimaryAction,
} from "./ChatMarkdown";
@@ -640,47 +639,6 @@ describe("shouldUseMarkdownFileBrowserPrimaryAction", () => {
});
});
-describe("orderedListGutterStyle", () => {
- it("leaves the default gutter alone for single-digit lists", () => {
- expect(orderedListGutterStyle(9, undefined)).toBeUndefined();
- });
-
- it("widens the gutter for two-digit lists", () => {
- expect(orderedListGutterStyle(99, undefined)).toEqual({ "--list-gutter": "3ch" });
- });
-
- it("widens the gutter for a two-digit list that starts above 1", () => {
- // start=50 + 49 items => last marker is "98", still two digits.
- expect(orderedListGutterStyle(49, 50)).toEqual({ "--list-gutter": "3ch" });
- });
-
- it("widens the gutter once the last marker reaches three digits", () => {
- // item 100 is the bug from #6512: a 100-item list starting at 1.
- expect(orderedListGutterStyle(100, undefined)).toEqual({ "--list-gutter": "4ch" });
- });
-
- it("accounts for a non-default start attribute", () => {
- // start=95 + 9 items => last marker is "103", three digits.
- expect(orderedListGutterStyle(9, 95)).toEqual({ "--list-gutter": "4ch" });
- expect(orderedListGutterStyle(5, "999995")).toEqual({ "--list-gutter": "7ch" });
- });
-
- it("scales further for four-digit markers", () => {
- expect(orderedListGutterStyle(1000, undefined)).toEqual({ "--list-gutter": "5ch" });
- });
-
- it("uses the widest marker and includes a negative start's minus sign", () => {
- expect(orderedListGutterStyle(1001, -1000)).toEqual({ "--list-gutter": "6ch" });
- expect(orderedListGutterStyle(3, -15)).toEqual({ "--list-gutter": "4ch" });
- expect(orderedListGutterStyle(3, -5)).toEqual({ "--list-gutter": "3ch" });
- });
-
- it("treats a missing/zero item count as a single item", () => {
- expect(orderedListGutterStyle(0, undefined)).toBeUndefined();
- expect(orderedListGutterStyle(0, 100)).toEqual({ "--list-gutter": "4ch" });
- });
-});
-
describe("ChatMarkdown Windows file links", () => {
const environmentId = EnvironmentId.make("env-windows");
diff --git a/apps/web/src/components/ChatMarkdown.tsx b/apps/web/src/components/ChatMarkdown.tsx
index 4e592c406b1..89d886ec7d1 100644
--- a/apps/web/src/components/ChatMarkdown.tsx
+++ b/apps/web/src/components/ChatMarkdown.tsx
@@ -340,7 +340,7 @@ function findTaskListMarkerOffset(markdown: string, listItemStart: number): numb
* message's overflow. Widen the gutter to fit the widest marker, including a
* negative marker's minus sign.
*/
-export function orderedListGutterStyle(
+function orderedListGutterStyle(
itemCount: number,
start: unknown,
): { "--list-gutter": string } | undefined {