feat: rebuild board grid experience
This commit is contained in:
1 parent
5dc4dbeaef
commit
0110a2ef63
122 files changed
+9582
-4063
No files matched your search
@@ -0,0 +1,28 @@
|
||||
import { describe, expect, test } from "vitest";
|
||||
|
||||
import { getLayoutIdForViewportWidth } from "./layout-selection";
|
||||
|
||||
const layouts = [
|
||||
{ id: "mobile", breakpoint: 0 },
|
||||
{ id: "tablet", breakpoint: 768 },
|
||||
{ id: "desktop", breakpoint: 1280 },
|
||||
];
|
||||
|
||||
describe("getLayoutIdForViewportWidth", () => {
|
||||
test.each([
|
||||
[390, "mobile"],
|
||||
[768, "tablet"],
|
||||
[1279, "tablet"],
|
||||
[1920, "desktop"],
|
||||
])("selects the responsive layout for %ipx", (width, expected) => {
|
||||
expect(getLayoutIdForViewportWidth(layouts, width)).toBe(expected);
|
||||
});
|
||||
|
||||
test("falls back to the smallest layout for invalid widths", () => {
|
||||
expect(getLayoutIdForViewportWidth(layouts, Number.NaN)).toBe("mobile");
|
||||
});
|
||||
|
||||
test("rejects boards without layouts", () => {
|
||||
expect(() => getLayoutIdForViewportWidth([], 1280)).toThrow("Expected the board to contain a layout");
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user