mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-12 22:26:13 +00:00
style: apply prettier across the tree
One-shot prettier pass so the new format:check gate starts from a clean baseline. Formatting only — no behaviour change. Generator-owned and vendored artifacts stay untouched via .prettierignore.
This commit is contained in:
1 parent
b3fea2ef59
commit
1f4ba5939d
1000 files changed
+12130
-8385
No files matched your search
@@ -87,7 +87,7 @@ describe("MoodList — filter bar + multi-select chrome", () => {
|
||||
it("renders labelled selection checkboxes (per-row + select-all)", () => {
|
||||
const html = render("en");
|
||||
const boxes = html.match(/data-slot="checkbox"/g);
|
||||
expect((boxes?.length ?? 0)).toBeGreaterThanOrEqual(3);
|
||||
expect(boxes?.length ?? 0).toBeGreaterThanOrEqual(3);
|
||||
expect(html).toContain('aria-label="Select all on this page"');
|
||||
expect(html).toContain('aria-label="Select row"');
|
||||
});
|
||||
|
||||
@@ -35,14 +35,8 @@ function renderForm(footerSlot: HTMLElement | null = null): string {
|
||||
);
|
||||
}
|
||||
|
||||
const formSrc = readFileSync(
|
||||
resolve(__dirname, "../mood-form.tsx"),
|
||||
"utf8",
|
||||
);
|
||||
const listSrc = readFileSync(
|
||||
resolve(__dirname, "../mood-list.tsx"),
|
||||
"utf8",
|
||||
);
|
||||
const formSrc = readFileSync(resolve(__dirname, "../mood-form.tsx"), "utf8");
|
||||
const listSrc = readFileSync(resolve(__dirname, "../mood-list.tsx"), "utf8");
|
||||
|
||||
describe("MoodForm — 5-face hero (v1.12.0)", () => {
|
||||
it("renders the five mood faces as a radiogroup on a pristine form", () => {
|
||||
@@ -52,13 +46,7 @@ describe("MoodForm — 5-face hero (v1.12.0)", () => {
|
||||
expect(html).toContain('data-slot="mood-face-hero"');
|
||||
expect(html).toContain("How are you?");
|
||||
// Best-on-the-left order: every enum value renders one face button.
|
||||
for (const mood of [
|
||||
"SUPER_GUT",
|
||||
"GUT",
|
||||
"OKAY",
|
||||
"SCHLECHT",
|
||||
"LAUSIG",
|
||||
]) {
|
||||
for (const mood of ["SUPER_GUT", "GUT", "OKAY", "SCHLECHT", "LAUSIG"]) {
|
||||
expect(html).toContain(`data-mood="${mood}"`);
|
||||
}
|
||||
// The first face is SUPER_GUT (best on the left).
|
||||
@@ -73,7 +61,7 @@ describe("MoodForm — 5-face hero (v1.12.0)", () => {
|
||||
expect(html).not.toContain('data-slot="mood-annotate-panel"');
|
||||
expect(html).not.toContain('data-testid="mood-note-counter"');
|
||||
// The panel is gated on `moodPicked` (mood !== "").
|
||||
expect(formSrc).toContain("const moodPicked = mood !== \"\"");
|
||||
expect(formSrc).toContain('const moodPicked = mood !== ""');
|
||||
expect(formSrc).toMatch(
|
||||
/moodPicked &&[\s\S]*data-slot="mood-annotate-panel"/,
|
||||
);
|
||||
@@ -114,7 +102,9 @@ describe("MoodForm — Reset confirm when dirty (v1.11.5)", () => {
|
||||
/function requestReset\(\) \{[\s\S]*if \(isDirty\) \{[\s\S]*setResetConfirmOpen\(true\)/,
|
||||
);
|
||||
// A pristine form resets immediately (nothing to lose).
|
||||
expect(formSrc).toMatch(/if \(isDirty\) \{[\s\S]*\} else \{[\s\S]*resetForm\(\)/);
|
||||
expect(formSrc).toMatch(
|
||||
/if \(isDirty\) \{[\s\S]*\} else \{[\s\S]*resetForm\(\)/,
|
||||
);
|
||||
});
|
||||
|
||||
it("mounts the confirm AlertDialog wired to resetForm on the destructive action", () => {
|
||||
@@ -128,7 +118,9 @@ describe("MoodForm — Reset confirm when dirty (v1.11.5)", () => {
|
||||
describe("MoodForm — rated factors (v1.12.0)", () => {
|
||||
it("lifts a ratedFactors set and threads it to the tag picker", () => {
|
||||
expect(formSrc).toContain("const [ratedFactors, setRatedFactors]");
|
||||
expect(formSrc).toMatch(/function rateFactor\(key: string, rating: number \| null\)/);
|
||||
expect(formSrc).toMatch(
|
||||
/function rateFactor\(key: string, rating: number \| null\)/,
|
||||
);
|
||||
// The picker receives both the binary toggle and the factor rate
|
||||
// callbacks so it can render BINARY chips and RATED controls.
|
||||
expect(formSrc).toMatch(
|
||||
|
||||
@@ -8,11 +8,7 @@ describe("promoteRecentTags", () => {
|
||||
});
|
||||
|
||||
it("moves an already-present key to the front without duplicating", () => {
|
||||
expect(promoteRecentTags(["a", "b", "c"], ["b"])).toEqual([
|
||||
"b",
|
||||
"a",
|
||||
"c",
|
||||
]);
|
||||
expect(promoteRecentTags(["a", "b", "c"], ["b"])).toEqual(["b", "a", "c"]);
|
||||
});
|
||||
|
||||
it("keeps the latest of a multi-key use at the front", () => {
|
||||
@@ -40,18 +36,11 @@ describe("selectQuickTagKeys", () => {
|
||||
const catalog = ["a", "b", "c", "d", "e"];
|
||||
|
||||
it("returns the MRU keys that still exist in the catalog", () => {
|
||||
expect(selectQuickTagKeys(["c", "a"], catalog, 3)).toEqual([
|
||||
"c",
|
||||
"a",
|
||||
"b",
|
||||
]);
|
||||
expect(selectQuickTagKeys(["c", "a"], catalog, 3)).toEqual(["c", "a", "b"]);
|
||||
});
|
||||
|
||||
it("drops MRU keys no longer in the catalog", () => {
|
||||
expect(selectQuickTagKeys(["gone", "b"], catalog, 2)).toEqual([
|
||||
"b",
|
||||
"a",
|
||||
]);
|
||||
expect(selectQuickTagKeys(["gone", "b"], catalog, 2)).toEqual(["b", "a"]);
|
||||
});
|
||||
|
||||
it("falls back to the first catalog keys with no history", () => {
|
||||
@@ -59,10 +48,7 @@ describe("selectQuickTagKeys", () => {
|
||||
});
|
||||
|
||||
it("respects the limit", () => {
|
||||
expect(selectQuickTagKeys(["e", "d", "c"], catalog, 2)).toEqual([
|
||||
"e",
|
||||
"d",
|
||||
]);
|
||||
expect(selectQuickTagKeys(["e", "d", "c"], catalog, 2)).toEqual(["e", "d"]);
|
||||
});
|
||||
|
||||
it("never duplicates when topping up from the catalog", () => {
|
||||
|
||||
@@ -38,10 +38,7 @@ import { useTranslations } from "@/lib/i18n/context";
|
||||
import { useRovingRadioGroup } from "@/hooks/use-roving-radio-group";
|
||||
import { invalidateKeys, moodDependentKeys } from "@/lib/query-keys";
|
||||
import { ApiError, apiPost } from "@/lib/api/api-fetch";
|
||||
import {
|
||||
SheetSection,
|
||||
SheetSectionCount,
|
||||
} from "@/components/ui/sheet-section";
|
||||
import { SheetSection, SheetSectionCount } from "@/components/ui/sheet-section";
|
||||
import { MoodTagPicker, type RatedFactor } from "./mood-tag-picker";
|
||||
import { MoodQuickTags } from "./mood-quick-tags";
|
||||
import { useRecentTags } from "./recent-tags";
|
||||
|
||||
@@ -347,7 +347,13 @@ export function MoodList({ onAddFirst }: MoodListProps = {}) {
|
||||
note: string | null;
|
||||
moodLoggedAt: string;
|
||||
}) => {
|
||||
await apiPut(`/api/mood-entries/${id}`, { mood, tags, tagKeys, note, moodLoggedAt });
|
||||
await apiPut(`/api/mood-entries/${id}`, {
|
||||
mood,
|
||||
tags,
|
||||
tagKeys,
|
||||
note,
|
||||
moodLoggedAt,
|
||||
});
|
||||
},
|
||||
onSuccess: async () => {
|
||||
await invalidateKeys(queryClient, moodDependentKeys);
|
||||
|
||||
Reference in new issue
Block a user