Skip to content

Commit 6e57729

Browse files
committed
Fix stale test for choropleth fitbounds fallback behavior
The test asserted that any choroplethmap trace on the subplot forces getMapFitBounds to return null. That was true before choroplethmap support was added, but the added commit intentionally lets a choroplethmap trace with unresolved geojson be skipped while other traces still drive the fit, so the old assertion no longer matches the documented behavior. Updated the test to check that case, and added the real null case: a subplot where the only trace is a choroplethmap with no resolvable geojson.
1 parent a7fb52b commit 6e57729

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

test/jasmine/tests/map_get_fit_bounds_test.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,20 @@ describe('Test getMapFitBounds', () => {
149149
});
150150
});
151151

152-
it('returns null when a choroplethmap trace is present on the subplot', () => {
152+
it('skips a choroplethmap trace whose geojson has not resolved yet, using the other traces for bounds', () => {
153153
const fullData = [scattermap({ lon: [-10, 10], lat: [30, 40] }), choroplethmap()];
154-
// location-based traces need geojson bbox handling — bail entirely
154+
// choroplethmap() has no geojson set, so it can't contribute a bbox and is skipped;
155+
// the scattermap trace still drives the fit
156+
expect(getMapFitBounds(fullData, 'map')).toEqual({
157+
west: -10,
158+
east: 10,
159+
south: 30,
160+
north: 40
161+
});
162+
});
163+
164+
it('returns null when the only visible trace is a choroplethmap with unresolved geojson', () => {
165+
const fullData = [choroplethmap()];
155166
expect(getMapFitBounds(fullData, 'map')).toBe(null);
156167
});
157168

0 commit comments

Comments
 (0)