Refactoring: use theme instead of layout in a lot of places

This commit is contained in:
Pieter Vander Vennet 2024-10-17 04:06:03 +02:00
parent 9427083939
commit bdc9ba52a6
104 changed files with 445 additions and 449 deletions

View file

@ -1,5 +1,5 @@
import { Utils } from "../../../src/Utils"
import LayoutConfig from "../../../src/Models/ThemeConfig/LayoutConfig"
import ThemeConfig from "../../../src/Models/ThemeConfig/ThemeConfig"
import * as bookcaseJson from "../../../src/assets/generated/themes/bookcases.json"
import { OsmTags } from "../../../src/Models/OsmFeature"
@ -46,7 +46,7 @@ Utils.injectJsonDownloadForTests("https://www.openstreetmap.org/api/0.6/node/556
Utils.injectJsonDownloadForTests("./assets/data/editor-layer-index.json", '{"features": [] }')
it("should download the latest version", async () => {
const state = new ThemeViewState(new LayoutConfig(<any>bookcaseJson, true), new Set<string>())
const state = new ThemeViewState(new ThemeConfig(<any>bookcaseJson, true), new Set<string>())
const feature: Feature<Geometry, OsmTags> = {
type: "Feature",
id: "node/5568693115",

View file

@ -1,4 +1,4 @@
import LayoutConfig from "../../../../src/Models/ThemeConfig/LayoutConfig"
import ThemeConfig from "../../../../src/Models/ThemeConfig/ThemeConfig"
import { FixLegacyTheme } from "../../../../src/Models/ThemeConfig/Conversion/LegacyJsonConvert"
import { describe, expect, it } from "vitest"
@ -139,7 +139,7 @@ describe("FixLegacyTheme", () => {
const fixed = new FixLegacyTheme().convert(<any>walking_node_theme, context)
// "Could not fix the legacy theme"
expect(!context.hasErrors())
const theme = new LayoutConfig(fixed, false)
const theme = new ThemeConfig(fixed, false)
expect(theme).toBeDefined()
})
})

View file

@ -1,7 +1,7 @@
import { LayoutConfigJson } from "../../../../src/Models/ThemeConfig/Json/LayoutConfigJson"
import { ThemeConfigJson } from "../../../../src/Models/ThemeConfig/Json/ThemeConfigJson"
import { LayerConfigJson } from "../../../../src/Models/ThemeConfig/Json/LayerConfigJson"
import { PrepareTheme } from "../../../../src/Models/ThemeConfig/Conversion/PrepareTheme"
import LayoutConfig from "../../../../src/Models/ThemeConfig/LayoutConfig"
import ThemeConfig from "../../../../src/Models/ThemeConfig/ThemeConfig"
import bookcaseLayer from "../../../../src/assets/generated/layers/public_bookcase.json"
import LayerConfig from "../../../../src/Models/ThemeConfig/LayerConfig"
import { ExtractImages } from "../../../../src/Models/ThemeConfig/Conversion/FixImages"
@ -14,7 +14,7 @@ import { QuestionableTagRenderingConfigJson } from "../../../../src/Models/Theme
import Constants from "../../../../src/Models/Constants"
import { ConversionContext } from "../../../../src/Models/ThemeConfig/Conversion/ConversionContext"
const themeConfigJson: LayoutConfigJson = {
const themeConfigJson: ThemeConfigJson = {
description: "Descr",
icon: "",
layers: [
@ -70,7 +70,7 @@ describe("PrepareTheme", () => {
publicLayers: new Set<string>(),
})
let themeConfigJsonPrepared = prepareStep.convertStrict(theme, ConversionContext.test())
const themeConfig = new LayoutConfig(themeConfigJsonPrepared)
const themeConfig = new ThemeConfig(themeConfigJsonPrepared)
const layerUnderTest = <LayerConfig>(
themeConfig.layers.find((l) => l.id === "public_bookcase")
)
@ -87,7 +87,7 @@ describe("PrepareTheme", () => {
sharedLayers,
publicLayers: new Set<string>(),
}).convertStrict(themeConfigJson, ConversionContext.test())
const themeConfig = new LayoutConfig(themeConfigJsonPrepared)
const themeConfig = new ThemeConfig(themeConfigJsonPrepared)
const layerUnderTest = <LayerConfig>(
themeConfig.layers.find((l) => l.id === "public_bookcase")
)
@ -108,7 +108,7 @@ describe("PrepareTheme", () => {
},
ConversionContext.test()
)
const themeConfig = new LayoutConfig(themeConfigJsonPrepared)
const themeConfig = new ThemeConfig(themeConfigJsonPrepared)
const layerUnderTest = <LayerConfig>(
themeConfig.layers.find((l) => l.id === "public_bookcase")
)
@ -149,7 +149,7 @@ describe("PrepareTheme", () => {
tagRenderings: new Map<string, QuestionableTagRenderingConfigJson>(),
publicLayers: new Set<string>(),
}
const layout: LayoutConfigJson = {
const layout: ThemeConfigJson = {
description: "A testing theme",
icon: "",
id: "",