mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-12 02:59:45 +00:00
LibWeb: Add more document tests, add comment, text and mixin tests
Also adds a TypeScript definition file for the test runner object.
This commit is contained in:
parent
8b807e65d7
commit
c2a2552e46
Notes:
sideshowbarker
2024-07-19 03:28:13 +09:00
Author: https://github.com/Lubrsi
Commit: c2a2552e46
Pull-request: https://github.com/SerenityOS/serenity/pull/3198
18 changed files with 224 additions and 15 deletions
25
Libraries/LibWeb/Tests/DOM/mixins/ParentNode.js
Normal file
25
Libraries/LibWeb/Tests/DOM/mixins/ParentNode.js
Normal file
|
@ -0,0 +1,25 @@
|
|||
loadPage("file:///home/anon/web-tests/Pages/ParentNode.html");
|
||||
|
||||
afterInitialPageLoad(() => {
|
||||
test("querySelector basics", () => {
|
||||
const firstDuplicateElement = document.querySelector(".duplicate");
|
||||
expect(firstDuplicateElement).not.toBeNull();
|
||||
expect(firstDuplicateElement.nodeName).toBe("div");
|
||||
expect(firstDuplicateElement.innerHTML).toBe("First");
|
||||
|
||||
const noElement = document.querySelector(".nonexistent");
|
||||
expect(noElement).toBeNull();
|
||||
});
|
||||
|
||||
test("querySelectorAll basics", () => {
|
||||
const allDuplicates = document.querySelectorAll(".duplicate");
|
||||
expect(allDuplicates).toHaveLength(2);
|
||||
expect(allDuplicates[0].nodeName).toBe("div");
|
||||
expect(allDuplicates[0].innerHTML).toBe("First");
|
||||
expect(allDuplicates[1].nodeName).toBe("div");
|
||||
expect(allDuplicates[1].innerHTML).toBe("Second");
|
||||
|
||||
const noElements = document.querySelectorAll(".nonexistent");
|
||||
expect(noElements).toHaveLength(0);
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue