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,20 +425,11 @@ In the case that MapComplete is pointed to the testing grounds, the edit will be
} }
if (typeof v !== "string") { if (typeof v !== "string") {
if(v["asHumanString"]){ if (v["asHumanString"]) {
v = v.asHumanString(true, false) v = v.asHumanString(true, false)
}else if(typeof v === "object"){ } else if (useLang !== undefined && v?.translations !== undefined) {
v = JSON.stringify(v)
} else{
v = "" + v
}
}
if (useLang !== undefined && v?.translations !== undefined) {
v = v.translations[useLang] ?? v.translations["*"] ?? v?.textFor(useLang) ?? v v = v.translations[useLang] ?? v.translations["*"] ?? v?.textFor(useLang) ?? v
} } else if (v.InnerConstructElement !== undefined) {
if (v.InnerConstructElement !== undefined) {
console.warn( console.warn(
"SubstituteKeys received a BaseUIElement to substitute in - this is probably a bug and will be downcast to a string\nThe key is", "SubstituteKeys received a BaseUIElement to substitute in - this is probably a bug and will be downcast to a string\nThe key is",
key, key,
@ -446,6 +437,11 @@ In the case that MapComplete is pointed to the testing grounds, the edit will be
v v
) )
v = v.InnerConstructElement()?.textContent v = v.InnerConstructElement()?.textContent
} else if (typeof v === "object") {
v = JSON.stringify(v)
} else{
v = "" + v
}
} }