Skip to content

Commit d3f55f3

Browse files
authored
remove units for non-speed live traffic properties in tile popup (#316)
1 parent 1d99c61 commit d3f55f3

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

src/components/map/parts/tiles-property.spec.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,19 @@ describe('TilesProperty', () => {
164164
});
165165
});
166166

167+
describe('live traffic breakpoints and congestion', () => {
168+
it('should show speed without km/h unit', () => {
169+
render(
170+
<TilesProperty
171+
propertyKey="live_traffic:forward:congestion0"
172+
value={50}
173+
/>
174+
);
175+
expect(screen.getByText('50')).toBeInTheDocument();
176+
expect(screen.queryByText('km/h')).not.toBeInTheDocument();
177+
});
178+
});
179+
167180
describe('slope values', () => {
168181
it('should show slope with degree unit', () => {
169182
render(<TilesProperty propertyKey="max_up_slope" value={5} />);

src/components/map/parts/tiles-property.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,10 @@ export function TilesProperty({
8888
);
8989
}
9090

91-
if (propertyKey.includes('speed')) {
91+
if (
92+
propertyKey.includes('speed') &&
93+
!(propertyKey.includes('congestion') || propertyKey.includes('breakpoint'))
94+
) {
9295
return (
9396
<span className="font-mono text-xs">
9497
{String(value)}

0 commit comments

Comments
 (0)