forked from MapComplete/MapComplete
Fix bug: override preserves null's again
This commit is contained in:
parent
2f4ccae39e
commit
b43d976058
6 changed files with 205 additions and 87 deletions
|
@ -10,6 +10,7 @@ import LayerConfig from "../../../../Models/ThemeConfig/LayerConfig";
|
|||
import {ExtractImages} from "../../../../Models/ThemeConfig/Conversion/FixImages";
|
||||
import * as cyclofix from "../../../../assets/generated/themes/cyclofix.json"
|
||||
import {Tag} from "../../../../Logic/Tags/Tag";
|
||||
import {DesugaringContext} from "../../../../Models/ThemeConfig/Conversion/Conversion";
|
||||
|
||||
|
||||
const themeConfigJson: LayoutConfigJson = {
|
||||
|
@ -69,7 +70,6 @@ describe("PrepareTheme", () => {
|
|||
|
||||
})
|
||||
|
||||
|
||||
it("should apply override", () => {
|
||||
|
||||
const sharedLayers = new Map<string, LayerConfigJson>()
|
||||
|
@ -82,8 +82,65 @@ describe("PrepareTheme", () => {
|
|||
const layerUnderTest = <LayerConfig> themeConfig.layers.find(l => l.id === "public_bookcase")
|
||||
expect(layerUnderTest.source.geojsonSource).eq("https://example.com/data.geojson")
|
||||
})
|
||||
})
|
||||
|
||||
it("should remove names which are overriden with null", () => {
|
||||
const testLayer: LayerConfigJson = {
|
||||
source: {
|
||||
osmTags: "x=y"
|
||||
},
|
||||
id: "layer-example",
|
||||
name: {
|
||||
en: "Test layer - please ignore"
|
||||
},
|
||||
titleIcons : [],
|
||||
mapRendering: null
|
||||
}
|
||||
const ctx: DesugaringContext = {
|
||||
sharedLayers: new Map<string, LayerConfigJson>([[
|
||||
"layer-example", testLayer
|
||||
]]),
|
||||
tagRenderings: new Map<string, TagRenderingConfigJson>()
|
||||
|
||||
}
|
||||
const layout : LayoutConfigJson=
|
||||
{
|
||||
description: "A testing theme",
|
||||
icon: "",
|
||||
id: "",
|
||||
layers: [
|
||||
"layer-example",
|
||||
{
|
||||
"builtin": "layer-example",
|
||||
"override": {
|
||||
"name": null,
|
||||
"minzoom": 18
|
||||
}
|
||||
}
|
||||
],
|
||||
maintainer: "Me",
|
||||
startLat: 0,
|
||||
startLon: 0,
|
||||
startZoom: 0,
|
||||
title: "Test theme",
|
||||
version: ""
|
||||
|
||||
}
|
||||
const rewritten = new PrepareTheme(ctx, {
|
||||
skipDefaultLayers: true
|
||||
}).convertStrict(layout, "test")
|
||||
expect(rewritten.layers[0]).deep.eq(testLayer)
|
||||
expect(rewritten.layers[1]).deep.eq({
|
||||
source: {
|
||||
osmTags: "x=y"
|
||||
},
|
||||
id: "layer-example",
|
||||
name:null,
|
||||
minzoom: 18,
|
||||
mapRendering: null,
|
||||
titleIcons: []
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe("ExtractImages", () => {
|
||||
it("should find all images in a themefile", () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue