forked from MapComplete/MapComplete
Add fakedom to test UI code, replace all 'innerText' with 'textContent' as it is not compatible with fakedom
This commit is contained in:
parent
b0b674b2fb
commit
0f66d7f8cc
17 changed files with 281 additions and 20 deletions
|
@ -20,18 +20,18 @@ export default class Title extends BaseUIElement {
|
|||
}
|
||||
this.level = level;
|
||||
|
||||
let innerText: string = undefined;
|
||||
let text: string = undefined;
|
||||
if (typeof embedded === "string") {
|
||||
innerText = embedded
|
||||
text = embedded
|
||||
} else if (embedded instanceof FixedUiElement) {
|
||||
innerText = embedded.content
|
||||
text = embedded.content
|
||||
} else {
|
||||
if (!Utils.runningFromConsole) {
|
||||
innerText = embedded.ConstructElement()?.innerText
|
||||
text = embedded.ConstructElement()?.textContent
|
||||
}
|
||||
}
|
||||
|
||||
this.id = innerText?.replace(/ /g, '-')
|
||||
this.id = text?.replace(/ /g, '-')
|
||||
?.replace(/[?#.;:/]/, "")
|
||||
?.toLowerCase() ?? ""
|
||||
this.SetClass(Title.defaultClassesPerLevel[level] ?? "")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue