Studio: usability tests

This commit is contained in:
Pieter Vander Vennet 2023-10-20 19:04:55 +02:00
parent 0f60977b6d
commit 2041a9245d
37 changed files with 524 additions and 446 deletions

View file

@ -783,12 +783,19 @@ export class ValidateLayer extends Conversion<
private readonly _path?: string
private readonly _isBuiltin: boolean
private readonly _doesImageExist: DoesImageExist
private _studioValidations: boolean
constructor(path: string, isBuiltin: boolean, doesImageExist: DoesImageExist) {
constructor(
path: string,
isBuiltin: boolean,
doesImageExist: DoesImageExist,
studioValidations: boolean = false
) {
super("Doesn't change anything, but emits warnings and errors", [], "ValidateLayer")
this._path = path
this._isBuiltin = isBuiltin
this._doesImageExist = doesImageExist
this._studioValidations = studioValidations
}
convert(
@ -1116,6 +1123,15 @@ export class ValidateLayer extends Conversion<
context.err("Could not validate layer due to: " + e + e.stack)
}
if (this._studioValidations) {
if (!json.description) {
context.enter("description").err("A description is required")
}
if (!json.name) {
context.enter("name").err("A name is required")
}
}
return { raw: json, parsed: layerConfig }
}
}

View file

@ -310,7 +310,7 @@ export interface LayerConfigJson {
* Do _not_ indicate 'new': 'add a new shop here' is incorrect, as the shop might have existed forever, it could just be unmapped!
*
* question: What is the word to describe this object?
* inline: Add <b>{translated(value)}</b> here
* inline: Add {translated(value)::font-bold} here
*/
title: Translatable
/**

View file

@ -47,7 +47,8 @@ export interface TagRenderingConfigJson {
* question: What text should be rendered?
*
* This piece of text will be shown in the infobox.
* Note that "&LBRACEkey&RBRACE"-parts are substituted by the corresponding values of the element.
* In this text, values within braces (such as {braced(key)}) are replaced by the corresponding `value` in the object.
* For example, if the object contains tags `amenity=school; name=Windy Hill School`, the render string `This school is named {name}` will be shown to the user as `This school is named Windy Hill School`
*
* This text will be shown if:
* - there is no mapping which matches (or there are no matches)