feat(installations): add Navara renderer

This commit is contained in:
German Khokhlov committed 2026-10-28 12:18:03 +04:00
1 parent 965a82144c
commit 1a694baf5a
27 files changed
+1426 -47

No files matched your search

+33
View File
@@ -160,16 +160,49 @@ test('data credits go through the globe engine credits', async () => {
);
});
test('Google Places attribution is visible only while a layer displays Places data', async () => {
const { showGooglePlacesCredit, hideGooglePlacesCredit } =
await import('./dataCredits.js');
const { createFakeEngine } = await import('../globe/testing/fakeEngine.js');
const engine = createFakeEngine();
assert.equal(showGooglePlacesCredit(engine, 'installations'), true);
assert.equal(showGooglePlacesCredit(engine, 'installations'), false);
assert.equal(showGooglePlacesCredit(engine, 'other-layer'), true);
const visible = engine.fake.credits.filter(({ onScreen }) => onScreen);
assert.equal(visible.length, 1);
assert.match(visible[0].html, /Google Maps Places/);
assert.match(
visible[0].html,
/developers\.google\.com\/maps\/documentation\/places/,
);
assert.ok(engine.fake.callsOf('render.request').length > 0);
assert.equal(hideGooglePlacesCredit(engine, 'installations'), true);
assert.equal(
engine.fake.credits.filter(({ onScreen }) => onScreen).length,
1,
);
assert.equal(hideGooglePlacesCredit(engine, 'other-layer'), true);
assert.equal(hideGooglePlacesCredit(engine, 'installations'), false);
assert.equal(
engine.fake.credits.filter(({ onScreen }) => onScreen).length,
0,
);
});
test('without a viewer or engine the OSM and dynamic credits skip cleanly', async () => {
const {
registerDataCredits,
registerDynamicCredit,
showOsmCredit,
hideOsmCredit,
showGooglePlacesCredit,
hideGooglePlacesCredit,
} = await import('./dataCredits.js');
// The Navara mode has no viewer; a layer-side call with it must not throw.
assert.doesNotThrow(() => registerDataCredits(null, [{ html: 'A' }]));
assert.equal(showOsmCredit(null, 'owner'), false);
assert.equal(hideOsmCredit(null, 'owner'), false);
assert.equal(showGooglePlacesCredit(null, 'owner'), false);
assert.equal(hideGooglePlacesCredit(null, 'owner'), false);
assert.equal(registerDynamicCredit(null, { key: 'k', html: 'K' }), false);
});