summaryrefslogtreecommitdiffhomepage
path: root/src/features/tabs/tab-groups.test.ts
diff options
context:
space:
mode:
authorAdam Malczewski <[email protected]>2026-10-15 15:01:24 +0900
committerAdam Malczewski <[email protected]>2026-10-15 15:01:24 +0900
commitab51a8144c3faf1d545e33195f2190492219e861 (patch)
treeb12ddbf7465db1281022b1b19d34fbc59083a9c7 /src/features/tabs/tab-groups.test.ts
parentc23aa41d1ffa71ac905da8ac9488b07322327695 (diff)
downloaddispatch-web-ab51a8144c3faf1d545e33195f2190492219e861.tar.gz
dispatch-web-ab51a8144c3faf1d545e33195f2190492219e861.zip
fix(tabs): 20% black compounding group boxes; trim bottom padding under a last-row nested box so spacing stays even
Diffstat (limited to 'src/features/tabs/tab-groups.test.ts')
-rw-r--r--src/features/tabs/tab-groups.test.ts26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/features/tabs/tab-groups.test.ts b/src/features/tabs/tab-groups.test.ts
index ca2492c..83f273c 100644
--- a/src/features/tabs/tab-groups.test.ts
+++ b/src/features/tabs/tab-groups.test.ts
@@ -6,6 +6,7 @@ import {
groupDescendants,
groupGutterPx,
groupParentCandidates,
+ lastRowIsGroup,
visibleGroupParents,
} from "./tab-groups";
import type { Tab } from "./tabs";
@@ -122,3 +123,28 @@ describe("groupBleedPx / groupGutterPx", () => {
expect(groupBleedPx(12, 12)).toBeGreaterThan(0);
});
});
+
+describe("lastRowIsGroup (mirrors grid row-dense placement)", () => {
+ const leaf = (id: string) => ({ tab: tab(id), children: [] });
+ const group = (id: string) => ({ tab: tab(id), children: [leaf(`${id}-kid`)] });
+
+ it("is false with only cards", () => {
+ expect(lastRowIsGroup([])).toBe(false);
+ expect(lastRowIsGroup([leaf("a"), leaf("b"), leaf("c")])).toBe(false);
+ });
+
+ it("is true when a nested group comes last", () => {
+ expect(lastRowIsGroup([leaf("a"), group("g")])).toBe(true);
+ expect(lastRowIsGroup([group("g")])).toBe(true);
+ });
+
+ it("stays true when a later card back-fills an earlier half row", () => {
+ // [a, _] then [g, g]; b fills a's half row → g is still the last row.
+ expect(lastRowIsGroup([leaf("a"), group("g"), leaf("b")])).toBe(true);
+ });
+
+ it("is false when a later card has to open a new row below the group", () => {
+ expect(lastRowIsGroup([group("g"), leaf("a")])).toBe(false);
+ expect(lastRowIsGroup([leaf("a"), leaf("b"), group("g"), leaf("c")])).toBe(false);
+ });
+});