@titan-design/react-ui 0.2.6 → 0.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-3VLOBS6O.mjs +846 -0
- package/dist/chunk-3VLOBS6O.mjs.map +1 -0
- package/dist/{chunk-UXVRPOME.mjs → chunk-5SSKGS6E.mjs} +3 -783
- package/dist/chunk-5SSKGS6E.mjs.map +1 -0
- package/dist/index.d.mts +1005 -4
- package/dist/index.d.ts +1005 -4
- package/dist/index.js +6043 -213
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5901 -177
- package/dist/index.mjs.map +1 -1
- package/dist/theme/index.d.mts +57 -1
- package/dist/theme/index.d.ts +57 -1
- package/dist/theme/index.js +63 -0
- package/dist/theme/index.js.map +1 -1
- package/dist/theme/index.mjs +2 -1
- package/dist/theme/tokens-css.d.mts +18 -0
- package/dist/theme/tokens-css.d.ts +18 -0
- package/dist/theme/tokens-css.js +289 -0
- package/dist/theme/tokens-css.js.map +1 -0
- package/dist/theme/tokens-css.mjs +24 -0
- package/dist/theme/tokens-css.mjs.map +1 -0
- package/package.json +16 -5
- package/src/components/custom/DateTime/DateTime.stories.tsx +1 -1
- package/src/components/custom/Gauge/Gauge.stories.tsx +45 -0
- package/src/components/custom/Gauge/Gauge.test.tsx +71 -0
- package/src/components/custom/Gauge/Gauge.tsx +167 -0
- package/src/components/custom/Gauge/index.ts +2 -0
- package/src/components/custom/Scatter/Scatter.stories.tsx +85 -0
- package/src/components/custom/Scatter/Scatter.test.tsx +96 -0
- package/src/components/custom/Scatter/Scatter.tsx +260 -0
- package/src/components/custom/Scatter/index.ts +2 -0
- package/src/components/custom/Sidebar/Sidebar.tsx +1 -1
- package/src/components/custom/Treemap/Treemap.stories.tsx +60 -0
- package/src/components/custom/Treemap/Treemap.test.tsx +67 -0
- package/src/components/custom/Treemap/Treemap.tsx +192 -0
- package/src/components/custom/Treemap/index.ts +2 -0
- package/src/components/custom/Workout/BaseBadge.stories.tsx +75 -0
- package/src/components/custom/Workout/BaseBadge.test.tsx +102 -0
- package/src/components/custom/Workout/BaseBadge.tsx +113 -0
- package/src/components/custom/Workout/BodyMap.stories.tsx +121 -0
- package/src/components/custom/Workout/BodyMap.test.tsx +124 -0
- package/src/components/custom/Workout/BodyMap.tsx +348 -0
- package/src/components/custom/Workout/BodyMapDetailPanel.stories.tsx +171 -0
- package/src/components/custom/Workout/BodyMapDetailPanel.test.tsx +225 -0
- package/src/components/custom/Workout/BodyMapDetailPanel.tsx +478 -0
- package/src/components/custom/Workout/CapacityBandChart.stories.tsx +125 -0
- package/src/components/custom/Workout/CapacityBandChart.test.tsx +193 -0
- package/src/components/custom/Workout/CapacityBandChart.tsx +493 -0
- package/src/components/custom/Workout/DeviationBar.stories.tsx +58 -0
- package/src/components/custom/Workout/DeviationBar.test.tsx +86 -0
- package/src/components/custom/Workout/DeviationBar.tsx +78 -0
- package/src/components/custom/Workout/ExerciseCard.stories.tsx +186 -0
- package/src/components/custom/Workout/ExerciseCard.test.tsx +319 -0
- package/src/components/custom/Workout/ExerciseCard.tsx +429 -0
- package/src/components/custom/Workout/InputBar.stories.tsx +75 -0
- package/src/components/custom/Workout/InputBar.test.tsx +116 -0
- package/src/components/custom/Workout/InputBar.tsx +163 -0
- package/src/components/custom/Workout/IntensityBar.stories.tsx +60 -0
- package/src/components/custom/Workout/IntensityBar.test.tsx +113 -0
- package/src/components/custom/Workout/IntensityBar.tsx +166 -0
- package/src/components/custom/Workout/MesoCard.stories.tsx +152 -0
- package/src/components/custom/Workout/MesoCard.test.tsx +170 -0
- package/src/components/custom/Workout/MesoCard.tsx +235 -0
- package/src/components/custom/Workout/MesoProgressBar.stories.tsx +85 -0
- package/src/components/custom/Workout/MesoProgressBar.test.tsx +141 -0
- package/src/components/custom/Workout/MesoProgressBar.tsx +161 -0
- package/src/components/custom/Workout/MesoStatusCard.stories.tsx +126 -0
- package/src/components/custom/Workout/MesoStatusCard.test.tsx +209 -0
- package/src/components/custom/Workout/MesoStatusCard.tsx +456 -0
- package/src/components/custom/Workout/MuscleGroupChip.stories.tsx +118 -0
- package/src/components/custom/Workout/MuscleGroupChip.test.tsx +91 -0
- package/src/components/custom/Workout/MuscleGroupChip.tsx +92 -0
- package/src/components/custom/Workout/PlaceholderStrip.stories.tsx +94 -0
- package/src/components/custom/Workout/PlaceholderStrip.test.tsx +83 -0
- package/src/components/custom/Workout/PlaceholderStrip.tsx +91 -0
- package/src/components/custom/Workout/PrBadge.stories.tsx +105 -0
- package/src/components/custom/Workout/PrBadge.test.tsx +111 -0
- package/src/components/custom/Workout/PrBadge.tsx +103 -0
- package/src/components/custom/Workout/PrHistoryModal.stories.tsx +116 -0
- package/src/components/custom/Workout/PrHistoryModal.test.tsx +161 -0
- package/src/components/custom/Workout/PrHistoryModal.tsx +244 -0
- package/src/components/custom/Workout/ReadinessCheck.stories.tsx +126 -0
- package/src/components/custom/Workout/ReadinessCheck.test.tsx +181 -0
- package/src/components/custom/Workout/ReadinessCheck.tsx +266 -0
- package/src/components/custom/Workout/RestTimer.tsx +8 -6
- package/src/components/custom/Workout/SetRow.stories.tsx +165 -0
- package/src/components/custom/Workout/SetRow.test.tsx +222 -0
- package/src/components/custom/Workout/SetRow.tsx +253 -0
- package/src/components/custom/Workout/Sparkline.stories.tsx +125 -0
- package/src/components/custom/Workout/Sparkline.test.tsx +113 -0
- package/src/components/custom/Workout/Sparkline.tsx +188 -0
- package/src/components/custom/Workout/StatusDot.stories.tsx +150 -0
- package/src/components/custom/Workout/StatusDot.test.tsx +165 -0
- package/src/components/custom/Workout/StatusDot.tsx +159 -0
- package/src/components/custom/Workout/StrengthTrendChart.stories.tsx +130 -0
- package/src/components/custom/Workout/StrengthTrendChart.test.tsx +217 -0
- package/src/components/custom/Workout/StrengthTrendChart.tsx +628 -0
- package/src/components/custom/Workout/SupersetWrapper.tsx +1 -2
- package/src/components/custom/Workout/TempoDisplay.stories.tsx +66 -0
- package/src/components/custom/Workout/TempoDisplay.test.tsx +90 -0
- package/src/components/custom/Workout/TempoDisplay.tsx +207 -0
- package/src/components/custom/Workout/VelocityStrip.stories.tsx +125 -0
- package/src/components/custom/Workout/VelocityStrip.test.tsx +234 -0
- package/src/components/custom/Workout/VelocityStrip.tsx +287 -0
- package/src/components/custom/Workout/WeekRow.stories.tsx +121 -0
- package/src/components/custom/Workout/WeekRow.test.tsx +117 -0
- package/src/components/custom/Workout/WeekRow.tsx +140 -0
- package/src/components/custom/Workout/WeightBadge.stories.tsx +87 -0
- package/src/components/custom/Workout/WeightBadge.test.tsx +164 -0
- package/src/components/custom/Workout/WeightBadge.tsx +113 -0
- package/src/components/custom/Workout/WorkoutCard.stories.tsx +135 -0
- package/src/components/custom/Workout/WorkoutCard.test.tsx +172 -0
- package/src/components/custom/Workout/WorkoutCard.tsx +226 -0
- package/src/components/custom/Workout/WorkoutPill.stories.tsx +63 -0
- package/src/components/custom/Workout/WorkoutPill.test.tsx +153 -0
- package/src/components/custom/Workout/WorkoutPill.tsx +177 -0
- package/src/components/custom/Workout/index.ts +113 -0
- package/src/components/custom/Workout/muscleTaxonomy.ts +252 -0
- package/src/components/custom/index.ts +3 -0
- package/src/components/custom/stepper/Stepper.stories.tsx +1 -1
- package/src/components/custom/stepper/Stepper.tsx +2 -2
- package/src/components/ui/autocomplete/Autocomplete.stories.tsx +1 -1
- package/src/components/ui/autocomplete/Autocomplete.tsx +1 -1
- package/src/components/ui/card/Card.tsx +1 -1
- package/src/components/ui/checkbox/Checkbox.tsx +1 -1
- package/src/components/ui/collapse/Collapse.tsx +1 -1
- package/src/components/ui/data-row/DataRow.stories.tsx +1 -1
- package/src/components/ui/drawer/Drawer.tsx +3 -3
- package/src/components/ui/form-field/FormField.tsx +1 -1
- package/src/components/ui/help-tip/HelpTip.tsx +1 -1
- package/src/components/ui/menu/Menu.tsx +2 -2
- package/src/components/ui/pill/Pill.tsx +1 -1
- package/src/components/ui/popover/Popover.stories.tsx +2 -2
- package/src/components/ui/popover/Popover.tsx +1 -1
- package/src/components/ui/radio/Radio.stories.tsx +1 -1
- package/src/components/ui/section/Section.stories.tsx +4 -4
- package/src/components/ui/select/Select.tsx +1 -1
- package/src/components/ui/stack/Stack.stories.tsx +4 -4
- package/src/components/ui/tabs/Tabs.tsx +2 -2
- package/src/components/ui/toolbar-button/ToolbarButton.stories.tsx +1 -1
- package/src/components/ui/toolbar-button/ToolbarButton.tsx +1 -1
- package/src/examples/react-hook-form/ControlledFields.tsx +171 -0
- package/src/examples/react-hook-form/ReactHookForm.stories.tsx +51 -0
- package/src/examples/react-hook-form/ReactHookForm.test.tsx +61 -0
- package/src/examples/react-hook-form/RhfContactForm.tsx +99 -0
- package/src/stories/PresetShowcase.stories.tsx +15 -15
- package/src/theme/index.ts +2 -1
- package/src/theme/manifest/css-property-manifest.example.json +79 -0
- package/src/theme/manifest/css-property-manifest.schema.json +93 -0
- package/src/theme/manifest/css-property-manifest.test.ts +81 -0
- package/src/theme/manifest/css-property-manifest.types.ts +49 -0
- package/src/theme/manifest/css-property-manifest.validate.ts +84 -0
- package/src/theme/manifest/index.ts +11 -0
- package/src/theme/tokens-css.test.ts +28 -0
- package/src/theme/tokens-css.ts +34 -0
- package/src/theme/workout-tokens.ts +61 -0
- package/dist/chunk-UXVRPOME.mjs.map +0 -1
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
import { describe, it, expect, vi } from 'vitest'
|
|
2
|
+
import { render, screen, fireEvent } from '@testing-library/react'
|
|
3
|
+
import { axe } from 'jest-axe'
|
|
4
|
+
import { ExerciseCard } from './ExerciseCard'
|
|
5
|
+
import type { SetRowProps } from './SetRow'
|
|
6
|
+
|
|
7
|
+
const baseCollapsedProps = {
|
|
8
|
+
name: 'Bench Press',
|
|
9
|
+
state: 'collapsed' as const,
|
|
10
|
+
onToggle: vi.fn(),
|
|
11
|
+
summary: { sets: 3, reps: 6, weight: 175, unit: 'lbs' as const },
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const baseSets: SetRowProps[] = [
|
|
15
|
+
{ mode: 'completed', setNumber: 1, reps: 8, weight: 135, unit: 'lbs' },
|
|
16
|
+
{ mode: 'completed', setNumber: 2, reps: 8, weight: 135, unit: 'lbs' },
|
|
17
|
+
{ mode: 'active', setNumber: 3, reps: null, weight: null, unit: 'lbs', isNextSet: true },
|
|
18
|
+
]
|
|
19
|
+
|
|
20
|
+
describe('ExerciseCard', () => {
|
|
21
|
+
describe('collapsed state', () => {
|
|
22
|
+
it('renders exercise name', () => {
|
|
23
|
+
render(<ExerciseCard {...baseCollapsedProps} />)
|
|
24
|
+
expect(screen.getByTestId('exercise-card-name')).toHaveTextContent('Bench Press')
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
it('renders summary text', () => {
|
|
28
|
+
render(<ExerciseCard {...baseCollapsedProps} />)
|
|
29
|
+
expect(screen.getByTestId('exercise-card-summary')).toHaveTextContent(
|
|
30
|
+
'3\u00D76 @ 175 lbs',
|
|
31
|
+
)
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
it('renders WeightBadge when e1rm provided', () => {
|
|
35
|
+
render(
|
|
36
|
+
<ExerciseCard
|
|
37
|
+
{...baseCollapsedProps}
|
|
38
|
+
e1rm={{ value: 225, unit: 'lbs' }}
|
|
39
|
+
/>,
|
|
40
|
+
)
|
|
41
|
+
expect(screen.getByTestId('exercise-card-e1rm')).toBeInTheDocument()
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
it('renders PrBadge when isPR is true', () => {
|
|
45
|
+
render(<ExerciseCard {...baseCollapsedProps} isPR />)
|
|
46
|
+
expect(screen.getByTestId('pr-badge-star')).toBeInTheDocument()
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
it('renders mini velocity strips for completed sets', () => {
|
|
50
|
+
render(
|
|
51
|
+
<ExerciseCard
|
|
52
|
+
{...baseCollapsedProps}
|
|
53
|
+
setVelocities={[[1.1, 0.95], [0.9, 0.8]]}
|
|
54
|
+
totalPlannedSets={4}
|
|
55
|
+
/>,
|
|
56
|
+
)
|
|
57
|
+
expect(screen.getByTestId('exercise-card-velocity-strip-0')).toBeInTheDocument()
|
|
58
|
+
expect(screen.getByTestId('exercise-card-velocity-strip-1')).toBeInTheDocument()
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
it('renders placeholder strips for remaining planned sets', () => {
|
|
62
|
+
render(
|
|
63
|
+
<ExerciseCard
|
|
64
|
+
{...baseCollapsedProps}
|
|
65
|
+
setVelocities={[[1.1, 0.95]]}
|
|
66
|
+
totalPlannedSets={3}
|
|
67
|
+
/>,
|
|
68
|
+
)
|
|
69
|
+
expect(screen.getByTestId('exercise-card-placeholder-0')).toBeInTheDocument()
|
|
70
|
+
expect(screen.getByTestId('exercise-card-placeholder-1')).toBeInTheDocument()
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
it('does not render strips container when no velocities and no planned sets', () => {
|
|
74
|
+
render(<ExerciseCard {...baseCollapsedProps} />)
|
|
75
|
+
expect(screen.queryByTestId('exercise-card-strips')).not.toBeInTheDocument()
|
|
76
|
+
})
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
describe('expanded state', () => {
|
|
80
|
+
const expandedProps = {
|
|
81
|
+
name: 'Squat',
|
|
82
|
+
state: 'expanded' as const,
|
|
83
|
+
onToggle: vi.fn(),
|
|
84
|
+
summary: { sets: 3, reps: 8, weight: 185, unit: 'lbs' as const },
|
|
85
|
+
sets: baseSets,
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
it('renders exercise name in header', () => {
|
|
89
|
+
render(<ExerciseCard {...expandedProps} />)
|
|
90
|
+
expect(screen.getByTestId('exercise-card-name')).toHaveTextContent('Squat')
|
|
91
|
+
})
|
|
92
|
+
|
|
93
|
+
it('renders column headers', () => {
|
|
94
|
+
render(<ExerciseCard {...expandedProps} />)
|
|
95
|
+
const headers = screen.getByTestId('exercise-card-column-headers')
|
|
96
|
+
expect(headers).toHaveTextContent('SET')
|
|
97
|
+
expect(headers).toHaveTextContent('PREV')
|
|
98
|
+
expect(headers).toHaveTextContent('REPS')
|
|
99
|
+
expect(headers).toHaveTextContent('LBS')
|
|
100
|
+
expect(headers).toHaveTextContent('RPE')
|
|
101
|
+
})
|
|
102
|
+
|
|
103
|
+
it('renders SetRow components', () => {
|
|
104
|
+
render(<ExerciseCard {...expandedProps} />)
|
|
105
|
+
const setRows = screen.getAllByTestId('set-row')
|
|
106
|
+
expect(setRows).toHaveLength(3)
|
|
107
|
+
})
|
|
108
|
+
|
|
109
|
+
it('renders TempoDisplay when tempo provided', () => {
|
|
110
|
+
render(
|
|
111
|
+
<ExerciseCard
|
|
112
|
+
{...expandedProps}
|
|
113
|
+
tempo={[2, 1, 3, 0]}
|
|
114
|
+
/>,
|
|
115
|
+
)
|
|
116
|
+
expect(screen.getByTestId('exercise-card-tempo')).toBeInTheDocument()
|
|
117
|
+
expect(screen.getByTestId('tempo-display')).toBeInTheDocument()
|
|
118
|
+
})
|
|
119
|
+
|
|
120
|
+
it('does not render TempoDisplay when no tempo', () => {
|
|
121
|
+
render(<ExerciseCard {...expandedProps} />)
|
|
122
|
+
expect(screen.queryByTestId('exercise-card-tempo')).not.toBeInTheDocument()
|
|
123
|
+
})
|
|
124
|
+
|
|
125
|
+
it('sets aria-expanded on header button', () => {
|
|
126
|
+
render(<ExerciseCard {...expandedProps} />)
|
|
127
|
+
const header = screen.getByTestId('exercise-card-header')
|
|
128
|
+
expect(header).toHaveAttribute('aria-expanded', 'true')
|
|
129
|
+
})
|
|
130
|
+
})
|
|
131
|
+
|
|
132
|
+
describe('upcoming state', () => {
|
|
133
|
+
const upcomingProps = {
|
|
134
|
+
name: 'Deadlift',
|
|
135
|
+
state: 'upcoming' as const,
|
|
136
|
+
onToggle: vi.fn(),
|
|
137
|
+
prescription: '3\u00D78-12 @ RPE 8',
|
|
138
|
+
previousBest: '185 lbs \u00D7 10',
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
it('renders with reduced opacity', () => {
|
|
142
|
+
render(<ExerciseCard {...upcomingProps} />)
|
|
143
|
+
const card = screen.getByTestId('exercise-card')
|
|
144
|
+
expect(card).toHaveStyle({ opacity: 0.6 })
|
|
145
|
+
})
|
|
146
|
+
|
|
147
|
+
it('renders exercise name', () => {
|
|
148
|
+
render(<ExerciseCard {...upcomingProps} />)
|
|
149
|
+
expect(screen.getByTestId('exercise-card-name')).toHaveTextContent('Deadlift')
|
|
150
|
+
})
|
|
151
|
+
|
|
152
|
+
it('renders prescription text', () => {
|
|
153
|
+
render(<ExerciseCard {...upcomingProps} />)
|
|
154
|
+
expect(screen.getByTestId('exercise-card-prescription')).toHaveTextContent(
|
|
155
|
+
'3\u00D78-12 @ RPE 8',
|
|
156
|
+
)
|
|
157
|
+
})
|
|
158
|
+
|
|
159
|
+
it('renders previous best text', () => {
|
|
160
|
+
render(<ExerciseCard {...upcomingProps} />)
|
|
161
|
+
expect(screen.getByTestId('exercise-card-previous-best')).toHaveTextContent(
|
|
162
|
+
'185 lbs \u00D7 10',
|
|
163
|
+
)
|
|
164
|
+
})
|
|
165
|
+
|
|
166
|
+
it('does not render interactive elements', () => {
|
|
167
|
+
render(<ExerciseCard {...upcomingProps} />)
|
|
168
|
+
expect(screen.queryByTestId('exercise-card-strips')).not.toBeInTheDocument()
|
|
169
|
+
expect(screen.queryByTestId('exercise-card-column-headers')).not.toBeInTheDocument()
|
|
170
|
+
})
|
|
171
|
+
})
|
|
172
|
+
|
|
173
|
+
describe('onToggle', () => {
|
|
174
|
+
it('fires onToggle when collapsed card is pressed', () => {
|
|
175
|
+
const onToggle = vi.fn()
|
|
176
|
+
render(
|
|
177
|
+
<ExerciseCard
|
|
178
|
+
{...baseCollapsedProps}
|
|
179
|
+
onToggle={onToggle}
|
|
180
|
+
/>,
|
|
181
|
+
)
|
|
182
|
+
fireEvent.click(screen.getByTestId('exercise-card-header'))
|
|
183
|
+
expect(onToggle).toHaveBeenCalledOnce()
|
|
184
|
+
})
|
|
185
|
+
|
|
186
|
+
it('fires onToggle when expanded header is pressed', () => {
|
|
187
|
+
const onToggle = vi.fn()
|
|
188
|
+
render(
|
|
189
|
+
<ExerciseCard
|
|
190
|
+
name="Squat"
|
|
191
|
+
state="expanded"
|
|
192
|
+
onToggle={onToggle}
|
|
193
|
+
sets={baseSets}
|
|
194
|
+
/>,
|
|
195
|
+
)
|
|
196
|
+
fireEvent.click(screen.getByTestId('exercise-card-header'))
|
|
197
|
+
expect(onToggle).toHaveBeenCalledOnce()
|
|
198
|
+
})
|
|
199
|
+
})
|
|
200
|
+
|
|
201
|
+
describe('superset position border radius', () => {
|
|
202
|
+
it('applies first position border radius', () => {
|
|
203
|
+
render(
|
|
204
|
+
<ExerciseCard
|
|
205
|
+
{...baseCollapsedProps}
|
|
206
|
+
supersetPosition="first"
|
|
207
|
+
/>,
|
|
208
|
+
)
|
|
209
|
+
const card = screen.getByTestId('exercise-card')
|
|
210
|
+
const container = card.firstChild as HTMLElement
|
|
211
|
+
expect(container).toHaveStyle({
|
|
212
|
+
borderTopLeftRadius: '12px',
|
|
213
|
+
borderTopRightRadius: '12px',
|
|
214
|
+
borderBottomLeftRadius: '8px',
|
|
215
|
+
borderBottomRightRadius: '8px',
|
|
216
|
+
})
|
|
217
|
+
})
|
|
218
|
+
|
|
219
|
+
it('applies last position border radius', () => {
|
|
220
|
+
render(
|
|
221
|
+
<ExerciseCard
|
|
222
|
+
{...baseCollapsedProps}
|
|
223
|
+
supersetPosition="last"
|
|
224
|
+
/>,
|
|
225
|
+
)
|
|
226
|
+
const card = screen.getByTestId('exercise-card')
|
|
227
|
+
const container = card.firstChild as HTMLElement
|
|
228
|
+
expect(container).toHaveStyle({
|
|
229
|
+
borderTopLeftRadius: '8px',
|
|
230
|
+
borderTopRightRadius: '8px',
|
|
231
|
+
borderBottomLeftRadius: '12px',
|
|
232
|
+
borderBottomRightRadius: '12px',
|
|
233
|
+
})
|
|
234
|
+
})
|
|
235
|
+
|
|
236
|
+
it('applies middle position border radius', () => {
|
|
237
|
+
render(
|
|
238
|
+
<ExerciseCard
|
|
239
|
+
{...baseCollapsedProps}
|
|
240
|
+
supersetPosition="middle"
|
|
241
|
+
/>,
|
|
242
|
+
)
|
|
243
|
+
const card = screen.getByTestId('exercise-card')
|
|
244
|
+
const container = card.firstChild as HTMLElement
|
|
245
|
+
expect(container).toHaveStyle({
|
|
246
|
+
borderTopLeftRadius: '8px',
|
|
247
|
+
borderTopRightRadius: '8px',
|
|
248
|
+
borderBottomLeftRadius: '8px',
|
|
249
|
+
borderBottomRightRadius: '8px',
|
|
250
|
+
})
|
|
251
|
+
})
|
|
252
|
+
})
|
|
253
|
+
|
|
254
|
+
describe('accessibility', () => {
|
|
255
|
+
it('has correct accessibility label for collapsed state', () => {
|
|
256
|
+
render(<ExerciseCard {...baseCollapsedProps} />)
|
|
257
|
+
expect(
|
|
258
|
+
screen.getByLabelText('Bench Press, 3\u00D76 @ 175 lbs'),
|
|
259
|
+
).toBeInTheDocument()
|
|
260
|
+
})
|
|
261
|
+
|
|
262
|
+
it('has correct accessibility label for upcoming state with prescription', () => {
|
|
263
|
+
render(
|
|
264
|
+
<ExerciseCard
|
|
265
|
+
name="Deadlift"
|
|
266
|
+
state="upcoming"
|
|
267
|
+
onToggle={vi.fn()}
|
|
268
|
+
prescription="3x8 @ RPE 8"
|
|
269
|
+
/>,
|
|
270
|
+
)
|
|
271
|
+
expect(
|
|
272
|
+
screen.getByLabelText('Deadlift, 3x8 @ RPE 8'),
|
|
273
|
+
).toBeInTheDocument()
|
|
274
|
+
})
|
|
275
|
+
|
|
276
|
+
it('has no accessibility violations in collapsed state', async () => {
|
|
277
|
+
const { container } = render(
|
|
278
|
+
<ExerciseCard
|
|
279
|
+
{...baseCollapsedProps}
|
|
280
|
+
e1rm={{ value: 225, unit: 'lbs' }}
|
|
281
|
+
isPR
|
|
282
|
+
setVelocities={[[1.1, 0.95]]}
|
|
283
|
+
totalPlannedSets={3}
|
|
284
|
+
/>,
|
|
285
|
+
)
|
|
286
|
+
const results = await axe(container)
|
|
287
|
+
expect(results).toHaveNoViolations()
|
|
288
|
+
})
|
|
289
|
+
|
|
290
|
+
it('has no accessibility violations in expanded state', async () => {
|
|
291
|
+
const { container } = render(
|
|
292
|
+
<ExerciseCard
|
|
293
|
+
name="Squat"
|
|
294
|
+
state="expanded"
|
|
295
|
+
onToggle={vi.fn()}
|
|
296
|
+
summary={{ sets: 3, reps: 8, weight: 185, unit: 'lbs' }}
|
|
297
|
+
sets={baseSets}
|
|
298
|
+
tempo={[2, 1, 3, 0]}
|
|
299
|
+
/>,
|
|
300
|
+
)
|
|
301
|
+
const results = await axe(container)
|
|
302
|
+
expect(results).toHaveNoViolations()
|
|
303
|
+
})
|
|
304
|
+
|
|
305
|
+
it('has no accessibility violations in upcoming state', async () => {
|
|
306
|
+
const { container } = render(
|
|
307
|
+
<ExerciseCard
|
|
308
|
+
name="Deadlift"
|
|
309
|
+
state="upcoming"
|
|
310
|
+
onToggle={vi.fn()}
|
|
311
|
+
prescription="3x8 @ RPE 8"
|
|
312
|
+
previousBest="185 lbs x 10"
|
|
313
|
+
/>,
|
|
314
|
+
)
|
|
315
|
+
const results = await axe(container)
|
|
316
|
+
expect(results).toHaveNoViolations()
|
|
317
|
+
})
|
|
318
|
+
})
|
|
319
|
+
})
|