mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-04 15:45:25 +00:00
LibWeb: Implement test-web in terms of LibTest/JavaScriptTestRunner
This deduplicates the test-js copy-ism :^)
This commit is contained in:
committed by
Linus Groh
parent
f137c1bfaa
commit
d897abf4c2
@@ -1,31 +1,34 @@
|
||||
loadPage("file:///res/html/misc/blank.html");
|
||||
describe("readyState", () => {
|
||||
loadLocalPage("/res/html/misc/blank.html");
|
||||
|
||||
beforeInitialPageLoad(() => {
|
||||
window.events = [];
|
||||
beforeInitialPageLoad(page => {
|
||||
window.events = [];
|
||||
|
||||
document.addEventListener("readystatechange", () => {
|
||||
window.events.push(document.readyState);
|
||||
});
|
||||
page.document.addEventListener("readystatechange", () => {
|
||||
window.events.push(page.document.readyState);
|
||||
});
|
||||
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
test("Ready state should be 'interactive' when 'DOMContentLoaded' fires", () => {
|
||||
expect(document.readyState).toBe("interactive");
|
||||
page.document.addEventListener("DOMContentLoaded", () => {
|
||||
test("Ready state should be 'interactive' when 'DOMContentLoaded' fires", () => {
|
||||
expect(page.document.readyState).toBe("interactive");
|
||||
});
|
||||
});
|
||||
|
||||
test("Ready state should be 'loading' initially", () => {
|
||||
expect(page.document.readyState).toBe("loading");
|
||||
});
|
||||
});
|
||||
|
||||
test("Ready state should be 'loading' initially", () => {
|
||||
expect(document.readyState).toBe("loading");
|
||||
});
|
||||
});
|
||||
afterInitialPageLoad(page => {
|
||||
test("'interactive' should come before 'complete' and both should have happened", () => {
|
||||
expect(page.window.events).toHaveLength(2);
|
||||
expect(page.window.events[0]).toBe("interactive");
|
||||
expect(page.window.events[1]).toBe("complete");
|
||||
});
|
||||
|
||||
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");
|
||||
test("Ready state should be 'complete' after loading", () => {
|
||||
expect(page.document.readyState).toBe("complete");
|
||||
});
|
||||
});
|
||||
waitForPageToLoad();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user