blob: 12b6c1d8dfbdcb5ce6a7fcc6dc14cc70ed224ad4 (
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
|
loadPage("file:///res/html/misc/blank.html");
beforeInitialPageLoad(() => {
window.events = [];
document.addEventListener("readystatechange", () => {
window.events.push(document.readyState);
});
document.addEventListener("DOMContentLoaded", () => {
test("Ready state should be 'interactive' when 'DOMContentLoaded' fires", () => {
expect(document.readyState).toBe("interactive");
});
});
test("Ready state should be 'loading' initially", () => {
expect(document.readyState).toBe("loading");
});
});
afterInitialPageLoad(() => {
test("'interactive' should come before 'complete' and both should have happened", () => {
expect(window.events).toHaveLength(2);
expect(window.events[0]).toBe("interactive");
expect(window.events[1]).toBe("complete");
});
test("Ready state should be 'complete' after loading", () => {
expect(document.readyState).toBe("complete");
});
});
|