This commit is contained in:
2026-11-02 20:31:15 +02:00
parent 8ddfa93f45
commit 1da273f1f3
131 changed files with 14802 additions and 526 deletions
+20 -18
View File
@@ -110,7 +110,7 @@ void test('map coverage distinguishes returned counts, missing provenance and tr
assert.doesNotMatch(empty, /As fichas continuam disponíveis abaixo/);
assert.doesNotMatch(empty, /Resultados limitados/);
});
void test('map layer choices preserve received records, coverage, unlocated links and filters without another request', async () => {
void test('one layered map preserves records, coverage, unlocated links and applied filters without a duplicate map or nonadministrative inference', async () => {
const previousFetch = globalThis.fetch;
let resolve;
const requests = [];
@@ -149,7 +149,7 @@ void test('map layer choices preserve received records, coverage, unlocated link
{
react: hooks,
'@/components/search-state': { default: SearchState },
'./territory-geometry-preview': { default: () => null },
'./catalogue-investment-map': { default: MapView },
'./interactive-investment-map': { default: MapView },
'./investment-map-coverage': { default: Coverage },
},
@@ -180,34 +180,36 @@ void test('map layer choices preserve received records, coverage, unlocated link
const map = () => flat(tree).find((node) => node.type === MapView);
assert.equal(map().props.points.length, 2);
assert.equal(map().props.areas.length, 1);
flat(tree)
.filter((node) => node.type === 'input')[0]
.props.onChange({ target: { checked: false } });
tree = render();
assert.deepEqual(map().props.points, []);
assert.equal(map().props.areas.length, 1);
flat(tree)
.filter((node) => node.type === 'input')[1]
.props.onChange({ target: { checked: false } });
tree = render();
assert.deepEqual(map().props.areas, []);
assert.equal(
flat(tree).filter((node) => node.type === MapView).length,
1,
);
assert.equal(
flat(tree).filter((node) => node.type === 'input').length,
0,
);
assert.equal(map().props.territoryId, 'synthetic-province');
const html = renderToStaticMarkup(tree);
assert.match(html, /Camadas ocultas/);
assert.match(html, /incluindo camadas ocultas/);
assert.match(html, /href="\/synthetic\/3"/);
assert.match(
html,
/<th scope="row">Marcadores de investimento<\/th><td>2<\/td>/,
);
for (const checkbox of flat(tree).filter(
(node) => node.type === 'input',
))
checkbox.props.onChange({ target: { checked: true } });
tree = render();
assert.equal(map().props.points, data.features);
assert.equal(map().props.areas, data.areas);
assert.equal(requests.length, 1);
assert.match(requests[0].url, /province_id=synthetic-province/);
cursor = 0;
const changed = Panel({
filters: { geo_location_id: 'synthetic-park' },
});
const changedMap = flat(changed).find((node) => node.type === MapView);
assert.equal(changedMap.props.territoryId, undefined);
assert.equal(changedMap.props.points, null);
assert.deepEqual(changedMap.props.areas, []);
assert(!flat(changed).some((node) => node.type === Coverage));
} finally {
cleanup?.();
globalThis.fetch = previousFetch;