Skip to content

Open-source gym & body-weight tracker, now in the App Store (iPhone + Apple Watch) and as an Android APK. Plan routines, log workouts, see which muscles are trained, import from Strong/Hevy/FitNotes. Self-host it or use it on the phone alone.

Coach questionnaire: the day count and the weekdays are two labelled groups, the session length uses the app's wheels

Duarte Santoscb8f06c2c781
diff --git a/frontend/src/coach.css b/frontend/src/coach.css
index a2c2fdc39..97d2f7c8f 100644
--- a/frontend/src/coach.css
+++ b/frontend/src/coach.css
@@ -42,20 +42,11 @@
}
.ob-wd.on{color:var(--acc);border-color:var(--acc);background:var(--acc-soft)}
.ob-sub{font-size:15px;color:var(--label-2);margin:22px 0 10px;letter-spacing:-.006em}
-.ob-time{
- display:flex;align-items:center;justify-content:center;gap:10px;
- background:var(--surface);border-radius:var(--r-xl);padding:26px 18px;margin-top:4px
-}
-.ob-time input[type=time]{
- font-size:44px;font-weight:600;letter-spacing:-.03em;background:none;border:none;color:var(--label);
- font-variant-numeric:tabular-nums;padding:0;outline:none;text-align:center;width:auto;min-width:180px;
- -webkit-appearance:none;appearance:none;color-scheme:dark
-}
-:root[data-theme="light"] .ob-time input[type=time]{color-scheme:light}
-.ob-time input[type=time]::-webkit-calendar-picker-indicator{display:none}
-.ob-time .ob-wheel{appearance:none;-webkit-appearance:none;background:transparent;border:0;color:var(--label);font-size:56px;font-weight:700;font-variant-numeric:tabular-nums;letter-spacing:-.02em;padding:0 4px;text-align:center;min-width:1.6em}
-.ob-time .ob-time-sep{font-size:56px;font-weight:700;color:var(--label);margin:0 -2px;transform:translateY(-4px)}
-.ob-time .ob-time-l{font-size:15px;color:var(--label-2)}
+/* The days screen: the count and the weekdays each in their own box, with their own label. */
+.ob-group{background:var(--surface);border-radius:14px;padding:12px 12px 14px;margin-top:14px}
+.ob-group .ob-sub-first{margin:0 0 10px;font-weight:600;color:var(--label)}
+.ob-group .ob-days,.ob-group .ob-week{margin:0}
+.ob-group .ob-day:not(.on),.ob-group .ob-wd:not(.on){background:var(--surface-2)}
.ob-quick{display:flex;gap:7px;justify-content:center;flex-wrap:wrap;margin-top:12px}
.ob-chips{display:flex;flex-wrap:wrap;gap:8px}
.ob-chips .chip{padding:10px 16px;font-size:15px;border:1.5px solid transparent}
diff --git a/frontend/src/components/DurationWheel.jsx b/frontend/src/components/DurationWheel.jsx
index 73a7c823c..62af739cf 100644
--- a/frontend/src/components/DurationWheel.jsx
+++ b/frontend/src/components/DurationWheel.jsx
@@ -230,6 +230,37 @@ export default function DurationWheel({ value, onChange, min = 0, max = REST_MAX
)
}
+/**
+ * The same wheels for a longer span in hours and minutes: `value` and `onChange` are minutes,
+ * the minutes wheel steps by `step`. The Coach's session length uses it, so it looks like every
+ * other time picker in the app.
+ */
+export function HourMinuteWheel({ value, onChange, min = 10, max = 235, step = 5, className = '' }) {
+ const clamp = n => Math.max(min, Math.min(max, Math.round((Number(n) || 0) / step) * step))
+ const v = clamp(value)
+ const h = Math.floor(v / 60), mi = (v % 60) / step
+ const [nonce, setNonce] = useState(0)
+ const live = useRef({ h, mi })
+ live.current = { h, mi }
+ const pick = (hh, mm) => {
+ const next = clamp(hh * 60 + mm * step)
+ setNonce(n => n + 1)
+ if (next !== v) onChange(next)
+ }
+ const text = durationText(v * 60)
+ return (
+ <div className={'dw ' + className} data-nodrag="" dir="ltr">
+ <span className="dw-band" aria-hidden="true" />
+ <WheelColumn count={Math.floor(max / 60) + 1} index={h} nonce={nonce} step={1}
+ onPick={i => pick(i, live.current.mi)} label={t('Hours')} unit={t('h')} valueText={text}
+ disabledAt={i => i * 60 > max || i * 60 + 59 < min} />
+ <WheelColumn count={60 / step} index={mi} nonce={nonce} step={3} format={i => pad2(i * step)}
+ onPick={i => pick(live.current.h, i)} label={t('Minutes')} unit={t('min')} valueText={text}
+ disabledAt={i => h * 60 + i * step > max || h * 60 + i * step < min} />
+ </div>
+ )
+}
+
/* A sheet with the wheel, a read-out of what is set and Done. Nothing is saved until Done:
closing the sheet any other way leaves the setting as it was. */
function DurationSheet({ title, value, min, max, off, footer, onDone, close }) {
diff --git a/frontend/src/lib/pt-br-locale.test.js b/frontend/src/lib/pt-br-locale.test.js
index 40584a8d8..2ce700ee8 100644
--- a/frontend/src/lib/pt-br-locale.test.js
+++ b/frontend/src/lib/pt-br-locale.test.js
@@ -41,7 +41,7 @@ describe('Brazilian Portuguese locale', () => {
// has to be taught is a number nobody reads. What the numbers stood for is asserted above.
// If the hash fails, review the changed keys and wording before accepting a new one. From
// frontend/: node scripts/pt-br-inheritance-fingerprint.mjs --list
- expect(fingerprint, 'pt-PT inheritance changed; review the inherited pt-BR wording').toBe('e1eac562c2087de715552b4d092f9642c39f9c8e334c16000a2a78075fd83745')
+ expect(fingerprint, 'pt-PT inheritance changed; review the inherited pt-BR wording').toBe('7ec991d955078ae3097c247e0ec238b77782e428630daa6e36d14281bd91d2f3')
})
// pt-PT labelled Unpair 'Desfazer': Undo, in Portuguese (it is pt-BR's Undo), on the button that
diff --git a/frontend/src/locales/ar.js b/frontend/src/locales/ar.js
index 8c8bf2913..20d194143 100644
--- a/frontend/src/locales/ar.js
+++ b/frontend/src/locales/ar.js
@@ -2445,4 +2445,8 @@ export default {
'Workout running': 'تمرين جارٍ',
'Set {0} of {1}': 'المجموعة {0} من {1}',
'All sets done': 'اكتملت كل المجموعات',
+ // --- Coach intake: days and session wheels ---
+ 'Days per week': 'أيام في الأسبوع',
+ 'Hours': 'الساعات',
+ 'h': 'س',
}
diff --git a/frontend/src/locales/bn.js b/frontend/src/locales/bn.js
index 0df0886ba..5ef422188 100644
--- a/frontend/src/locales/bn.js
+++ b/frontend/src/locales/bn.js
@@ -2469,4 +2469,8 @@ export default {
'Workout running': 'ওয়ার্কআউট চলছে',
'Set {0} of {1}': 'সেট {0} / {1}',
'All sets done': 'সব সেট শেষ',
+ // --- Coach intake: days and session wheels ---
+ 'Days per week': 'সপ্তাহে কত দিন',
+ 'Hours': 'ঘণ্টা',
+ 'h': 'ঘ.',
}
diff --git a/frontend/src/locales/de.js b/frontend/src/locales/de.js
index d09bfe5ff..8a5cda2e5 100644
--- a/frontend/src/locales/de.js
+++ b/frontend/src/locales/de.js
@@ -2410,4 +2410,8 @@ export default {
'Workout running': 'Training läuft',
'Set {0} of {1}': 'Satz {0} von {1}',
'All sets done': 'Alle Sätze erledigt',
+ // --- Coach intake: days and session wheels ---
+ 'Days per week': 'Tage pro Woche',
+ 'Hours': 'Stunden',
+ 'h': 'h',
}
diff --git a/frontend/src/locales/es.js b/frontend/src/locales/es.js
index 5195ae291..7df683a40 100644
--- a/frontend/src/locales/es.js
+++ b/frontend/src/locales/es.js
@@ -2390,4 +2390,8 @@ export default {
'Workout running': 'Entreno en curso',
'Set {0} of {1}': 'Serie {0} de {1}',
'All sets done': 'Todas las series hechas',
+ // --- Coach intake: days and session wheels ---
+ 'Days per week': 'Días por semana',
+ 'Hours': 'Horas',
+ 'h': 'h',
}
diff --git a/frontend/src/locales/fr.js b/frontend/src/locales/fr.js
index 44b7d207b..19d0252c4 100644
--- a/frontend/src/locales/fr.js
+++ b/frontend/src/locales/fr.js
@@ -2390,4 +2390,8 @@ export default {
'Workout running': 'Séance en cours',
'Set {0} of {1}': 'Série {0} sur {1}',
'All sets done': 'Toutes les séries faites',
+ // --- Coach intake: days and session wheels ---
+ 'Days per week': 'Jours par semaine',
+ 'Hours': 'Heures',
+ 'h': 'h',
}
diff --git a/frontend/src/locales/hi.js b/frontend/src/locales/hi.js
index 28a1261dc..f9838e1d2 100644
--- a/frontend/src/locales/hi.js
+++ b/frontend/src/locales/hi.js
@@ -2390,4 +2390,8 @@ export default {
'Workout running': 'वर्कआउट चल रहा है',
'Set {0} of {1}': 'सेट {0} / {1}',
'All sets done': 'सारे सेट पूरे',
+ // --- Coach intake: days and session wheels ---
+ 'Days per week': 'हफ़्ते में दिन',
+ 'Hours': 'घंटे',
+ 'h': 'घं.',
}
diff --git a/frontend/src/locales/hu.js b/frontend/src/locales/hu.js
index 4423d93c0..1278c018e 100644
--- a/frontend/src/locales/hu.js
+++ b/frontend/src/locales/hu.js
@@ -2393,4 +2393,8 @@ export default {
'Workout running': 'Edzés folyamatban',
'Set {0} of {1}': '{0}. sorozat / {1}',
'All sets done': 'Minden sorozat kész',
+ // --- Coach intake: days and session wheels ---
+ 'Days per week': 'Nap hetente',
+ 'Hours': 'Órák',
+ 'h': 'ó',
}
diff --git a/frontend/src/locales/it.js b/frontend/src/locales/it.js
index a8aeebb57..a6c3469a2 100644
--- a/frontend/src/locales/it.js
+++ b/frontend/src/locales/it.js
@@ -2390,4 +2390,8 @@ export default {
'Workout running': 'Allenamento in corso',
'Set {0} of {1}': 'Serie {0} di {1}',
'All sets done': 'Tutte le serie fatte',
+ // --- Coach intake: days and session wheels ---
+ 'Days per week': 'Giorni a settimana',
+ 'Hours': 'Ore',
+ 'h': 'h',
}
diff --git a/frontend/src/locales/ko.js b/frontend/src/locales/ko.js
index 9ab4efed5..7c5fc9a45 100644
--- a/frontend/src/locales/ko.js
+++ b/frontend/src/locales/ko.js
@@ -2390,4 +2390,8 @@ export default {
'Workout running': '운동 중',
'Set {0} of {1}': '{1}세트 중 {0}세트',
'All sets done': '모든 세트 완료',
+ // --- Coach intake: days and session wheels ---
+ 'Days per week': '주당 일수',
+ 'Hours': '시간',
+ 'h': '시간',
}
diff --git a/frontend/src/locales/pl.js b/frontend/src/locales/pl.js
index 0952df3c4..9e50944eb 100644
--- a/frontend/src/locales/pl.js
+++ b/frontend/src/locales/pl.js
@@ -2390,4 +2390,8 @@ export default {
'Workout running': 'Trening trwa',
'Set {0} of {1}': 'Seria {0} z {1}',
'All sets done': 'Wszystkie serie zrobione',
+ // --- Coach intake: days and session wheels ---
+ 'Days per week': 'Dni w tygodniu',
+ 'Hours': 'Godziny',
+ 'h': 'godz.',
}
diff --git a/frontend/src/locales/pt.js b/frontend/src/locales/pt.js
index 7fce2071d..99d22e147 100644
--- a/frontend/src/locales/pt.js
+++ b/frontend/src/locales/pt.js
@@ -2390,4 +2390,8 @@ export default {
'Workout running': 'Treino a decorrer',
'Set {0} of {1}': 'Série {0} de {1}',
'All sets done': 'Todas as séries feitas',
+ // --- Coach intake: days and session wheels ---
+ 'Days per week': 'Dias por semana',
+ 'Hours': 'Horas',
+ 'h': 'h',
}
diff --git a/frontend/src/locales/ru.js b/frontend/src/locales/ru.js
index d0c3020d8..d46a39c71 100644
--- a/frontend/src/locales/ru.js
+++ b/frontend/src/locales/ru.js
@@ -2394,4 +2394,8 @@ export default {
'Workout running': 'Тренировка идёт',
'Set {0} of {1}': 'Подход {0} из {1}',
'All sets done': 'Все подходы сделаны',
+ // --- Coach intake: days and session wheels ---
+ 'Days per week': 'Дней в неделю',
+ 'Hours': 'Часы',
+ 'h': 'ч',
}
diff --git a/frontend/src/locales/th.js b/frontend/src/locales/th.js
index 72b604609..b71a612e6 100644
--- a/frontend/src/locales/th.js
+++ b/frontend/src/locales/th.js
@@ -2401,4 +2401,8 @@ export default {
'Workout running': 'กำลังฝึกอยู่',
'Set {0} of {1}': 'เซ็ต {0} จาก {1}',
'All sets done': 'ครบทุกเซ็ตแล้ว',
+ // --- Coach intake: days and session wheels ---
+ 'Days per week': 'วันต่อสัปดาห์',
+ 'Hours': 'ชั่วโมง',
+ 'h': 'ชม.',
}
diff --git a/frontend/src/locales/tr.js b/frontend/src/locales/tr.js
index d4724d8ea..e7985267c 100644
--- a/frontend/src/locales/tr.js
+++ b/frontend/src/locales/tr.js
@@ -2390,4 +2390,8 @@ export default {
'Workout running': 'Antrenman sürüyor',
'Set {0} of {1}': 'Set {0}/{1}',
'All sets done': 'Tüm setler tamam',
+ // --- Coach intake: days and session wheels ---
+ 'Days per week': 'Haftada kaç gün',
+ 'Hours': 'Saat',
+ 'h': 'sa',
}
diff --git a/frontend/src/locales/uk.js b/frontend/src/locales/uk.js
index 1471442b1..06e75de87 100644
--- a/frontend/src/locales/uk.js
+++ b/frontend/src/locales/uk.js
@@ -2387,4 +2387,8 @@ export default {
'Workout running': 'Тренування триває',
'Set {0} of {1}': 'Підхід {0} з {1}',
'All sets done': 'Усі підходи зроблено',
+ // --- Coach intake: days and session wheels ---
+ 'Days per week': 'Днів на тиждень',
+ 'Hours': 'Години',
+ 'h': 'год',
}
diff --git a/frontend/src/locales/zh-TW.js b/frontend/src/locales/zh-TW.js
index 35c411b23..66b40fab2 100644
--- a/frontend/src/locales/zh-TW.js
+++ b/frontend/src/locales/zh-TW.js
@@ -2383,4 +2383,8 @@ export default {
'Workout running': '訓練進行中',
'Set {0} of {1}': '第 {0} 組,共 {1} 組',
'All sets done': '所有組已完成',
+ // --- Coach intake: days and session wheels ---
+ 'Days per week': '每週天數',
+ 'Hours': '小時',
+ 'h': '小時',
}
diff --git a/frontend/src/locales/zh.js b/frontend/src/locales/zh.js
index 948af14e8..64d7ab289 100644
--- a/frontend/src/locales/zh.js
+++ b/frontend/src/locales/zh.js
@@ -2390,4 +2390,8 @@ export default {
'Workout running': '训练进行中',
'Set {0} of {1}': '第 {0} 组,共 {1} 组',
'All sets done': '所有组已完成',
+ // --- Coach intake: days and session wheels ---
+ 'Days per week': '每周天数',
+ 'Hours': '小时',
+ 'h': '小时',
}
diff --git a/frontend/src/views/CoachIntake.jsx b/frontend/src/views/CoachIntake.jsx
index 7954b9bf7..90d991d51 100644
--- a/frontend/src/views/CoachIntake.jsx
+++ b/frontend/src/views/CoachIntake.jsx
@@ -24,6 +24,7 @@ import { MOBILE } from '../lib/mobile.js'
import { activeProfile } from '../lib/equipment.js'
import Icon from '../components/Icon.jsx'
import { Button, TextArea } from '../components/ui.jsx'
+import { HourMinuteWheel } from '../components/DurationWheel.jsx'
import '../coach.css'
// Each choice's text returns [title, detail] in the current language, through literal t() calls
@@ -52,8 +53,7 @@ const EQUIPMENT = (() => {
})()
const QUICK_MIN = [30, 45, 60, 90]
-const toHHMM = min => String(Math.floor(min / 60)).padStart(2, '0') + ':' + String(min % 60).padStart(2, '0')
-const fromHHMM = v => { const [h, m] = String(v || '').split(':').map(Number); return Number.isFinite(h) && Number.isFinite(m) ? h * 60 + m : null }
+const toHHMM = min => Math.floor(min / 60) + ':' + String(min % 60).padStart(2, '0')
export default function CoachIntake() {
const nav = useNavigate()
@@ -175,12 +175,19 @@ export default function CoachIntake() {
<div className="ob-eyebrow">{t('Schedule')}</div>
<h1 className="ob-h">{t('How many days a week?')}</h1>
<p className="ob-p">{t('Pick what you will actually keep, not the best week you can imagine.')}</p>
- <div className="ob-days">
- {[1, 2, 3, 4, 5, 6, 7].map(n => <button key={n} className={'ob-day' + (p.daysPerWeek === n ? ' on' : '')} onClick={() => set({ daysPerWeek: n })}>{n}</button>)}
+ {/* Two questions, two groups: how many (a count), then which (weekdays, optional). Each
+ has its own label, so the row of numbers never reads as dates. */}
+ <div className="ob-group" role="group" aria-labelledby="ob-days-l">
+ <div className="ob-sub ob-sub-first" id="ob-days-l">{t('Days per week')}</div>
+ <div className="ob-days">
+ {[1, 2, 3, 4, 5, 6, 7].map(n => <button key={n} className={'ob-day' + (p.daysPerWeek === n ? ' on' : '')} aria-pressed={p.daysPerWeek === n} onClick={() => set({ daysPerWeek: n })}>{n}</button>)}
+ </div>
</div>
- <div className="ob-sub">{t('Which days suit you? (optional)')}</div>
- <div className="ob-week">
- {[1, 2, 3, 4, 5, 6, 0].map(d => <button key={d} className={'ob-wd' + (p.preferredDays.includes(d) ? ' on' : '')} onClick={() => toggleDay(d)}>{t(DAYN[d]).slice(0, 2)}</button>)}
+ <div className="ob-group" role="group" aria-labelledby="ob-week-l">
+ <div className="ob-sub ob-sub-first" id="ob-week-l">{t('Which days suit you? (optional)')}</div>
+ <div className="ob-week">
+ {[1, 2, 3, 4, 5, 6, 0].map(d => <button key={d} className={'ob-wd' + (p.preferredDays.includes(d) ? ' on' : '')} aria-pressed={p.preferredDays.includes(d)} onClick={() => toggleDay(d)}>{t(DAYN[d]).slice(0, 2)}</button>)}
+ </div>
</div>
</>}
@@ -188,20 +195,10 @@ export default function CoachIntake() {
<div className="ob-eyebrow">{t('Session length')}</div>
<h1 className="ob-h">{t('How long is a session?')}</h1>
<p className="ob-p">{t('The Coach fits the volume to the time you actually have, including rest between sets.')}</p>
- {/* A duration, not a clock time — so two wheels (hours, minutes in fives), never the
- native time input, which insists on AM/PM. */}
- <div className="ob-time" role="group" aria-label={t('How long is a session?')}>
- <select className="ob-wheel" value={Math.floor((p.sessionMin || 60) / 60)}
- onChange={e => set({ sessionMin: (+e.target.value) * 60 + ((p.sessionMin || 60) % 60) || 5 })}>
- {[0, 1, 2, 3].map(h => <option key={h} value={h}>{String(h).padStart(2, '0')}</option>)}
- </select>
- <span className="ob-time-sep">:</span>
- <select className="ob-wheel" value={(p.sessionMin || 60) % 60}
- onChange={e => set({ sessionMin: Math.floor((p.sessionMin || 60) / 60) * 60 + (+e.target.value) || 5 })}>
- {[0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55].map(m => <option key={m} value={m}>{String(m).padStart(2, '0')}</option>)}
- </select>
- <span className="ob-time-l">{t('h:mm')}</span>
- </div>
+ {/* A duration, not a clock time: the app's own wheels (hours, minutes in fives), like every
+ other time picker, never the native time input, which insists on AM/PM. */}
+ <div className="dw-read" aria-hidden="true">{toHHMM(p.sessionMin || 60)}</div>
+ <HourMinuteWheel value={p.sessionMin || 60} onChange={m => set({ sessionMin: m })} min={10} />
<div className="ob-quick">
{QUICK_MIN.map(m => <button key={m} className={'chip' + (p.sessionMin === m ? ' on' : '')} onClick={() => set({ sessionMin: m })}>{m} {t('min')}</button>)}
</div>
diff --git a/frontend/src/views/CoachIntake.test.jsx b/frontend/src/views/CoachIntake.test.jsx
index f4fdc533d..2dabaf65e 100644
--- a/frontend/src/views/CoachIntake.test.jsx
+++ b/frontend/src/views/CoachIntake.test.jsx
@@ -90,12 +90,10 @@ const tap = (sel, text) => {
}
const footBtn = () => host.querySelector('.ob-foot .btn')
const cont = () => act(() => footBtn().click())
-// A <select> is driven the same way an <input> is: React tracks the value through the
-// prototype setter, so a bare el.value never reaches onChange.
-const pick = (el, value) => act(() => {
- Object.getOwnPropertyDescriptor(el.constructor.prototype, 'value').set.call(el, String(value))
- el.dispatchEvent(new Event('change', { bubbles: true }))
-})
+// A wheel is driven by its keys, the spinbutton every wheel in the app is for a screen reader.
+const spin = (el, key) => act(() => { el.dispatchEvent(new KeyboardEvent('keydown', { key, bubbles: true, cancelable: true })) })
+// An <input> is driven through the prototype setter: React tracks the value there, so a bare
+// el.value never reaches onChange.
const typeIn = (el, value) => act(() => {
Object.getOwnPropertyDescriptor(el.constructor.prototype, 'value').set.call(el, value)
el.dispatchEvent(new Event('input', { bubbles: true }))
@@ -338,22 +336,22 @@ describe('CoachIntake — the two answers that gate the flow', () => {
} finally { await setLang('en') }
})
- it('refuses a session shorter than ten minutes', () => {
+ // The app's own wheels (DurationWheel.jsx HourMinuteWheel), like every other time picker.
+ it('the session wheels never go under ten minutes', () => {
mount(); walkTo('Session length')
- const [hours, minutes] = all('.ob-wheel')
+ expect(all('.ob-wheel')).toEqual([])
+ const [hours, minutes] = all('.dw .dw-col')
+ expect(hours.getAttribute('aria-label')).toBe('Hours')
expect(footBtn().disabled).toBe(false)
-
- // 00:00 is not a session, so the screen snaps it to five minutes — and five is still refused.
- pick(hours, 0)
- expect(footBtn().disabled).toBe(true)
- expect(minutes.value).toBe('5')
-
- pick(minutes, 0) // both wheels at nought snaps back to five, not zero
- expect(minutes.value).toBe('5')
- expect(footBtn().disabled).toBe(true)
-
- pick(minutes, 15)
+ spin(hours, 'Home') // 0:00 is not a session: the wheels stop at 0:10
+ expect(hours.getAttribute('aria-valuenow')).toBe('0')
+ expect(minutes.getAttribute('aria-valuenow')).toBe('2')
+ expect(host.querySelector('.dw-read').textContent).toBe('0:10')
expect(footBtn().disabled).toBe(false)
+ spin(minutes, 'ArrowDown')
+ expect(host.querySelector('.dw-read').textContent).toBe('0:10')
+ spin(minutes, 'ArrowUp')
+ expect(host.querySelector('.dw-read').textContent).toBe('0:15')
cont()
expect(eyebrow()).toBe('Equipment')
})
@@ -408,6 +406,10 @@ describe('CoachIntake — moving around', () => {
describe('CoachIntake — the answers themselves', () => {
it('preferred days toggle off and back on, and stay in weekday order', () => {
mount(); walkTo('Schedule')
+ // The count and the weekdays are two labelled groups (owner, TestFlight: they read as one list).
+ expect(all('.ob-group').map(g => g.querySelector('.ob-sub').textContent)).toEqual(['Days per week', 'Which days suit you? (optional)'])
+ expect(all('.ob-group')[0].querySelectorAll('.ob-day')).toHaveLength(7)
+ expect(all('.ob-group')[1].querySelectorAll('.ob-wd')).toHaveLength(7)
const wd = () => all('.ob-wd').filter(b => b.classList.contains('on')).map(b => b.textContent)
expect(wd()).toEqual(['Mo', 'We', 'Fr'])
tap('.ob-wd', 'We')
@@ -432,10 +434,11 @@ describe('CoachIntake — the answers themselves', () => {
it('the quick length chips and the two wheels write the same field', () => {
mount(); walkTo('Session length')
tap('.ob-quick .chip', '90')
- const [hours, minutes] = all('.ob-wheel')
- expect(hours.value).toBe('1')
- expect(minutes.value).toBe('30')
- pick(hours, 2)
+ const [hours, minutes] = all('.dw .dw-col')
+ expect(hours.getAttribute('aria-valuenow')).toBe('1')
+ expect(minutes.getAttribute('aria-valuenow')).toBe('6')
+ expect(host.querySelector('.dw-read').textContent).toBe('1:30')
+ spin(hours, 'ArrowUp')
expect(host.querySelector('.ob-quick .chip.on')).toBe(null)
walkTo('Almost there'); cont()
expect(mocks.S.coach.profile.sessionMin).toBe(150)