mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-14 14:40:52 +00:00
test(e2e): match the activity calendar on data attributes, not wording
The card carries data-period and each goal row and goal field a data-goal-key, so the spec no longer depends on the English labels.
This commit is contained in:
1 parent
89b30ebdee
commit
e696d6e526
4 files changed
+28
-14
No files matched your search
@@ -140,6 +140,13 @@ describe("ActivityCalendarCard", () => {
|
||||
state.data = calendar();
|
||||
const html = render();
|
||||
expect(html).toContain("Steps per month");
|
||||
// Stable hooks for the end-to-end spec, independent of the wording.
|
||||
expect(html).toContain(
|
||||
'data-slot="activity-calendar-goal" data-goal-key="stepsPerMonth"',
|
||||
);
|
||||
expect(html).toMatch(
|
||||
/data-slot="activity-calendar"[^>]*data-period="month"/,
|
||||
);
|
||||
expect(html).toContain(
|
||||
'data-slot="activity-calendar-week-goal" data-met="true"',
|
||||
);
|
||||
|
||||
@@ -173,6 +173,7 @@ export function ActivityCalendarCard() {
|
||||
<Card
|
||||
id="activity-calendar"
|
||||
data-slot="activity-calendar"
|
||||
data-period={period}
|
||||
className="scroll-mt-28"
|
||||
>
|
||||
<CardHeader>
|
||||
@@ -483,7 +484,12 @@ export function ActivityCalendarCard() {
|
||||
|
||||
<div className="space-y-2" data-slot="activity-calendar-goals">
|
||||
{data.goalProgress.map((g) => (
|
||||
<div key={g.key} className="space-y-1">
|
||||
<div
|
||||
key={g.key}
|
||||
className="space-y-1"
|
||||
data-slot="activity-calendar-goal"
|
||||
data-goal-key={g.key}
|
||||
>
|
||||
<div className="flex items-center justify-between gap-3 text-sm">
|
||||
<span className="inline-flex items-center gap-1.5">
|
||||
<Target
|
||||
|
||||
@@ -115,6 +115,7 @@ export function ActivityGoalsSheet({
|
||||
<Label htmlFor={id}>{t(`activityCalendar.goal.${key}`)}</Label>
|
||||
<Input
|
||||
id={id}
|
||||
data-goal-key={key}
|
||||
inputMode="numeric"
|
||||
autoComplete="off"
|
||||
value={draft[key]}
|
||||
|
||||
Reference in new issue
Block a user