Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

Merge pull request #6148 from mantrandev/fix/sidebar-department-line

milind-soni2fe522bb9508
diff --cc src/components/SidebarSectionHeader.test.ts
index d6df848d70,369362733a..d017c74514
--- a/src/components/SidebarSectionHeader.test.ts
+++ b/src/components/SidebarSectionHeader.test.ts
@@@ -119,26 -119,26 +119,26 @@@ describe("SidebarSectionHeader as a Sim
expect(renderToStaticMarkup(line())).not.toContain("Actions for Work department");
});
- it("shows how many rows the section holds at rest, crossfading to the chevron on hover or focus", () => {
- const html = renderToStaticMarkup(line({ count: 3 }));
- expect(html).toMatch(/class="h-\[30px\]|group\/section flex h-\[30px\] items-center gap-1\.5 rounded-\[6px\] px-2 pb-1\.5 pt-2 hover:bg-raised\/50/);
- expect(html).toMatch(/<span class="text-\[12px\] tabular-nums leading-4 text-ink-secondary transition-opacity group-hover\/section:opacity-0 group-focus-within\/section:opacity-0 touch:opacity-0">3<\/span>/);
+ it("shows no row count, only the chevron on hover or focus", () => {
+ const html = renderToStaticMarkup(line());
+ expect(html).not.toContain("tabular-nums");
+ expect(html.replace(/<svg.*?<\/svg>/g, "")).not.toMatch(/>\d+</);
});
- it("keeps the count in the same column whether or not the line has a ⋯ menu", () => {
+ it("keeps the chevron in the same column whether or not the line has a ⋯ menu", () => {
- const slot = /<span aria-hidden="true" class="w-\[22px\] shrink-0"><\/span>/;
+ const slot = /<span aria-hidden="true" class="w-6 shrink-0"><\/span>/;
- expect(renderToStaticMarkup(line({ count: 1, reserveMenu: true }))).toMatch(slot);
- expect(renderToStaticMarkup(line({ count: 4, reserveMenu: true, onMenu: () => {} }))).not.toMatch(slot);
- expect(renderToStaticMarkup(line({ count: 1 }))).not.toMatch(slot);
+ expect(renderToStaticMarkup(line({ reserveMenu: true }))).toMatch(slot);
+ expect(renderToStaticMarkup(line({ reserveMenu: true, onMenu: () => {} }))).not.toMatch(slot);
+ expect(renderToStaticMarkup(line())).not.toMatch(slot);
expect(renderToStaticMarkup(line({ reserveMenu: true, naming: { value: "", label: "Name", onCommit: () => {}, onCancel: () => {} } }))).not.toMatch(slot);
const top = (props: Parameters<typeof line>[0]) => Children.toArray(line(props).props.children).filter(isValidElement) as ReactElement<Props>[];
- const reserved = top({ count: 1, reserveMenu: true });
- const withMenu = top({ count: 4, onMenu: () => {} });
+ const reserved = top({ reserveMenu: true });
+ const withMenu = top({ onMenu: () => {} });
expect(reserved.map((node) => node.type)).toEqual(["button", "span"]);
- expect(reserved[1].props).toMatchObject({ "aria-hidden": "true", className: "w-[22px] shrink-0" });
+ expect(reserved[1].props).toMatchObject({ "aria-hidden": "true", className: "w-6 shrink-0" });
expect(withMenu.map((node) => node.type)).toEqual(["button", "button"]);
expect(withMenu[1].props["aria-label"]).toBe("Actions for Work department");
- expect(String(withMenu[1].props.className).split(" ")).toEqual(expect.arrayContaining(["w-[22px]", "shrink-0"]));
+ expect(String(withMenu[1].props.className).split(" ")).toEqual(expect.arrayContaining(["size-6", "shrink-0"]));
});
it("is dragged by the line itself, and only when it can be reordered", () => {