Reformat all files with prettier

This commit is contained in:
Pieter Vander Vennet 2022-09-08 21:40:48 +02:00
parent e22d189376
commit b541d3eab4
382 changed files with 50893 additions and 35566 deletions

View file

@ -1,15 +1,13 @@
import {describe} from 'mocha'
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 { expect } from 'chai';
import Locale from "../../../UI/i18n/Locale";
import { describe } from "mocha"
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 { expect } from "chai"
import Locale from "../../../UI/i18n/Locale"
describe("TagRenderingQuestion", () => {
it("should have a freeform text field with the user defined placeholder", () => {
const configJson = <TagRenderingConfigJson>{
id: "test-tag-rendering",
question: "Question?",
@ -17,17 +15,18 @@ describe("TagRenderingQuestion", () => {
freeform: {
key: "capacity",
type: "pnat",
placeholder: "Some user defined placeholder"
}
placeholder: "Some user defined placeholder",
},
}
const config = new TagRenderingConfig(configJson, "test")
const ui = new TagRenderingQuestion( new UIEventSource<any>({}), config)
const ui = new TagRenderingQuestion(new UIEventSource<any>({}), config)
const html = ui.ConstructElement()
expect(html.getElementsByTagName("input")[0]["placeholder"]).eq("Some user defined placeholder")
expect(html.getElementsByTagName("input")[0]["placeholder"]).eq(
"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",
@ -36,12 +35,13 @@ describe("TagRenderingQuestion", () => {
freeform: {
key: "capacity",
type: "pnat",
}
},
}
const config = new TagRenderingConfig(configJson, "test")
const ui = new TagRenderingQuestion( new UIEventSource<any>({}), config)
const ui = new TagRenderingQuestion(new UIEventSource<any>({}), config)
const html = ui.ConstructElement()
expect(html.getElementsByTagName("input")[0]["placeholder"])
.eq("capacity (a positive, whole number)")
expect(html.getElementsByTagName("input")[0]["placeholder"]).eq(
"capacity (a positive, whole number)"
)
})
})

View file

@ -1,19 +1,23 @@
import {describe} from 'mocha'
import SpecialVisualizations from "../../UI/SpecialVisualizations";
import {expect} from "chai";
import { describe } from "mocha"
import SpecialVisualizations from "../../UI/SpecialVisualizations"
import { expect } from "chai"
describe("SpecialVisualisations", () => {
describe("predifined special visualisations", () => {
it("should not have an argument called 'type'", () => {
const specials = SpecialVisualizations.specialVisualizations
for (const special of specials) {
expect(special.funcName).not.eq('type', "A special visualisation is not allowed to be named 'type', as this will conflict with the 'special'-blocks")
expect(special.funcName).not.eq(
"type",
"A special visualisation is not allowed to be named 'type', as this will conflict with the 'special'-blocks"
)
for (const arg of special.args) {
expect(arg.name).not.eq('type', "An argument is not allowed to be called 'type', as this will conflict with the 'special'-blocks")
expect(arg.name).not.eq(
"type",
"An argument is not allowed to be called 'type', as this will conflict with the 'special'-blocks"
)
}
}
})
})
})
})

View file

@ -1,17 +1,20 @@
import {describe} from 'mocha'
import ValidatedTextField from "../../UI/Input/ValidatedTextField";
import {fail} from "assert";
import Translations from "../../UI/i18n/Translations";
import { describe } from "mocha"
import ValidatedTextField from "../../UI/Input/ValidatedTextField"
import { fail } from "assert"
import Translations from "../../UI/i18n/Translations"
describe("ValidatedTextFields", () => {
it("should all have description in the translations", () => {
const ts = Translations.t.validation;
const ts = Translations.t.validation
const missingTranslations = Array.from(ValidatedTextField.allTypes.keys())
.filter(key => ts[key] === undefined || ts[key].description === undefined)
.filter(key => key !== "distance")
.filter((key) => ts[key] === undefined || ts[key].description === undefined)
.filter((key) => key !== "distance")
if (missingTranslations.length > 0) {
fail("The validated text fields don't have a description defined in en.json for "+missingTranslations.join(", ")+". (Did you just add one? Run `npm run generate:translations`)")
fail(
"The validated text fields don't have a description defined in en.json for " +
missingTranslations.join(", ") +
". (Did you just add one? Run `npm run generate:translations`)"
)
}
})
})