diff --git a/src/components/PrintView.test.tsx b/src/components/PrintView.test.tsx index e4d7ae6..fe073de 100644 --- a/src/components/PrintView.test.tsx +++ b/src/components/PrintView.test.tsx @@ -5,7 +5,23 @@ import { addUnit, createList, toggleUnitScouting } from "../domain/lists"; import { totalScoutingPoints } from "../domain/scouting"; import { PrintList } from "./PrintView"; -describe("PrintList scouting commitments", () => { +describe("PrintList", () => { + it("prints the breakpoint and unit type", () => { + const army = getArmy("warmaster-revolution", "dwarfs")!; + const list = createList("warmaster-revolution", army.version, army.army, "Dwarfs", 2000); + list.units = [ + { unitId: "dwarfs:warriors", quantity: 5, upgrades: [], magicItems: [] }, + ]; + + render(); + + expect(screen.getByText(/Dwarfs · Warmaster Revolution/)).toHaveTextContent( + `Dwarfs · Warmaster Revolution ${army.version} · 550/2000 pts · Breakpoint: 3`, + ); + expect(screen.getByRole("columnheader", { name: "Type" })).toBeInTheDocument(); + expect(screen.getByText("Warriors").closest("tr")).toHaveTextContent("Infantry"); + }); + it("prints committed scouting units and their total", () => { const army = getArmy("warmaster-revolution", "dwarfs")!; let list = createList("warmaster-revolution", army.version, army.army, "Scouts", 1000); diff --git a/src/components/PrintView.tsx b/src/components/PrintView.tsx index 6aaa315..1a2cb04 100644 --- a/src/components/PrintView.tsx +++ b/src/components/PrintView.tsx @@ -1,7 +1,7 @@ import type { CSSProperties } from "react"; import type { ArmyData, SavedCharacterEntry, SavedList, SavedUnitEntry } from "../types"; import { getUnit } from "../data/gameData"; -import { entryPoints, totalPoints } from "../domain/lists"; +import { breakPoint, entryPoints, totalPoints } from "../domain/lists"; import { getMagicItem } from "../domain/magicItems"; import { entryScoutingPoints, totalScoutingPoints } from "../domain/scouting"; import { @@ -104,7 +104,7 @@ export function PrintList({

{list.name}

{army.name} · Warmaster Revolution {list.ruleVersion} · {totalPoints(list, army)}/ - {list.pointsLimit} pts + {list.pointsLimit} pts · Breakpoint: {breakPoint(list)} {scoutingEnabled ? ` · Scouting units: ${totalScoutingPoints(list, army)} SP` : ""}

@@ -113,6 +113,7 @@ export function PrintList({ Qty Unit + Type Melee Attacks Ranged Attacks Bonus Attacks @@ -131,6 +132,7 @@ export function PrintList({ {row.quantity} {row.label} + {unit?.type ?? "-"} {unit ? (meleeAttacksLabel(unit) ?? "-") : "-"} {unit ? (rangedAttacksLabel(unit) ?? "-") : "-"} {unit?.bonusAttacks != null ? signedLabel(unit.bonusAttacks) : "-"} diff --git a/vite.config.ts b/vite.config.ts index 67f4acc..d758d73 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -5,6 +5,12 @@ import { cloudflare } from "@cloudflare/vite-plugin"; export default defineConfig({ plugins: [react(), cloudflare()], + // Most of the entry chunk is static army-list data. Its current 795 kB + // minified size compresses to about 167 kB over the network, so keep a + // slightly higher warning budget while still flagging meaningful growth. + build: { + chunkSizeWarningLimit: 850, + }, // 5273 instead of Vite's default 5173, which collides with another local // app. Overridable via PORT or --port (Playwright's web server uses 5177). server: process.env.PORT @@ -19,4 +25,4 @@ export default defineConfig({ // layout tests live in tests/ and run separately via `npm run test:layout`. include: ["src/**/*.test.{ts,tsx}", "scripts/**/*.test.mjs"], }, -}); \ No newline at end of file +});