Files
WonderQ-Project/WonderQ-MiniAPP/tests/vehicle-demand-layout.test.ts
2026-08-27 12:03:40 +08:00

20 lines
872 B
TypeScript

import { describe, expect, it } from "vitest";
import vehicleDemandSource from "@/pages/vehicle-demand.vue?raw";
describe("vehicle demand form layout", () => {
it("keeps native inputs and textarea inside their responsive parent width", () => {
const fieldClasses = [
...vehicleDemandSource.matchAll(/<(?:input|textarea)\b[^>]*\sclass="([^"]+)"/g),
].map((match) => match[1].split(/\s+/));
expect(fieldClasses).toHaveLength(7);
expect(fieldClasses.every((classes) => classes.includes("box-border"))).toBe(true);
expect(fieldClasses.every((classes) => classes.includes("min-w-0"))).toBe(true);
});
it("allows the two-column passenger fields to shrink within the form card", () => {
expect(vehicleDemandSource).toContain('class="grid min-w-0 grid-cols-2 gap-3"');
expect(vehicleDemandSource).toContain('class="min-w-0"');
});
});