mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-01 17:03:15 +00:00
fix(tours): name the path grades on the run card without dashes
The run card's grade rows and its hardest-grade badge borrowed the hiking
limit's labels, which read 'T1 — Hiking'. The card now has its own labels in
the bike card's style ('T1, hiking') in every language, and the hiking limit
keeps its own wording.
This commit is contained in:
@@ -59,7 +59,7 @@ describe('RunWaysCard (RUN-02)', () => {
|
||||
show({});
|
||||
expect(within(screen.getByTestId('route-ways-row-surface-paved')).getByText('60 %')).toBeInTheDocument();
|
||||
expect(screen.getByTestId('route-ways-row-surface-gravel')).toHaveTextContent('300 m');
|
||||
expect(screen.getByTestId('route-ways-row-grade-t1')).toHaveTextContent('T1');
|
||||
expect(screen.getByTestId('route-ways-row-grade-t1')).toHaveTextContent('T1, hiking');
|
||||
expect(screen.getByTestId('route-ways-row-grade-t2')).toHaveTextContent('10 %');
|
||||
expect(screen.getByTestId('route-ways-row-grade-none')).toHaveTextContent('No grade in the data');
|
||||
expect(screen.getByTestId('route-ways-row-way-track')).toBeInTheDocument();
|
||||
@@ -73,7 +73,8 @@ describe('RunWaysCard (RUN-02)', () => {
|
||||
expect(screen.getByText('40 % unpaved')).toBeInTheDocument();
|
||||
const hardest = screen.getByTestId('run-ways-hardest');
|
||||
expect(hardest).toHaveTextContent('T2');
|
||||
expect(hardest).toHaveTextContent(/Hardest graded path: T2/);
|
||||
expect(hardest).toHaveTextContent('Hardest graded path: T2, mountain hiking');
|
||||
expect(hardest.textContent).not.toMatch(/[\u2013\u2014]/);
|
||||
});
|
||||
|
||||
it('FE-TOUR-RUNWAYS-003: a grade row points at its stretches on the map in the grade colour, and lets go', () => {
|
||||
|
||||
@@ -26,10 +26,10 @@ const sacOf = (edge: RouteWayEdge) => edge.sac;
|
||||
/** The steps from easy to hard, so the hardest one along the route is the last one found. */
|
||||
const SAC_STEPS: readonly GradedClass[] = ['t1', 't2', 't3', 't4', 't5', 't6'];
|
||||
|
||||
/** A hiking grade in the words the hiking limit uses for it, a way without one as unknown. */
|
||||
/** A hiking grade in the card's own words, a way without one as unknown. */
|
||||
function useSacLabel() {
|
||||
const { t } = useTranslation();
|
||||
return (key: SacClass) => (key === 'none' ? t('tours.bike.trail.none') : t(`tours.planner.difficulty.${key}`));
|
||||
return (key: SacClass) => (key === 'none' ? t('tours.bike.trail.none') : t(`tours.run.ways.sac.${key}`));
|
||||
}
|
||||
|
||||
/** The hardest graded step along the route, or null when no way on it carries a grade. */
|
||||
|
||||
Reference in New Issue
Block a user