diff --git a/src/components/map/TiledLayer.test.tsx b/src/components/map/TiledLayer.test.tsx index edcd89f..e5c58ef 100644 --- a/src/components/map/TiledLayer.test.tsx +++ b/src/components/map/TiledLayer.test.tsx @@ -1,4 +1,4 @@ -import { render, screen } from '@testing-library/react'; +import { render } from '@testing-library/react'; import TiledLayer from './TiledLayer'; import { TileFactory } from './types'; @@ -170,4 +170,81 @@ describe('The TiledLayer component ', () => { `); }); + test('Also works with negative coordinates', () => { + const { baseElement } = render( + + + + ); + // screen.debug(); + expect(baseElement).toMatchInlineSnapshot(` + +
+ + + + {"provider":"osm","zoomLevel":10,"x":2,"y":4} + + + + + {"provider":"osm","zoomLevel":10,"x":3,"y":4} + + + + + {"provider":"osm","zoomLevel":10,"x":2,"y":5} + + + + + {"provider":"osm","zoomLevel":10,"x":3,"y":5} + + + + + {"provider":"osm","zoomLevel":10,"x":2,"y":6} + + + + + {"provider":"osm","zoomLevel":10,"x":3,"y":6} + + + + + {"provider":"osm","zoomLevel":10,"x":2,"y":7} + + + + + {"provider":"osm","zoomLevel":10,"x":3,"y":7} + + + +
+ +`); + }); + }); diff --git a/src/components/map/TiledLayer.tsx b/src/components/map/TiledLayer.tsx index 5de7820..8269c48 100644 --- a/src/components/map/TiledLayer.tsx +++ b/src/components/map/TiledLayer.tsx @@ -23,6 +23,8 @@ export interface TiledLayerProperties { * * This component has no need to know the number nor the size of its tiles: tiles can be added when needed and * its unit is the tile size (the parent component needs to transform its enclosing SVG group to adapt its units) + * + * TODO: test tiles'X and Y boundaries. * */ export const TiledLayer: react.FC = (