refactoring: more fixes, first attempt at tagRenderingAnswer

This commit is contained in:
Pieter Vander Vennet 2023-03-30 04:51:56 +02:00
parent aaaaf1948d
commit 29372c465e
24 changed files with 278 additions and 113 deletions

View file

@ -1,46 +0,0 @@
import { TagRenderingConfigJson } from "../../../Models/ThemeConfig/Json/TagRenderingConfigJson"
import TagRenderingConfig from "../../../Models/ThemeConfig/TagRenderingConfig"
import TagRenderingQuestion from "../../../UI/Popup/TagRenderingQuestion"
import { UIEventSource } from "../../../Logic/UIEventSource"
import { describe, expect, it } from "vitest"
describe("TagRenderingQuestion", () => {
it("should have a freeform text field with the user defined placeholder", () => {
const configJson = <TagRenderingConfigJson>{
id: "test-tag-rendering",
question: "Question?",
render: "Rendering {capacity}",
freeform: {
key: "capacity",
type: "pnat",
placeholder: "Some user defined placeholder",
},
}
const config = new TagRenderingConfig(configJson, "test")
const ui = new TagRenderingQuestion(new UIEventSource<any>({}), config)
const html = ui.ConstructElement()
expect(html.getElementsByTagName("input")[0]["placeholder"]).toBe(
"Some user defined placeholder"
)
}) //*/
/*
it("should have a freeform text field with a type explanation", () => {
Locale.language.setData("en")
const configJson = <TagRenderingConfigJson>{
id: "test-tag-rendering",
question: "Question?",
render: "Rendering {capacity}",
freeform: {
key: "capacity",
type: "pnat",
},
}
const config = new TagRenderingConfig(configJson, "test")
const ui = new TagRenderingQuestion(new UIEventSource<any>({}), config)
const html = ui.ConstructElement()
expect(html.getElementsByTagName("input")[0]["placeholder"]).toBe(
"capacity (a positive, whole number)"
)
})//*/
})