Fix tests
This commit is contained in:
parent
50ae3bf5ba
commit
148e056f96
1 changed files with 11 additions and 7 deletions
|
@ -179,7 +179,7 @@ class AddImportLayers extends DesugaringStep<LayoutConfigJson> {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class AddMiniMap extends DesugaringStep<LayerConfigJson> {
|
export class AddMiniMap extends DesugaringStep<LayerConfigJson> {
|
||||||
constructor() {
|
constructor() {
|
||||||
super("Adds a default 'minimap'-element to the tagrenderings if none of the elements define such a minimap", ["tagRenderings"]);
|
super("Adds a default 'minimap'-element to the tagrenderings if none of the elements define such a minimap", ["tagRenderings"]);
|
||||||
}
|
}
|
||||||
|
@ -188,14 +188,18 @@ class AddMiniMap extends DesugaringStep<LayerConfigJson> {
|
||||||
* Returns true if this tag rendering has a minimap in some language.
|
* Returns true if this tag rendering has a minimap in some language.
|
||||||
* Note: this minimap can be hidden by conditions
|
* Note: this minimap can be hidden by conditions
|
||||||
*/
|
*/
|
||||||
private static hasMinimap(renderingConfig: TagRenderingConfigJson): boolean {
|
static hasMinimap(renderingConfig: TagRenderingConfigJson): boolean {
|
||||||
const translations: Translation[] = Utils.NoNull([renderingConfig.render, ...(renderingConfig.mappings ?? []).map(m => m.then)]);
|
const translations: any[] = Utils.NoNull([renderingConfig.render, ...(renderingConfig.mappings ?? []).map(m => m.then)]);
|
||||||
for (const translation of translations) {
|
for (let translation of translations) {
|
||||||
for (const key in translation.translations) {
|
if(typeof translation == "string"){
|
||||||
if (!translation.translations.hasOwnProperty(key)) {
|
translation = {"*": translation}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const key in translation) {
|
||||||
|
if (!translation.hasOwnProperty(key)) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
const template = translation.translations[key]
|
const template = translation[key]
|
||||||
const parts = SubstitutedTranslation.ExtractSpecialComponents(template)
|
const parts = SubstitutedTranslation.ExtractSpecialComponents(template)
|
||||||
const hasMiniMap = parts.filter(part => part.special !== undefined).some(special => special.special.func.funcName === "minimap")
|
const hasMiniMap = parts.filter(part => part.special !== undefined).some(special => special.special.func.funcName === "minimap")
|
||||||
if (hasMiniMap) {
|
if (hasMiniMap) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue