forked from MapComplete/MapComplete
		
	Add fakedom to test UI code, replace all 'innerText' with 'textContent' as it is not compatible with fakedom
This commit is contained in:
		
							parent
							
								
									b0b674b2fb
								
							
						
					
					
						commit
						0f66d7f8cc
					
				
					 17 changed files with 281 additions and 20 deletions
				
			
		|  | @ -9,7 +9,7 @@ import {exec} from "child_process"; | |||
|  */ | ||||
| function detectInCode(forbidden: string, reason: string) { | ||||
| 
 | ||||
|     const excludedDirs = [".git", "node_modules", "dist", ".cache", ".parcel-cache", "assets", "vendor"] | ||||
|     const excludedDirs = [".git", "node_modules", "dist", ".cache", ".parcel-cache", "assets", "vendor", ".idea/"] | ||||
| 
 | ||||
|     exec("grep -n \"" + forbidden + "\" -r . " + excludedDirs.map(d => "--exclude-dir=" + d).join(" "), ((error, stdout, stderr) => { | ||||
|         if (error?.message?.startsWith("Command failed: grep")) { | ||||
|  | @ -40,6 +40,10 @@ describe("Code quality", () => { | |||
|     it("should not contain 'constructor.name'", () => { | ||||
|         detectInCode("constructor\\.name", "This is not allowed, as minification does erase names.") | ||||
|     }) | ||||
| 
 | ||||
|     it("should not contain 'innerText'", () => { | ||||
|         detectInCode("innerText", "innerText is not allowed as it is not testable with fakeDom. Use 'textContent' instead.") | ||||
|     }) | ||||
|      | ||||
| }) | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue