mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 21:42:43 +00:00 
			
		
		
		
	 60599d03dd
			
		
	
	
		60599d03dd
		
	
	
	
	
		
			
			LibWeb currently has no test suite or program. Let's change that :^) test-web is mostly a copy of test-js, but modified for LibWeb. test-web imports both LibJS/Tests/test-common.js and LibWeb/Test/test-common.js LibWeb's suite provides the ability to specify the page to load, what to do before the page is loaded, and what to do after it's loaded. This also provides a test of document.doctype and its close sibling document.compatMode. Currently, this isn't added to Lagom because of CodeGenerators.
		
			
				
	
	
		
			28 lines
		
	
	
	
		
			898 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			28 lines
		
	
	
	
		
			898 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| // NOTE: The tester loads in LibJS's test-common to prevent duplication.
 | |
| 
 | |
| let __PageToLoad__;
 | |
| 
 | |
| // This tells the tester which page to load.
 | |
| // This will only be checked when we look at which page the test wants to use.
 | |
| // Subsequent calls to loadPage in before/after load will be ignored.
 | |
| let loadPage;
 | |
| 
 | |
| let __BeforePageLoad__ = () => {};
 | |
| 
 | |
| // This function will be run just before loading the page.
 | |
| // This is useful for injecting event listeners.
 | |
| // Defaults to an empty function.
 | |
| let beforePageLoad;
 | |
| 
 | |
| let __AfterPageLoad__ = () => {};
 | |
| 
 | |
| // This function will be run just after loading the page.
 | |
| // This is where the main bulk of the tests should be.
 | |
| // Defaults to an empty function.
 | |
| let afterPageLoad;
 | |
| 
 | |
| (() => {
 | |
|     loadPage = (page) => __PageToLoad__ = page;
 | |
|     beforePageLoad = (callback) => __BeforePageLoad__ = callback;
 | |
|     afterPageLoad = (callback) => __AfterPageLoad__ = callback;
 | |
| })();
 |