forked from MapComplete/MapComplete
Fix: fix tests
This commit is contained in:
parent
197dd67ab1
commit
b81f59779d
1 changed files with 12 additions and 16 deletions
28
src/Utils.ts
28
src/Utils.ts
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue