fix(directions): show a 996 m leg as 1.0 km, not 1000 m

routeDistanceText checked the raw meters against 1000 but printed them rounded to tens, so 995 m or more read "1000 m". Compare the rounded value so it moves to kilometres.
This commit is contained in:
Rudy Celekli committed 2026-10-25 11:32:15 -04:00
1 parent abd81155f9
commit b7e00f18a4
3 files changed
+7 -1

No files matched your search

+2
View File
@@ -846,6 +846,8 @@ test('route numbers follow the page language and never break from their unit', (
t.after(() => setLocale('en'));
assert.equal(routeDistanceText(8.4), '8\u00a0m');
assert.equal(routeDistanceText(236), '240\u00a0m');
assert.equal(routeDistanceText(994), '990\u00a0m');
assert.equal(routeDistanceText(996), '1.0\u00a0km');
assert.equal(routeDistanceText(1500), '1.5\u00a0km');
assert.equal(routeDistanceText(2_345_000), '2345\u00a0km');
assert.equal(routeDurationText(39), '39\u00a0s');