Files
TREK/client/src/components/Map/PlaceHoverCard.test.tsx
T
Maurice 1a95157b3a feat(collections): say what a place is without having to click it
Asked for in the feedback: a wall of round photos, and no way to tell which is
which. "Name and displaying any custom rating would be very beneficial to quickly
seeing what is around you that is of interest."

The collections map had hover switched off. The trip map has told you what a
marker is all along, so it is the same card, now shared instead of written a
third time — it already existed twice, once per renderer, and the two had drifted
in how they resolved the category icon.

The card gains a rating, and so does the marker itself: an amber disc on the
corner where a trip's day numbers sit. The two never collide, because a numbered
stop is one already planned into a day and this answers the question asked before
that. Nothing is drawn for an unrated place, which is most of them.

Also from this round: the place panel's labels move up beside the name, where a
label belongs — read three rows down they looked like a property of the rating
above them — and the rating gets a ground of its own so a line of stars stops
reading as another row of text.
2026-09-13 16:49:20 +02:00

28 lines
1.2 KiB
TypeScript

import React from 'react'
import { describe, it, expect } from 'vitest'
import { render, screen } from '@testing-library/react'
import PlaceHoverCard from './PlaceHoverCard'
describe('PlaceHoverCard', () => {
it('FE-MAP-HOVERCARD-001: says what the place is, which a round photo cannot', () => {
render(<PlaceHoverCard x={10} y={20} name="Museumsinsel" categoryName="Sights" categoryIcon="Landmark" address="Bodestraße 1" />)
expect(screen.getByText('Museumsinsel')).toBeInTheDocument()
expect(screen.getByText('Sights')).toBeInTheDocument()
expect(screen.getByText('Bodestraße 1')).toBeInTheDocument()
})
it('FE-MAP-HOVERCARD-002: shows a rating beside the name, and only when there is one', () => {
const { rerender } = render(<PlaceHoverCard x={0} y={0} name="Museumsinsel" rating={4} />)
expect(screen.getByText('4')).toBeInTheDocument()
rerender(<PlaceHoverCard x={0} y={0} name="Museumsinsel" rating={null} />)
expect(screen.queryByText('4')).toBeNull()
})
it('FE-MAP-HOVERCARD-003: never takes the pointer — it is a label, not a target', () => {
render(<PlaceHoverCard x={0} y={0} name="Museumsinsel" />)
expect(screen.getByTestId('tooltip')).toHaveStyle({ pointerEvents: 'none' })
})
})