Skip to content

Commit

Permalink
test(ts/components/diversionPage): add helpers for route interativity (
Browse files Browse the repository at this point in the history
  • Loading branch information
firestack authored Jun 17, 2024
1 parent 5e270be commit c8a22ca
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
10 changes: 4 additions & 6 deletions assets/tests/components/detours/diversionPage.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1733,14 +1733,12 @@ describe("DiversionPage", () => {
)

// Non-Interactive route shape
expect(
container.querySelectorAll(".c-detour_map--original-route-shape-core")
).toHaveLength(1)
expect(originalRouteShape.not.interactive.getAll(container)).toHaveLength(
1
)

// Interactive route shape
expect(
container.querySelectorAll(".c-detour_map--original-route-shape")
).toHaveLength(0)
expect(originalRouteShape.interactive.getAll(container)).toHaveLength(0)
})
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@ import { byRole } from "testing-library-selector"
export const finishDetourButton = byRole("button", { name: "Finish Detour" })

export const originalRouteShape = {
interactive: {
getAll: (container: HTMLElement) =>
container.querySelectorAll(".c-detour_map--original-route-shape"),
},
not: {
interactive: {
getAll: (container: HTMLElement) =>
container.querySelectorAll(".c-detour_map--original-route-shape-core"),
},
},

get(container: HTMLElement): Element {
const maybeShape = container.querySelector(
".c-detour_map--original-route-shape"
Expand Down

0 comments on commit c8a22ca

Please sign in to comment.