Fix: fix tests

This commit is contained in:
Pieter Vander Vennet 2025-08-23 18:57:39 +02:00
parent 197dd67ab1
commit b81f59779d

View file

@ -425,29 +425,25 @@ In the case that MapComplete is pointed to the testing grounds, the edit will be
}
if (typeof v !== "string") {
if(v["asHumanString"]){
if (v["asHumanString"]) {
v = v.asHumanString(true, false)
}else if(typeof v === "object"){
} else if (useLang !== undefined && v?.translations !== undefined) {
v = v.translations[useLang] ?? v.translations["*"] ?? v?.textFor(useLang) ?? v
} else if (v.InnerConstructElement !== undefined) {
console.warn(
"SubstituteKeys received a BaseUIElement to substitute in - this is probably a bug and will be downcast to a string\nThe key is",
key,
"\nThe value is",
v
)
v = v.InnerConstructElement()?.textContent
} else if (typeof v === "object") {
v = JSON.stringify(v)
} else{
v = "" + v
}
}
if (useLang !== undefined && v?.translations !== undefined) {
v = v.translations[useLang] ?? v.translations["*"] ?? v?.textFor(useLang) ?? v
}
if (v.InnerConstructElement !== undefined) {
console.warn(
"SubstituteKeys received a BaseUIElement to substitute in - this is probably a bug and will be downcast to a string\nThe key is",
key,
"\nThe value is",
v
)
v = v.InnerConstructElement()?.textContent
}
v = v.replace(/\n/g, "<br/>")
} else {