diff --git a/packages/landing/src/__tests__/map.config.test.ts b/packages/landing/src/__tests__/map.config.test.ts index 9d6899706..14d90bb33 100644 --- a/packages/landing/src/__tests__/map.config.test.ts +++ b/packages/landing/src/__tests__/map.config.test.ts @@ -209,10 +209,20 @@ describe('WindowUrl', () => { assert.equal(mc.labels, true); // aerial layer, labels enabled & debug disabled - mc.updateFromUrl('?labels=true'); - assert.equal(mc.layerId, 'aerial'); - assert.equal(mc.isDebug, false); - assert.equal(mc.labels, true); + for (const params of ['?labels', '?labels=true']) { + mc.updateFromUrl(params); + assert.equal(mc.layerId, 'aerial'); + assert.equal(mc.isDebug, false); + assert.equal(mc.labels, true); + } + + // aerial layer, labels enabled & debug enabled + for (const params of ['?labels&debug', '?labels=true&debug']) { + mc.updateFromUrl(params); + assert.equal(mc.layerId, 'aerial'); + assert.equal(mc.isDebug, true); + assert.equal(mc.labels, true); + } }); it('should not enable labels by default', () => { diff --git a/packages/landing/src/config.map.ts b/packages/landing/src/config.map.ts index 23c957462..6bd80302c 100644 --- a/packages/landing/src/config.map.ts +++ b/packages/landing/src/config.map.ts @@ -145,10 +145,14 @@ export class MapConfig extends Emitter { this.style = style ?? null; this.layerId = layerId.startsWith('im_') ? layerId.slice(3) : layerId; this.tileMatrix = tileMatrix; - if (labels == null) { - this.labels = layerId === 'aerial' && this.isDebug === false; + this.labels = false; + + if (typeof labels === 'string') { + // enable labels for any string value other than "false" + if (labels !== 'false') this.labels = true; } else { - this.labels = labels !== 'false'; + // if not in debug mode, show labels for the aerial layer by default + if (layerId === 'aerial' && !this.isDebug) this.labels = true; } if (this.layerId === 'topographic' && this.style == null) this.style = 'topographic';