Fix themes, fix tests

This commit is contained in:
Pieter Vander Vennet 2023-11-13 13:45:22 +01:00
parent 255347fc06
commit edf7dba9e3
16 changed files with 350 additions and 297 deletions

View file

@ -110,8 +110,7 @@ export class Each<X, Y> extends Conversion<X[], Y[]> {
values[i]?.["id"] !== undefined ? values[i]?.["id"] : ""
)
}
const context_ = c.enter(i)
const r = step.convert(values[i], context_)
const r = step.convert(values[i], c.enter(i))
result.push(r)
}
return result

View file

@ -552,7 +552,7 @@ export class DetectShadowedMappings extends DesugaringStep<TagRenderingConfigJso
* const context = ConversionContext.test()
* const r = new DetectShadowedMappings().convert(tr, context);
* context.getAll("error").length // => 1
* context.getAll("error")[0].message.indexOf("The mapping key=value &x=y is fully matched by a previous mapping (namely 0)") >= 0 // => true
* context.getAll("error")[0].message.indexOf("The mapping key=value & x=y is fully matched by a previous mapping (namely 0)") >= 0 // => true
*/
convert(json: TagRenderingConfigJson, context: ConversionContext): TagRenderingConfigJson {
if (json.mappings === undefined || json.mappings.length === 0) {
@ -1067,7 +1067,12 @@ export class PrevalidateLayer extends DesugaringStep<LayerConfigJson> {
.err("Detected a 'pointRenderingS', it is written singular")
}
if (!(json.pointRendering?.length > 0)) {
if (
!(json.pointRendering?.length > 0) &&
json.pointRendering !== null &&
json.source !== "special" &&
json.source !== "special:library"
) {
context.enter("pointRendering").err("There are no pointRenderings at all...")
}

View file

@ -248,6 +248,7 @@ export interface LayerConfigJson {
/**
* Creates points to render on the map.
* This can render points for point-objects, lineobjects or areaobjects; use 'location' to indicate where it should be rendered
*
* group: pointrendering
*/
pointRendering: PointRenderingConfigJson[]

View file

@ -219,7 +219,7 @@ export default class LayerConfig extends WithContextLoader {
if (json.pointRendering) {
this.mapRendering = Utils.NoNull(json.pointRendering).map(
(r, i) => new PointRenderingConfig(r, `${context}[${i}]`)
(r, i) => new PointRenderingConfig(r, `${context}[${i}](${this.id})`)
)
} else {
this.mapRendering = []