forked from MapComplete/MapComplete
Docs: clarify 'ifnot'-behaviour in edge case, add test for this edge case
This commit is contained in:
parent
26d8003289
commit
988a31a8fc
2 changed files with 7 additions and 0 deletions
|
@ -125,6 +125,9 @@ export interface MappingConfigJson {
|
|||
* Note that we can not explicitly render this negative case to the user, we cannot show `does _not_ accept coins`.
|
||||
* If this is important to your usecase, consider using multiple radiobutton-fields without `multiAnswer`
|
||||
*
|
||||
* Ifnot has the lowest priority in comparison with 'if', 'freeform', 'addExtraTags', ...
|
||||
* In the case that two options set different values (e.g. selected option sets "X=Y" and an unselected option sets "X=" through `ifnot`), the latter ifnot is ignored.
|
||||
*
|
||||
* ifunset: Do not apply a tag if a different mapping is chosen.
|
||||
*/
|
||||
ifnot?: TagConfigJson
|
||||
|
|
|
@ -766,6 +766,10 @@ export default class TagRenderingConfig {
|
|||
* const tags = config.constructChangeSpecification("€5", undefined, undefined, {vending: "books;bicycle_tubes" charge: "€42/book"})
|
||||
* tags // => [ new Tag("charge", "€5/bicycle_tube; €42/book")]
|
||||
*
|
||||
* // Conflicting 'if' and 'ifnot' should ignore ifnot (i.e.: should not have 'fountain='
|
||||
* const config = new TagRenderingConfig({"id":"drinking_water_type", multiAnswer: true, mappings: [ {"if": "fountain=bubbler", then: "bubbler", "ifnot": "fountain="},{ "if": "fountain=tap", then: "tap", ifnot: "fountain="}, {if: "natural=spring", then: "spring", ifnot: "natural="}]})
|
||||
* const tags = config.constructChangeSpecification(undefined, undefined, [true, false, false], {})
|
||||
* tags // => [new Tag("fountain", "bubbler"), new Tag("natural", "")]
|
||||
*
|
||||
* @param freeformValue The freeform value which will be applied as 'freeform.key'. Ignored if 'freeform.key' is not set
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue