From cf506750775020da5f72ea0ba155b1bf8513db2e Mon Sep 17 00:00:00 2001 From: evlist Date: Mon, 17 Oct 2022 17:56:03 +0200 Subject: [PATCH] Testing TiledLayer re-rendering. --- src/components/map/TiledLayer.test.tsx | 59 +++++++++++++++++++++----- 1 file changed, 48 insertions(+), 11 deletions(-) diff --git a/src/components/map/TiledLayer.test.tsx b/src/components/map/TiledLayer.test.tsx index b302103..5f5fbf6 100644 --- a/src/components/map/TiledLayer.test.tsx +++ b/src/components/map/TiledLayer.test.tsx @@ -2,16 +2,7 @@ import { render, screen } from '@testing-library/react'; import TiledLayer from './TiledLayer'; describe('The TiledLayer component ', () => { - test('', () => { - // const tiledLayer = renderer.create( - // - // ); - // const tree = tiledLayer.toJSON(); - // console.log(JSON.stringify(tree)); - + test('exposes the tiles needed per its viewport', () => { const { baseElement } = render( { /> ); -// screen.debug(); + // screen.debug(); expect(baseElement).toMatchInlineSnapshot(`
@@ -37,6 +28,52 @@ describe('The TiledLayer component ', () => {
+`); + }); + + test('adds more tiles when its viewport is updated without removing the previous ones', () => { + const { baseElement, rerender } = render( + + + + ); + rerender( + + + + ); + // screen.debug(); + expect(baseElement).toMatchInlineSnapshot(` + +
+ + + + + + + + +
+ `); }); });