Refactoring: use more accurate context in conversion, fix tests

This commit is contained in:
Pieter Vander Vennet 2023-10-12 16:55:26 +02:00
parent 86d0de3806
commit f77d99f8ed
43 changed files with 999 additions and 367 deletions

View file

@ -42,7 +42,7 @@ export class VariableUiElement extends BaseUIElement {
el.removeChild(el.lastChild)
}
if (contents === undefined) {
if (contents === undefined || contents === null) {
return
}
if (typeof contents === "string") {
@ -54,11 +54,13 @@ export class VariableUiElement extends BaseUIElement {
el.appendChild(c)
}
}
} else {
} else if (contents.ConstructElement) {
const c = contents.ConstructElement()
if (c !== undefined && c !== null) {
el.appendChild(c)
}
} else {
console.error("Could not construct a variable UI element for", contents)
}
})
return el