blob: 54d0b830c62cb370a777c368bef9924b2224662f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
// NOTE: The tester loads in LibJS's test-common to prevent duplication.
// NOTE: "window.libweb_tester" is set to a special tester object.
// The object currently provides the following functions:
// - changePage(url) - change page to given URL. Everything afterwards will refer to the new page.
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 initial load will be ignored.
let loadPage;
let __BeforeInitialPageLoad__ = () => {};
// This function will be called just before loading the initial page.
// This is useful for injecting event listeners.
// Defaults to an empty function.
let beforeInitialPageLoad;
let __AfterInitialPageLoad__ = () => {};
// This function will be called just after loading the initial page.
// This is where the main bulk of the tests should be.
// Defaults to an empty function.
let afterInitialPageLoad;
(() => {
loadPage = (page) => __PageToLoad__ = page;
beforeInitialPageLoad = (callback) => __BeforeInitialPageLoad__ = callback;
afterInitialPageLoad = (callback) => __AfterInitialPageLoad__ = callback;
})();
|