-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Detour map not interactive until route pattern selected #2662
Conversation
Coverage of commit
|
Looks good here! One question, do you think it'd be worth trying to add tests for this? I didn't see any similar tests for the share panel, so I'm not sure we have anything existing to build off of? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Kayla's comment - I think tests are doable here
@hannahpurcell I think you could assert on the lack of a |
Kayla's right in that we really didn't have enough existing scaffolding to easily add a test for this. I've spent an hour on it, tried making a state machine snapshot factory that was less than successful, and can only think to mock the state machine, which we should certainly do, but is also certainly overkill for the small change happening here. Thoughts? |
You may be able to take the test("<rename this>", async () => {
const route = routeFactory.build()
const routePattern = routePatternFactory.build({
routeId: route.id,
})
jest.mocked(fetchRoutePatterns).mockResolvedValue([routePattern])
const { container } = render(
<RoutesProvider routes={[route]}>
<DiversionPage
originalRoute={{ route, routePattern }}
/>
</RoutesProvider>
)
await userEvent.click(
screen.getByRole("button", { name: "Change route or direction" })
)
expect(
container.querySelectorAll(".c-detour_map--original-route-shape-core")
).toHaveLength(<N>)
expect(
container.querySelectorAll(".c-detour_map--original-route-shape")
).toHaveLength(<M>)
}) The query selectors are a bit hard to read though, so it may be worth doing the abstraction where we can make the selectors within the At the very least, should probably add comments for which one is interactive and which one isn't |
I'm OOO today but think this shouldn't be blocked from going out today by a test (given Kathleen's prioritization of the issue). If making the above change would be super smooth (taking <30min of effort / review), would you be interested / able to do that? Otherwise, do you feel ok with shipping, and I add the test on Thursday? |
Yeah sure I can add the test and then assign Josh to review! |
Coverage of commit
|
@@ -1713,5 +1713,34 @@ describe("DiversionPage", () => { | |||
screen.getByRole("combobox", { name: "Choose route" }) | |||
).toHaveAccessibleErrorMessage("Select a route to continue.") | |||
}) | |||
|
|||
test("while on this panel, route is not interactive", async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome sauce!
This test is a perfect example of a test that will be a lot easier to write and work with once we build some better scaffolding for detour-related tests.
Thanks for adding it!
Asana Ticket: https://app.asana.com/0/1148853526253420/1207555257756259/f