2021-04-22 03:30:46 +02:00
|
|
|
import T from "./TestHelper";
|
|
|
|
import * as assert from "assert";
|
2021-08-07 23:11:34 +02:00
|
|
|
import {LayoutConfigJson} from "../Models/ThemeConfig/Json/LayoutConfigJson";
|
|
|
|
import LayoutConfig from "../Models/ThemeConfig/LayoutConfig";
|
2021-12-21 21:15:07 +01:00
|
|
|
import * as bookcaseLayer from "../assets/generated/layers/public_bookcase.json"
|
|
|
|
import {TagRenderingConfigJson} from "../Models/ThemeConfig/Json/TagRenderingConfigJson";
|
|
|
|
import {LayerConfigJson} from "../Models/ThemeConfig/Json/LayerConfigJson";
|
|
|
|
import Constants from "../Models/Constants";
|
2022-01-21 01:57:16 +01:00
|
|
|
import {PrepareTheme} from "../Models/ThemeConfig/Conversion/PrepareTheme";
|
2021-04-22 03:30:46 +02:00
|
|
|
|
2021-09-09 00:05:51 +02:00
|
|
|
export default class ThemeSpec extends T {
|
2021-05-14 02:25:30 +02:00
|
|
|
constructor() {
|
2022-01-26 21:40:38 +01:00
|
|
|
super([
|
|
|
|
["Nested overrides work", () => {
|
2021-04-22 03:30:46 +02:00
|
|
|
|
2022-01-26 21:40:38 +01:00
|
|
|
let themeConfigJson: LayoutConfigJson = {
|
|
|
|
description: "Descr",
|
|
|
|
icon: "",
|
|
|
|
layers: [
|
|
|
|
{
|
|
|
|
builtin: "public_bookcase",
|
|
|
|
override: {
|
|
|
|
source: {
|
|
|
|
geoJson: "xyz"
|
2021-05-14 02:25:30 +02:00
|
|
|
}
|
2021-04-22 03:30:46 +02:00
|
|
|
}
|
2022-01-26 21:40:38 +01:00
|
|
|
}
|
|
|
|
],
|
|
|
|
maintainer: "",
|
|
|
|
startLat: 0,
|
|
|
|
startLon: 0,
|
|
|
|
startZoom: 0,
|
|
|
|
title: {
|
|
|
|
en: "Title"
|
|
|
|
},
|
|
|
|
version: "",
|
|
|
|
id: "test"
|
|
|
|
}
|
|
|
|
// TOtal cheat: disable the default layers:
|
|
|
|
Constants.added_by_default.splice(0, Constants.added_by_default.length)
|
|
|
|
const sharedLayers = new Map<string, LayerConfigJson>()
|
|
|
|
sharedLayers.set("public_bookcase", bookcaseLayer["default"])
|
2022-02-04 01:05:35 +01:00
|
|
|
themeConfigJson = new PrepareTheme({
|
2022-01-26 21:40:38 +01:00
|
|
|
tagRenderings: new Map<string, TagRenderingConfigJson>(),
|
|
|
|
sharedLayers: sharedLayers
|
2022-02-04 01:05:35 +01:00
|
|
|
}).convertStrict( themeConfigJson, "test")
|
2022-01-26 21:40:38 +01:00
|
|
|
const themeConfig = new LayoutConfig(themeConfigJson);
|
|
|
|
assert.equal("xyz", themeConfig.layers[0].source.geojsonSource)
|
2021-05-14 02:25:30 +02:00
|
|
|
|
|
|
|
|
2022-01-26 21:40:38 +01:00
|
|
|
}]
|
|
|
|
]);
|
2021-05-14 02:25:30 +02:00
|
|
|
}
|
|
|
|
}
|