mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-18 21:16:47 +00:00
test(roadtrip): find the phone's navigate link by its state, not its label
The Up next card stopped printing a fixed key when the audit replaced the nonexistent places.navigate with the single navigation target's own name, so the assertion went looking for text that no longer exists and took the 4.3.0 branch red. The link is found by aria-disabled now, which is what the test is actually about.
This commit is contained in:
@@ -480,12 +480,15 @@ describe('MRoadtripTab', () => {
|
|||||||
|
|
||||||
it('FE-MOB-RTTAB-018: leaves the navigate link dead when the stop has no place row behind it', () => {
|
it('FE-MOB-RTTAB-018: leaves the navigate link dead when the stop has no place row behind it', () => {
|
||||||
const date = freezeAt(7, 0)
|
const date = freezeAt(7, 0)
|
||||||
|
// Found by the attribute, not by a label: the button carries the single navigation
|
||||||
|
// target's own name when there is exactly one, and a translated word otherwise, so
|
||||||
|
// its text depends on which map apps a place qualifies for.
|
||||||
const enabled = renderTab(planner(today(date)))
|
const enabled = renderTab(planner(today(date)))
|
||||||
expect(screen.getByText('places.navigate').closest('a')).toHaveAttribute('aria-disabled', 'false')
|
expect(enabled.container.querySelector('a[aria-disabled]')).toHaveAttribute('aria-disabled', 'false')
|
||||||
enabled.unmount()
|
enabled.unmount()
|
||||||
|
|
||||||
renderTab(planner({ ...today(date), places: [] }))
|
const { container } = renderTab(planner({ ...today(date), places: [] }))
|
||||||
const link = screen.getByText('places.navigate').closest('a') as HTMLElement
|
const link = container.querySelector('a[aria-disabled]') as HTMLElement
|
||||||
expect(link).toHaveAttribute('aria-disabled', 'true')
|
expect(link).toHaveAttribute('aria-disabled', 'true')
|
||||||
expect(link).toHaveAttribute('href', '#')
|
expect(link).toHaveAttribute('href', '#')
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user