Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions lib/utils/z-index-map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ export const zIndexMap = {
viewMenu: 55,
viewMenuBackdrop: 54,
clickToInteractOverlay: 100,
schematicComponentHoverOutline: 47,
schematicPortHoverOutline: 48,
// Kept below viewMenuIcon (48): schematicPortHoverOutline + 1 (the port
// hover label's z-index, see SchematicPortMouseTarget) must stay clear of
// schematicGridIcon (49) too.
schematicComponentHoverOutline: 45,
schematicPortHoverOutline: 46,
}
19 changes: 19 additions & 0 deletions tests/z-index-map.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { expect, test } from "bun:test"
import { zIndexMap } from "../lib/utils/z-index-map"

test("all zIndexMap values are unique", () => {
const values = Object.values(zIndexMap)
expect(new Set(values).size).toBe(values.length)
})

test("the schematic port hover label doesn't collide with any other layer", () => {
// SchematicPortMouseTarget renders its hover label at
// schematicPortHoverOutline + 1, so that derived value needs to stay clear
// of every other layer too, not just the base value.
const portHoverLabelZIndex = zIndexMap.schematicPortHoverOutline + 1
const otherValues = Object.entries(zIndexMap)
.filter(([key]) => key !== "schematicPortHoverOutline")
.map(([, value]) => value)

expect(otherValues).not.toContain(portHoverLabelZIndex)
})
Loading