The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 24, 09:00 UTC
test(web): keep Markdown gutter styling private (#10306)
Julius Marminge committed
Sep 5, 2026 at 22:32 UTC
b972f1c1dfc827c2fb074af92f52a9f8fc1fcda5
2 files changed
+1
-43
apps/web/src/components/ChatMarkdown.test.tsx
-42
@@ -60,7 +60,6 @@ vi.mock("~/lib/openPullRequestLink", () => ({
60
import ChatMarkdown, {
61
canUseMarkdownFileShellActions,
62
hasMarkdownFilePrimaryAction,
63
- orderedListGutterStyle,
63
shouldUseMarkdownFileBrowserPrimaryAction,
64
} from "./ChatMarkdown";
65
@@ -640,47 +639,6 @@ describe("shouldUseMarkdownFileBrowserPrimaryAction", () => {
639
});
640
});
641
643
-describe("orderedListGutterStyle", () => {
644
- it("leaves the default gutter alone for single-digit lists", () => {
645
- expect(orderedListGutterStyle(9, undefined)).toBeUndefined();
646
- });
647
-
648
- it("widens the gutter for two-digit lists", () => {
649
- expect(orderedListGutterStyle(99, undefined)).toEqual({ "--list-gutter": "3ch" });
650
- });
651
-
652
- it("widens the gutter for a two-digit list that starts above 1", () => {
653
- // start=50 + 49 items => last marker is "98", still two digits.
654
- expect(orderedListGutterStyle(49, 50)).toEqual({ "--list-gutter": "3ch" });
655
- });
656
-
657
- it("widens the gutter once the last marker reaches three digits", () => {
658
- // item 100 is the bug from #6512: a 100-item list starting at 1.
659
- expect(orderedListGutterStyle(100, undefined)).toEqual({ "--list-gutter": "4ch" });
660
- });
661
-
662
- it("accounts for a non-default start attribute", () => {
663
- // start=95 + 9 items => last marker is "103", three digits.
664
- expect(orderedListGutterStyle(9, 95)).toEqual({ "--list-gutter": "4ch" });
665
- expect(orderedListGutterStyle(5, "999995")).toEqual({ "--list-gutter": "7ch" });
666
- });
667
-
668
- it("scales further for four-digit markers", () => {
669
- expect(orderedListGutterStyle(1000, undefined)).toEqual({ "--list-gutter": "5ch" });
670
- });
671
-
672
- it("uses the widest marker and includes a negative start's minus sign", () => {
673
- expect(orderedListGutterStyle(1001, -1000)).toEqual({ "--list-gutter": "6ch" });
674
- expect(orderedListGutterStyle(3, -15)).toEqual({ "--list-gutter": "4ch" });
675
- expect(orderedListGutterStyle(3, -5)).toEqual({ "--list-gutter": "3ch" });
676
- });
677
-
678
- it("treats a missing/zero item count as a single item", () => {
679
- expect(orderedListGutterStyle(0, undefined)).toBeUndefined();
680
- expect(orderedListGutterStyle(0, 100)).toEqual({ "--list-gutter": "4ch" });
681
- });
682
-});
683
-
642
describe("ChatMarkdown Windows file links", () => {
643
const environmentId = EnvironmentId.make("env-windows");
644
apps/web/src/components/ChatMarkdown.tsx
+1
-1
@@ -340,7 +340,7 @@ function findTaskListMarkerOffset(markdown: string, listItemStart: number): numb
340
* message's overflow. Widen the gutter to fit the widest marker, including a
341
* negative marker's minus sign.
342
*/
343
-export function orderedListGutterStyle(
343
+function orderedListGutterStyle(
344
itemCount: number,
345
start: unknown,
346
): { "--list-gutter": string } | undefined {