test(ux-36): establish multi-device responsive matrix specification and test suite
This commit is contained in:
1 parent
5d5cc14f9e
commit
961bb383db
1 file changed
+56
@@ -0,0 +1,56 @@
|
||||
import { describe, it, expect } from "vitest";
|
||||
|
||||
export interface ViewportMatrixConfig {
|
||||
device: string;
|
||||
width: number;
|
||||
height: number;
|
||||
category: "mobile-compact" | "mobile-standard" | "mobile-large" | "tablet" | "laptop" | "desktop";
|
||||
touchTargetMinPx: number;
|
||||
hasBottomNav: boolean;
|
||||
}
|
||||
|
||||
export const VIEWPORT_MATRIX: ViewportMatrixConfig[] = [
|
||||
{ device: "Galaxy S8 / SE compact", width: 360, height: 640, category: "mobile-compact", touchTargetMinPx: 44, hasBottomNav: true },
|
||||
{ device: "iPhone 12/13/14/15", width: 390, height: 844, category: "mobile-standard", touchTargetMinPx: 44, hasBottomNav: true },
|
||||
{ device: "iPhone Plus / Max", width: 414, height: 896, category: "mobile-large", touchTargetMinPx: 44, hasBottomNav: true },
|
||||
{ device: "iPad / Tablet Portrait", width: 768, height: 1024, category: "tablet", touchTargetMinPx: 44, hasBottomNav: false },
|
||||
{ device: "iPad Pro / Laptop", width: 1024, height: 1366, category: "laptop", touchTargetMinPx: 40, hasBottomNav: false },
|
||||
{ device: "FHD Desktop", width: 1440, height: 900, category: "desktop", touchTargetMinPx: 36, hasBottomNav: false },
|
||||
];
|
||||
|
||||
export const KEY_ROUTES = [
|
||||
{ path: "/", name: "Home", requiresSingletonModals: true },
|
||||
{ path: "/shop", name: "Shop", requiresPagination: true },
|
||||
{ path: "/search", name: "Universal Search", requiresMultiContent: true },
|
||||
{ path: "/blog", name: "Blog", requiresSingleH1: true },
|
||||
{ path: "/contact", name: "Contact", requiresSafeElevation: true },
|
||||
{ path: "/wiki", name: "Wiki / Ingredients", requiresAccordionSafeTarget: true },
|
||||
];
|
||||
|
||||
describe("Responsive Viewport Matrix & Key Route Auditing (UX-36)", () => {
|
||||
it("defines standard matrix covering 360, 390, 414, 768, 1024, and 1440 viewports", () => {
|
||||
const widths = VIEWPORT_MATRIX.map((v) => v.width);
|
||||
expect(widths).toEqual([360, 390, 414, 768, 1024, 1440]);
|
||||
});
|
||||
|
||||
it("assigns appropriate touch targets and bottom navigation states across viewport tiers", () => {
|
||||
VIEWPORT_MATRIX.forEach((vp) => {
|
||||
if (vp.width <= 414) {
|
||||
expect(vp.touchTargetMinPx).toBe(44);
|
||||
expect(vp.hasBottomNav).toBe(true);
|
||||
} else {
|
||||
expect(vp.hasBottomNav).toBe(false);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it("covers all key business and discovery routes in matrix", () => {
|
||||
const paths = KEY_ROUTES.map((r) => r.path);
|
||||
expect(paths).toContain("/");
|
||||
expect(paths).toContain("/shop");
|
||||
expect(paths).toContain("/search");
|
||||
expect(paths).toContain("/blog");
|
||||
expect(paths).toContain("/contact");
|
||||
expect(paths).toContain("/wiki");
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user