* fix: restore translucent dashboard styling
* fix: restore dashboard widget transparency
* fix: address dashboard review feedback
* fix: apply board opacity to containers
* fix: flatten demo board container
* fix: default board roundness to sm
* fix: restore assistant widget transparency
* Revert "fix: default board roundness to sm"
This reverts commit c235cbdf2b.
* fix: address remaining dashboard review comments
* test: align grid geometry expectations
42 lines
1.4 KiB
TypeScript
42 lines
1.4 KiB
TypeScript
import { describe, expect, test } from "vitest";
|
|
|
|
import {
|
|
getGridRowCountForVisualHeight,
|
|
getLayoutRowCount,
|
|
getLogicalItemStyle,
|
|
getLogicalTrackSize,
|
|
normalizeGridPlacement,
|
|
} from "../index";
|
|
|
|
describe("fixed dashboard geometry", () => {
|
|
test("keeps a 1x1 item exactly 200px with a fixed 12px gap", () => {
|
|
expect(getLogicalTrackSize(1)).toBe(200);
|
|
expect(getLogicalTrackSize(0.5)).toBe(94);
|
|
expect(getLogicalTrackSize(2)).toBe(412);
|
|
expect(getLogicalTrackSize(3)).toBe(624);
|
|
|
|
expect(getLogicalItemStyle({ x: 1, y: 2, w: 2, h: 3 })).toEqual({
|
|
position: "absolute",
|
|
left: 212,
|
|
top: 424,
|
|
width: 412,
|
|
height: 624,
|
|
});
|
|
});
|
|
|
|
test("normalizes invalid bounds and derives the required row count", () => {
|
|
const placement = normalizeGridPlacement({ id: "wide", x: 7, y: -2, w: 8, h: 2 }, 4);
|
|
|
|
expect(placement).toEqual({ id: "wide", x: 0, y: 0, w: 4, h: 2 });
|
|
expect(getLayoutRowCount([placement, { x: 0, y: 4, w: 1, h: 3 }])).toBe(7);
|
|
});
|
|
|
|
test("derives enough logical rows to fill the visual viewport at any canvas scale", () => {
|
|
expect(getGridRowCountForVisualHeight(1200, 1)).toBe(6);
|
|
expect(getLogicalTrackSize(getGridRowCountForVisualHeight(1200, 1))).toBeGreaterThanOrEqual(1200);
|
|
|
|
expect(getGridRowCountForVisualHeight(1200, 0.5)).toBe(12);
|
|
expect(getLogicalTrackSize(getGridRowCountForVisualHeight(1200, 0.5)) * 0.5).toBeGreaterThanOrEqual(1200);
|
|
});
|
|
});
|