forked from MapComplete/MapComplete
Fix tests
This commit is contained in:
parent
6023f6e36c
commit
193834c286
16 changed files with 22 additions and 42 deletions
|
@ -546,7 +546,7 @@ class LengthTextField extends TextFieldDef {
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
super(
|
||||||
"length", "A geographical length in meters (rounded at two points). Will give an extra minimap with a measurement tool. Arguments: [ zoomlevel, preferredBackgroundMapType (comma separated) ], e.g. `[\"21\", \"map,photo\"]"
|
"distance", "A geographical distance in meters (rounded at two points). Will give an extra minimap with a measurement tool. Arguments: [ zoomlevel, preferredBackgroundMapType (comma separated) ], e.g. `[\"21\", \"map,photo\"]"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ import CompiledTranslations from "../../assets/generated/CompiledTranslations";
|
||||||
|
|
||||||
export default class Translations {
|
export default class Translations {
|
||||||
|
|
||||||
static t = CompiledTranslations.t;
|
static readonly t : typeof CompiledTranslations.t & Readonly<typeof CompiledTranslations.t> = CompiledTranslations.t;
|
||||||
private static knownLanguages = new Set(known_languages.languages)
|
private static knownLanguages = new Set(known_languages.languages)
|
||||||
constructor() {
|
constructor() {
|
||||||
throw "Translations is static. If you want to intitialize a new translation, use the singular form"
|
throw "Translations is static. If you want to intitialize a new translation, use the singular form"
|
||||||
|
|
|
@ -373,7 +373,7 @@
|
||||||
},
|
},
|
||||||
"freeform": {
|
"freeform": {
|
||||||
"key": "maxwidth:physical",
|
"key": "maxwidth:physical",
|
||||||
"type": "length",
|
"type": "distance",
|
||||||
"helperArgs": [
|
"helperArgs": [
|
||||||
"20",
|
"20",
|
||||||
"map"
|
"map"
|
||||||
|
@ -406,7 +406,7 @@
|
||||||
},
|
},
|
||||||
"freeform": {
|
"freeform": {
|
||||||
"key": "width:separation",
|
"key": "width:separation",
|
||||||
"type": "length",
|
"type": "distance",
|
||||||
"helperArgs": [
|
"helperArgs": [
|
||||||
"21",
|
"21",
|
||||||
"map"
|
"map"
|
||||||
|
@ -440,7 +440,7 @@
|
||||||
},
|
},
|
||||||
"freeform": {
|
"freeform": {
|
||||||
"key": "width:opening",
|
"key": "width:opening",
|
||||||
"type": "length",
|
"type": "distance",
|
||||||
"helperArgs": [
|
"helperArgs": [
|
||||||
"21",
|
"21",
|
||||||
"map"
|
"map"
|
||||||
|
@ -474,7 +474,7 @@
|
||||||
},
|
},
|
||||||
"freeform": {
|
"freeform": {
|
||||||
"key": "overlap",
|
"key": "overlap",
|
||||||
"type": "length",
|
"type": "distance",
|
||||||
"helperArgs": [
|
"helperArgs": [
|
||||||
"21",
|
"21",
|
||||||
"map"
|
"map"
|
||||||
|
|
|
@ -836,7 +836,7 @@
|
||||||
},
|
},
|
||||||
"freeform": {
|
"freeform": {
|
||||||
"key": "width:carriageway",
|
"key": "width:carriageway",
|
||||||
"type": "length",
|
"type": "distance",
|
||||||
"helperArgs": [
|
"helperArgs": [
|
||||||
"20",
|
"20",
|
||||||
"map"
|
"map"
|
||||||
|
@ -1260,7 +1260,7 @@
|
||||||
},
|
},
|
||||||
"freeform": {
|
"freeform": {
|
||||||
"key": "cycleway:buffer",
|
"key": "cycleway:buffer",
|
||||||
"type": "length",
|
"type": "distance",
|
||||||
"helperArgs": [
|
"helperArgs": [
|
||||||
"20",
|
"20",
|
||||||
"map"
|
"map"
|
||||||
|
|
|
@ -338,7 +338,7 @@
|
||||||
},
|
},
|
||||||
"freeform": {
|
"freeform": {
|
||||||
"key": "width",
|
"key": "width",
|
||||||
"type": "length"
|
"type": "distance"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
|
@ -126,7 +126,7 @@
|
||||||
"condition": "sidewalk:left|right=yes",
|
"condition": "sidewalk:left|right=yes",
|
||||||
"freeform": {
|
"freeform": {
|
||||||
"key": "sidewalk:left|right:width",
|
"key": "sidewalk:left|right:width",
|
||||||
"type": "length",
|
"type": "distance",
|
||||||
"helperArgs": [
|
"helperArgs": [
|
||||||
"21",
|
"21",
|
||||||
"map"
|
"map"
|
||||||
|
|
|
@ -548,9 +548,6 @@
|
||||||
"date": {
|
"date": {
|
||||||
"description": "Una data, començant per l'any"
|
"description": "Una data, començant per l'any"
|
||||||
},
|
},
|
||||||
"decimal": {
|
|
||||||
"description": "Un número"
|
|
||||||
},
|
|
||||||
"direction": {
|
"direction": {
|
||||||
"description": "Una orientació"
|
"description": "Una orientació"
|
||||||
},
|
},
|
||||||
|
|
|
@ -634,9 +634,6 @@
|
||||||
"date": {
|
"date": {
|
||||||
"description": "En dato, der starter med årstallet"
|
"description": "En dato, der starter med årstallet"
|
||||||
},
|
},
|
||||||
"decimal": {
|
|
||||||
"description": "Et tal"
|
|
||||||
},
|
|
||||||
"direction": {
|
"direction": {
|
||||||
"description": "En retning"
|
"description": "En retning"
|
||||||
},
|
},
|
||||||
|
|
|
@ -755,9 +755,6 @@
|
||||||
"date": {
|
"date": {
|
||||||
"description": "Ein Datum, beginnend mit der Jahreszahl"
|
"description": "Ein Datum, beginnend mit der Jahreszahl"
|
||||||
},
|
},
|
||||||
"decimal": {
|
|
||||||
"description": "Eine Zahl"
|
|
||||||
},
|
|
||||||
"direction": {
|
"direction": {
|
||||||
"description": "Eine Himmelsrichtung"
|
"description": "Eine Himmelsrichtung"
|
||||||
},
|
},
|
||||||
|
|
|
@ -827,12 +827,12 @@
|
||||||
"date": {
|
"date": {
|
||||||
"description": "A date, starting with the year"
|
"description": "A date, starting with the year"
|
||||||
},
|
},
|
||||||
"decimal": {
|
|
||||||
"description": "A number"
|
|
||||||
},
|
|
||||||
"direction": {
|
"direction": {
|
||||||
"description": "An orientation"
|
"description": "An orientation"
|
||||||
},
|
},
|
||||||
|
"distance": {
|
||||||
|
"description": "A distance in meter"
|
||||||
|
},
|
||||||
"email": {
|
"email": {
|
||||||
"description": "email-adres",
|
"description": "email-adres",
|
||||||
"feedback": "This is not a valid email address",
|
"feedback": "This is not a valid email address",
|
||||||
|
@ -845,9 +845,6 @@
|
||||||
"int": {
|
"int": {
|
||||||
"description": "a whole number"
|
"description": "a whole number"
|
||||||
},
|
},
|
||||||
"length": {
|
|
||||||
"description": "a length measurement in meter"
|
|
||||||
},
|
|
||||||
"nat": {
|
"nat": {
|
||||||
"description": "a positive, whole number or zero",
|
"description": "a positive, whole number or zero",
|
||||||
"mustBePositive": "This number should be positive",
|
"mustBePositive": "This number should be positive",
|
||||||
|
|
|
@ -516,9 +516,6 @@
|
||||||
"deactivate": "Deshabilitar los botones de traducción"
|
"deactivate": "Deshabilitar los botones de traducción"
|
||||||
},
|
},
|
||||||
"validation": {
|
"validation": {
|
||||||
"decimal": {
|
|
||||||
"description": "Un número"
|
|
||||||
},
|
|
||||||
"direction": {
|
"direction": {
|
||||||
"description": "Una orientación"
|
"description": "Una orientación"
|
||||||
},
|
},
|
||||||
|
|
|
@ -144,9 +144,6 @@
|
||||||
"date": {
|
"date": {
|
||||||
"description": "Tanggal, dimulai dari tahun"
|
"description": "Tanggal, dimulai dari tahun"
|
||||||
},
|
},
|
||||||
"decimal": {
|
|
||||||
"description": "Nomor"
|
|
||||||
},
|
|
||||||
"direction": {
|
"direction": {
|
||||||
"description": "Orientasi"
|
"description": "Orientasi"
|
||||||
},
|
},
|
||||||
|
|
|
@ -480,9 +480,6 @@
|
||||||
"date": {
|
"date": {
|
||||||
"description": "En dato, som starter med året"
|
"description": "En dato, som starter med året"
|
||||||
},
|
},
|
||||||
"decimal": {
|
|
||||||
"description": "Et tall"
|
|
||||||
},
|
|
||||||
"direction": {
|
"direction": {
|
||||||
"description": "En retning"
|
"description": "En retning"
|
||||||
},
|
},
|
||||||
|
|
|
@ -753,12 +753,12 @@
|
||||||
"date": {
|
"date": {
|
||||||
"description": "Een datum (beginnend met het jaar)"
|
"description": "Een datum (beginnend met het jaar)"
|
||||||
},
|
},
|
||||||
"decimal": {
|
|
||||||
"description": "Een getal"
|
|
||||||
},
|
|
||||||
"direction": {
|
"direction": {
|
||||||
"description": "Een orientatie"
|
"description": "Een orientatie"
|
||||||
},
|
},
|
||||||
|
"distance": {
|
||||||
|
"description": "Een afstand in meter"
|
||||||
|
},
|
||||||
"email": {
|
"email": {
|
||||||
"description": "email-adres",
|
"description": "email-adres",
|
||||||
"feedback": "Dit is geen geldig email-adres",
|
"feedback": "Dit is geen geldig email-adres",
|
||||||
|
|
|
@ -11,6 +11,7 @@ import {ExtractImages} from "../../../../Models/ThemeConfig/Conversion/FixImages
|
||||||
import * as cyclofix from "../../../../assets/generated/themes/cyclofix.json"
|
import * as cyclofix from "../../../../assets/generated/themes/cyclofix.json"
|
||||||
import {Tag} from "../../../../Logic/Tags/Tag";
|
import {Tag} from "../../../../Logic/Tags/Tag";
|
||||||
import {DesugaringContext} from "../../../../Models/ThemeConfig/Conversion/Conversion";
|
import {DesugaringContext} from "../../../../Models/ThemeConfig/Conversion/Conversion";
|
||||||
|
import {And} from "../../../../Logic/Tags/And";
|
||||||
|
|
||||||
|
|
||||||
const themeConfigJson: LayoutConfigJson = {
|
const themeConfigJson: LayoutConfigJson = {
|
||||||
|
@ -52,7 +53,7 @@ describe("PrepareTheme", () => {
|
||||||
let themeConfigJsonPrepared = prepareStep.convert(theme, "test").result
|
let themeConfigJsonPrepared = prepareStep.convert(theme, "test").result
|
||||||
const themeConfig = new LayoutConfig(themeConfigJsonPrepared);
|
const themeConfig = new LayoutConfig(themeConfigJsonPrepared);
|
||||||
const layerUnderTest = <LayerConfig> themeConfig.layers.find(l => l.id === "public_bookcase")
|
const layerUnderTest = <LayerConfig> themeConfig.layers.find(l => l.id === "public_bookcase")
|
||||||
expect(layerUnderTest.source.osmTags).deep.eq(new Tag("amenity","public_bookcase"))
|
expect(layerUnderTest.source.osmTags).deep.eq(new And([new Tag("amenity","public_bookcase")]))
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
import {describe} from 'mocha'
|
import {describe} from 'mocha'
|
||||||
import {expect} from 'chai'
|
|
||||||
import Translations from "../../UI/i18n/Translations";
|
|
||||||
import ValidatedTextField from "../../UI/Input/ValidatedTextField";
|
import ValidatedTextField from "../../UI/Input/ValidatedTextField";
|
||||||
import {fail} from "assert";
|
import {fail} from "assert";
|
||||||
|
import Translations from "../../UI/i18n/Translations";
|
||||||
|
|
||||||
describe("ValidatedTextFields", () => {
|
describe("ValidatedTextFields", () => {
|
||||||
|
|
||||||
|
@ -10,8 +9,9 @@ describe("ValidatedTextFields", () => {
|
||||||
const ts = Translations.t.validation;
|
const ts = Translations.t.validation;
|
||||||
const missingTranslations = Array.from(ValidatedTextField.allTypes.keys())
|
const missingTranslations = Array.from(ValidatedTextField.allTypes.keys())
|
||||||
.filter(key => ts[key] === undefined || ts[key].description === undefined)
|
.filter(key => ts[key] === undefined || ts[key].description === undefined)
|
||||||
if (missingTranslations !== []) {
|
.filter(key => key !== "distance")
|
||||||
fail("undefined", "a `description` for " + missingTranslations.join(", "), "These validated text fields don't have a type name defined in en.json. (Did you just add one? Run `npm run generate:translations`)")
|
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`)")
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue