| 
									
										
										
										
											2025-02-22 12:30:35 +02:00
										 |  |  | import { describe, expect, expectTypeOf, it } from "vitest"; | 
					
						
							|  |  |  | import { parseNoteMeta } from "./in_app_help.js"; | 
					
						
							|  |  |  | import type NoteMeta from "./meta/note_meta.js"; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | describe("In-app help", () => { | 
					
						
							|  |  |  |     it("preserves custom folder icon", () => { | 
					
						
							|  |  |  |         const meta: NoteMeta = { | 
					
						
							| 
									
										
										
										
											2025-03-02 20:47:57 +01:00
										 |  |  |             isClone: false, | 
					
						
							|  |  |  |             noteId: "yoAe4jV2yzbd", | 
					
						
							|  |  |  |             notePath: ["OkOZllzB3fqN", "yoAe4jV2yzbd"], | 
					
						
							|  |  |  |             title: "Features", | 
					
						
							|  |  |  |             notePosition: 40, | 
					
						
							|  |  |  |             prefix: null, | 
					
						
							|  |  |  |             isExpanded: false, | 
					
						
							|  |  |  |             type: "text", | 
					
						
							|  |  |  |             mime: "text/html", | 
					
						
							|  |  |  |             attributes: [ | 
					
						
							| 
									
										
										
										
											2025-02-22 12:30:35 +02:00
										 |  |  |                 { | 
					
						
							| 
									
										
										
										
											2025-03-02 20:47:57 +01:00
										 |  |  |                     type: "label", | 
					
						
							|  |  |  |                     name: "iconClass", | 
					
						
							|  |  |  |                     value: "bx bx-star", | 
					
						
							|  |  |  |                     isInheritable: false, | 
					
						
							|  |  |  |                     position: 10 | 
					
						
							| 
									
										
										
										
											2025-02-22 12:30:35 +02:00
										 |  |  |                 } | 
					
						
							|  |  |  |             ], | 
					
						
							| 
									
										
										
										
											2025-03-02 20:47:57 +01:00
										 |  |  |             format: "html", | 
					
						
							|  |  |  |             attachments: [], | 
					
						
							|  |  |  |             dirFileName: "Features", | 
					
						
							|  |  |  |             children: [] | 
					
						
							| 
									
										
										
										
											2025-02-22 12:30:35 +02:00
										 |  |  |         }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         const item = parseNoteMeta(meta, "/"); | 
					
						
							|  |  |  |         const icon = item.attributes?.find((a) => a.name === "iconClass"); | 
					
						
							|  |  |  |         expect(icon?.value).toBe("bx bx-star"); | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  | }); |