| 
									
										
										
										
											2021-06-16 17:09:32 +02:00
										 |  |  | import ValidatedTextField from "./UI/Input/ValidatedTextField"; | 
					
						
							| 
									
										
										
										
											2021-06-14 19:21:33 +02:00
										 |  |  | import Combine from "./UI/Base/Combine"; | 
					
						
							| 
									
										
										
										
											2021-06-16 14:23:53 +02:00
										 |  |  | import {VariableUiElement} from "./UI/Base/VariableUIElement"; | 
					
						
							| 
									
										
										
										
											2021-06-16 21:23:03 +02:00
										 |  |  | import {UIEventSource} from "./Logic/UIEventSource"; | 
					
						
							|  |  |  | import TagRenderingConfig from "./Customizations/JSON/TagRenderingConfig"; | 
					
						
							|  |  |  | import State from "./State"; | 
					
						
							|  |  |  | import TagRenderingQuestion from "./UI/Popup/TagRenderingQuestion"; | 
					
						
							| 
									
										
										
										
											2021-06-17 13:17:16 +02:00
										 |  |  | import {SlideShow} from "./UI/Image/SlideShow"; | 
					
						
							|  |  |  | import {FixedUiElement} from "./UI/Base/FixedUiElement"; | 
					
						
							|  |  |  | import Img from "./UI/Base/Img"; | 
					
						
							| 
									
										
										
										
											2021-06-18 01:25:13 +02:00
										 |  |  | import {AttributedImage} from "./UI/Image/AttributedImage"; | 
					
						
							|  |  |  | import {Imgur} from "./Logic/Web/Imgur"; | 
					
						
							| 
									
										
										
										
											2021-06-21 03:14:03 +02:00
										 |  |  | import ReviewForm from "./UI/Reviews/ReviewForm"; | 
					
						
							|  |  |  | import {OsmConnection} from "./Logic/Osm/OsmConnection"; | 
					
						
							| 
									
										
										
										
											2020-08-31 02:59:47 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-14 17:28:11 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-17 13:17:16 +02:00
										 |  |  | function TestSlideshow(){ | 
					
						
							|  |  |  |     const elems = new UIEventSource([ | 
					
						
							|  |  |  |         new FixedUiElement("A"), | 
					
						
							|  |  |  |         new FixedUiElement("qmsldkfjqmlsdkjfmqlskdjfmqlksdf").SetClass("text-xl"), | 
					
						
							|  |  |  |         new Img("https://i.imgur.com/8lIQ5Hv.jpg"), | 
					
						
							| 
									
										
										
										
											2021-06-21 03:14:03 +02:00
										 |  |  |         new AttributedImage("https://i.imgur.com/y5XudzW.jpg", Imgur.singleton), | 
					
						
							| 
									
										
										
										
											2021-06-17 13:17:16 +02:00
										 |  |  |         new Img("https://www.grunge.com/img/gallery/the-real-reason-your-cat-sleeps-so-much/intro-1601496900.webp") | 
					
						
							|  |  |  |     ]) | 
					
						
							|  |  |  |     new SlideShow(elems).AttachTo("maindiv") | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-16 21:23:03 +02:00
										 |  |  | function TestTagRendering(){ | 
					
						
							|  |  |  |     State.state = new State(undefined) | 
					
						
							|  |  |  |     const tagsSource = new UIEventSource({ | 
					
						
							|  |  |  |         id:"node/1" | 
					
						
							|  |  |  |     }) | 
					
						
							|  |  |  |     new TagRenderingQuestion( | 
					
						
							|  |  |  |         tagsSource, | 
					
						
							|  |  |  |         new TagRenderingConfig({ | 
					
						
							|  |  |  |             multiAnswer: false, | 
					
						
							|  |  |  |             freeform: { | 
					
						
							|  |  |  |                 key:"valve" | 
					
						
							|  |  |  |             }, | 
					
						
							|  |  |  |             question: "What valves are supported?", | 
					
						
							|  |  |  |             render: "This pump supports {valve}", | 
					
						
							|  |  |  |             mappings: [ | 
					
						
							|  |  |  |                 { | 
					
						
							|  |  |  |                     if: "valve=dunlop", | 
					
						
							|  |  |  |                     then: "This pump supports dunlop" | 
					
						
							|  |  |  |                 }, | 
					
						
							|  |  |  |                 { | 
					
						
							|  |  |  |                     if:"valve=shrader", | 
					
						
							|  |  |  |                     then:"shrader is supported", | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |             ], | 
					
						
							|  |  |  |              | 
					
						
							| 
									
										
										
										
											2021-06-22 03:16:45 +02:00
										 |  |  |         }, undefined, "test"), | 
					
						
							|  |  |  |         [] | 
					
						
							| 
									
										
										
										
											2021-06-16 21:23:03 +02:00
										 |  |  |     ).AttachTo("maindiv") | 
					
						
							|  |  |  |     new VariableUiElement(tagsSource.map(tags => tags["valves"])).SetClass("alert").AttachTo("extradiv") | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | function TestAllInputMethods(){ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     new Combine(ValidatedTextField.tpList.map(tp => { | 
					
						
							|  |  |  |         const tf = ValidatedTextField.InputForType(tp.name); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         return new Combine([tf, new VariableUiElement(tf.GetValue()).SetClass("alert")]); | 
					
						
							|  |  |  |     })).AttachTo("maindiv")     | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-21 03:14:03 +02:00
										 |  |  | new ReviewForm(() => { | 
					
						
							|  |  |  |     return undefined; | 
					
						
							|  |  |  | }, new OsmConnection(true, new UIEventSource<string>(undefined), "test")).AttachTo("maindiv"); |