diff options
Diffstat (limited to 'src/features/tabs/tab-groups.test.ts')
| -rw-r--r-- | src/features/tabs/tab-groups.test.ts | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/features/tabs/tab-groups.test.ts b/src/features/tabs/tab-groups.test.ts index 83f273c..a09dbc8 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, + groupTone, lastRowIsGroup, visibleGroupParents, } from "./tab-groups"; @@ -103,6 +104,36 @@ describe("groupDescendants / directGroupChildren / groupParentCandidates", () => }); }); +describe("groupTone", () => { + it("rotates three colours by level, starting at the outermost box", () => { + expect([1, 2, 3, 4, 5, 6, 7].map(groupTone)).toEqual([ + "secondary", + "success", + "accent", + "secondary", + "success", + "accent", + "secondary", + ]); + }); + + it("never gives a box the colour of its parent or grandparent", () => { + for (let level = 3; level <= 20; level++) { + expect(groupTone(level)).not.toBe(groupTone(level - 1)); + expect(groupTone(level)).not.toBe(groupTone(level - 2)); + } + }); + + it("never uses primary (reserved for the active tab)", () => { + for (let level = 1; level <= 6; level++) expect(groupTone(level)).not.toBe("primary"); + }); + + it("stays in range for out-of-range levels", () => { + expect(groupTone(0)).toBe("accent"); + expect(groupTone(-1)).toBe("success"); + }); +}); + describe("groupBleedPx / groupGutterPx", () => { it("is zero without groups", () => { expect(groupGutterPx(0)).toBe(0); |
