forked from MapComplete/MapComplete
		
	Fix tests, fix units
This commit is contained in:
		
							parent
							
								
									8b1b843dbe
								
							
						
					
					
						commit
						fb3e3a040b
					
				
					 7 changed files with 52 additions and 17 deletions
				
			
		|  | @ -287,13 +287,21 @@ export default class ValidatedTextField { | |||
|             input = new CombinedInputElement( | ||||
|                 input, | ||||
|                 unitDropDown, | ||||
|                 (text, denom) => denom?.canonicalValue(text, true) ?? undefined, | ||||
|                 // combine the value from the textfield and the dropdown into the resulting value that should go into OSM
 | ||||
|                 (text, denom) => denom?.canonicalValue(text, true) ?? undefined,  | ||||
|                 (valueWithDenom: string) => { | ||||
|                     const [text, denom] = unit.findDenomination(valueWithDenom) ?? [valueWithDenom, undefined]; | ||||
|                     if(text === undefined){ | ||||
|                         return [valueWithDenom, undefined] | ||||
|                     // Take the value from OSM and feed it into the textfield and the dropdown
 | ||||
|                     const withDenom = unit.findDenomination(valueWithDenom); | ||||
|                     if(withDenom === undefined) | ||||
|                     { | ||||
|                         // Not a valid value at all - we give it undefined and leave the details up to the other elements
 | ||||
|                         return [undefined, undefined] | ||||
|                     } | ||||
|                     return [text, denom] | ||||
|                     const [strippedText, denom] = withDenom | ||||
|                     if(strippedText === undefined){ | ||||
|                         return [undefined, undefined] | ||||
|                     } | ||||
|                     return [strippedText, denom] | ||||
|                 } | ||||
|             ).SetClass("flex") | ||||
|         } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue